Skip to contentSkip to conversation

Fix xm restore command

PATCH New Masaki Kanno 1 participant 1 message Jan 17, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix xm restore command

Hi,

I found minor bugs in xm restore command.

1) When I gave a wrong check point file, a return code of command was 0.

# touch /tmp/dummy
# xm restore /tmp/dummy
Error: not a valid guest state file: signature read
# echo $?
0

2) When Xend had been stopping, I saw the following traceback message.

# xend stop
# xm restore /xen/save.vm1 
Unexpected error: exceptions.AttributeError

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 2531, in main

    _, rc = _run_cmd(cmd, cmd_name, args)
  File "/usr/lib/python/xen/xm/main.py", line 2555, in _run_cmd
    return True, cmd(args)
  File "/usr/lib/python/xen/xm/main.py", line 747, in xm_restore
    err("%s" % ex.faultString)

AttributeError: error instance has no attribute 'faultString'

This patch fixes the bugs. Test results are as follows.

# touch /tmp/dummy
# xm restore /tmp/dummy
Error: not a valid guest state file: signature read
Usage: xm restore <CheckpointFile> [-p]

Restore a domain from a saved state.
-p, --paused Do not unpause domain after restoring it

# echo $?
1
# xend stop
# xm restore /xen/save.vm1
Error: Unable to connect to xend: Connection refused. Is xend running?

Best regards,
Kan

tools/python/xen/xm/main.py +4 -7
diff -r f17b34df974f tools/python/xen/xm/main.py
@@ -738,13 +738,10 @@ def xm_restore(args):
         err("xm restore: Unable to read file %s" % savefile)
         sys.exit(1)
 
-    try:
-        if serverType == SERVER_XEN_API:
-            server.xenapi.VM.restore(savefile, paused)
-        else:
-            server.xend.domain.restore(savefile, paused)
-    except Exception, ex:
-        err("%s" % ex.faultString)
+    if serverType == SERVER_XEN_API:
+        server.xenapi.VM.restore(savefile, paused)
+    else:
+        server.xend.domain.restore(savefile, paused)
 
 
 def datetime_to_secs(v):

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel