WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] [XM] Fix argument parsing for dump-core s

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [XM] Fix argument parsing for dump-core subcommand
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Sat, 23 Sep 2006 15:40:12 +0000
Delivery-date: Sat, 23 Sep 2006 08:40:54 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User atse@xxxxxxxxxxxxxxxxxxxxxxxx
# Node ID dfbadf4696fdb5a9a396ca0e12b087e9629a8b48
# Parent  047669f57e5c1bb7902f55c63dc61eebf7f4a67e
[XM] Fix argument parsing for dump-core subcommand

Signed-off-by: Masaki Kanno <kanno.masaki@xxxxxxxxxxxxxx>
Signed-off-by: Alastair Tse <atse@xxxxxxxxxxxxx>
---
 tools/python/xen/xm/main.py |   31 +++++++++++++++----------------
 1 files changed, 15 insertions(+), 16 deletions(-)

diff -r 047669f57e5c -r dfbadf4696fd tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py       Sat Sep 23 12:39:18 2006 +0100
+++ b/tools/python/xen/xm/main.py       Sat Sep 23 13:39:32 2006 +0100
@@ -701,22 +701,21 @@ def xm_unpause(args):
     server.xend.domain.unpause(dom)
 
 def xm_dump_core(args):
-    arg_check(args, "dump-core",1,3)
     live = False
     crash = False
-    import getopt
-    (options, params) = getopt.gnu_getopt(args, 'LC', ['live','crash'])
-
-    for (k, v) in options:
-        if k in ['-L', '--live']:
-            live = True
-        if k in ['-C', '--crash']:
-            crash = True
-
-    if len(params) == 0 or len(params) > 2:
-        err("invalid number of parameters")
-        usage("dump-core")
-
+    try:
+        (options, params) = getopt.gnu_getopt(args, 'LC', ['live','crash'])
+        for (k, v) in options:
+            if k in ('-L', '--live'):
+                live = True
+            if k in ('-C', '--crash'):
+                crash = True
+
+        if len(params) not in (1, 2):
+            raise OptionError("Expects 1 or 2 argument(s)")
+    except getopt.GetoptError, e:
+        raise OptionError(str(e))
+    
     dom = params[0]
     if len(params) == 2:
         filename = os.path.abspath(params[1])
@@ -727,14 +726,14 @@ def xm_dump_core(args):
         server.xend.domain.pause(dom)
 
     try:
-        print "dumping core of domain:%s ..." % str(dom)
+        print "Dumping core of domain: %s ..." % str(dom)
         server.xend.domain.dump(dom, filename, live, crash)
     finally:
         if not live:
             server.xend.domain.unpause(dom)
 
     if crash:
-        print "destroying domain:%s ..." % str(dom)
+        print "Destroying domain: %s ..." % str(dom)
         server.xend.domain.destroy(dom)
 
 def xm_rename(args):

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [XM] Fix argument parsing for dump-core subcommand, Xen patchbot-unstable <=