mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
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@jp.fujitsu.com>
This commit is contained in:
1 parent
343c821d10
commit
54ab7bfb1a
1 file changed
+13
-16
+13
-16
@@ -1071,26 +1071,23 @@ def xm_top(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)
|
||||
try:
|
||||
(options, params) = getopt.gnu_getopt(args, 'c', ['clear'])
|
||||
except getopt.GetoptError, opterr:
|
||||
err(opterr)
|
||||
sys.exit(1)
|
||||
|
||||
if len(myargs) not in (1, 2):
|
||||
err('Invalid arguments: ' + str(myargs))
|
||||
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()
|
||||
|
||||