Fix xm save command
PATCH 1/1 Fix xm save command
Hi,
When I didn't give a necessary argument to xm save command, I saw the following error message.
# xm save -c vm1 Unexpected error: exceptions.IndexError
Please report to [email protected] Traceback (most recent call last):
File "/usr/sbin/xm", line 10, in ?
main.main(sys.argv)
File "/usr/lib/python/xen/xm/main.py", line 2594, in main
_, rc = _run_cmd(cmd, cmd_name, args)
File "/usr/lib/python/xen/xm/main.py", line 2618, in _run_cmd
return True, cmd(args)
File "/usr/lib/python/xen/xm/main.py", line 703, in xm_save
savefile = params[1]
IndexError: list index out of range
This patch fixes the problem. A test result is as follows.
# xm save -c vm1 Error: Wrong number of parameters Usage: xm save [-c] <Domain> <CheckpointFile>
Save a domain state to restore later.
-c, --checkpoint Leave domain running after creating
snapshot
And the following sys.exit(1) is not necessary because sys.exit(1) is executed in usage().
@@ -710,9 +707,9 @@ def xm_save(args):
if len(params) != 2:
err("Wrong number of parameters")
usage('save')- sys.exit(1)
Best regards,
Kan
tools/python/xen/xm/main.py +3 -6
@@ -699,9 +699,6 @@ def xm_save(args): err(opterr) sys.exit(1) - dom = params[0] - savefile = params[1] - checkpoint = False for (k, v) in options: if k in ['-c', '--checkpoint']:
@@ -710,9 +707,9 @@ def xm_save(args): if len(params) != 2: err("Wrong number of parameters") usage('save') - sys.exit(1) - - savefile = os.path.abspath(savefile) + + dom = params[0] + savefile = os.path.abspath(params[1]) if not os.access(os.path.dirname(savefile), os.W_OK): err("xm save: Unable to create file %s" % savefile)
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel