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] This patch adds a checking of wrong param

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] This patch adds a checking of wrong parameter into xm dmesg command.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 02 Nov 2006 22:10:10 +0000
Delivery-date: Thu, 02 Nov 2006 21:44:47 -0800
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 Ewan Mellor <ewan@xxxxxxxxxxxxx>
# Node ID f3f492ba8e8d630175415ba27df2a48e9e43913d
# Parent  55e8f40ef6e4b5131c984c5625bdf30f46268dd3
This patch adds a checking of wrong parameter into xm dmesg command.
If wrong parameter is given, xm dmesg command shows the following
error messages.

Error: No parameter required
Usage: xm dmesg [-c|--clear]

Read and/or clear Xend's message buffer.
  -c, --clear                    Clear dmesg buffer

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

diff -r 55e8f40ef6e4 -r f3f492ba8e8d tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py       Wed Nov 01 15:56:22 2006 +0000
+++ b/tools/python/xen/xm/main.py       Wed Nov 01 15:56:55 2006 +0000
@@ -1071,26 +1071,23 @@ def xm_dmesg(args):
 def xm_dmesg(args):
     arg_check(args, "dmesg", 0, 1)
     
-    gopts = Opts(use="""[-c|--clear]
-
-Read Xen's message buffer (boot output, warning and error messages) or clear
-its contents if the [-c|--clear] flag is specified.
-""")
-
-    gopts.opt('clear', short='c',
-              fn=set_true, default=0,
-              use="Clear the contents of the Xen message buffer.")
-    # Work around for gopts
-    myargs = args
-    myargs.insert(0, 'dmesg')
-    gopts.parse(myargs)
-    
-    if len(myargs) not in (1, 2):
-        err('Invalid arguments: ' + str(myargs))
+    try:
+        (options, params) = getopt.gnu_getopt(args, 'c', ['clear'])
+    except getopt.GetoptError, opterr:
+        err(opterr)
+        sys.exit(1)
+    
+    use_clear = 0
+    for (k, v) in options:
+        if k in ['-c', '--clear']:
+            use_clear = 1
+    
+    if len(params) :
+        err("No parameter required")
         usage('dmesg')
         sys.exit(1)
 
-    if not gopts.vals.clear:
+    if not use_clear:
         print server.xend.node.dmesg.info()
     else:
         server.xend.node.dmesg.clear()

_______________________________________________
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] This patch adds a checking of wrong parameter into xm dmesg command., Xen patchbot-unstable <=