[et-mgmt-tools] [PATCH 1 of 2] Added suggestion from Daniel Berrange to always do the undefine
"Bryan M. Kearney <bkearney at redhat.com>" at redhat.com
"Bryan M. Kearney <bkearney at redhat.com>" at redhat.com
Fri Jun 27 11:52:53 UTC 2008
# HG changeset patch
# User "Bryan M. Kearney <bkearney at redhat.com>"
# Date 1214567351 14400
# Node ID 09f0cc44fc08b377aab683e583e73294156c0e3c
# Parent efba908eb79ad0bf2805c27f784de92578207f1b
Added suggestion from Daniel Berrange to always do the undefine
diff -r efba908eb79a -r 09f0cc44fc08 virtinst/Guest.py
--- a/virtinst/Guest.py Thu Jun 26 12:32:47 2008 -0400
+++ b/virtinst/Guest.py Fri Jun 27 07:49:11 2008 -0400
@@ -937,12 +937,14 @@ class Guest(object):
vm = self.conn.lookupByName(self.name)
if removeOld:
if vm is not None:
- if vm.ID() == -1:
+ if vm.ID() != -1:
+ logging.info("Destroying image %s" %(self.name))
+ vm.destroy()
+ try:
logging.info("Removing old definition for image %s" %(self.name))
vm.undefine()
- else:
- logging.info("Destroying image %s" %(self.name))
- vm.destroy()
+ except:
+ pass
else:
if vm is not None:
raise RuntimeError, _("Domain named %s already exists!") %(self.name,)
More information about the et-mgmt-tools
mailing list