Signed-off-by: Chris Evich <[email protected]>
---
client/virt/libvirt_vm.py | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/client/virt/libvirt_vm.py b/client/virt/libvirt_vm.py
index ef00414..34f8379 100644
--- a/client/virt/libvirt_vm.py
+++ b/client/virt/libvirt_vm.py
@@ -216,14 +216,17 @@ def virsh_restore(name, uri = "", path = ""):
logging.error("Cannon restore VM that is %s" % state)
return False
logging.debug("Restoring VM from %s" % path)
- # Restore automatically removes the state file when successful
result = virsh_cmd("restore %s" % path)
+ try: # always remove state file in case storage changed
+ os.unlink(path)
+ except OSError:
+ pass # ignore missing files
state = virsh_domstate(name, uri)
if state in ('paused',):
return True
else:
logging.error("Restoring VM from %s failed in state %s." %
- (path,state)
+ (path,state))
return False
def virsh_start(name, uri = ""):
--
1.7.1
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest