[et-mgmt-tools] [PATCH][RESEND}Check the starting domain's uuid

Tatsuro Enokura fj7716hz at aa.jp.fujitsu.com
Tue Mar 13 08:11:06 UTC 2007


Hi,

Would you give me a comment on this patch?
If not, please apply it.

Tatsuro Enokura wrote:
> The virt-install command has a problem that the information of
> the existent domain is overwritten by virt-install command
> specifing the domain's uuid.
> Futhermore, the existent domain's set-up file is overwritten
> on the xen-3.0.4.
> 
> I make a patch checking the starting domain's uuid on Guest.py.

Signed-off-by: Tatsuro Enokura <fj1826dm at aa.jp.fujitsu.com>

Thanks,
Tatsuro Enokura

-------
diff -r 95196b0f37a5 virtinst/Guest.py
--- a/virtinst/Guest.py Mon Mar 12 12:39:59 2007 -0400
+++ b/virtinst/Guest.py Tue Mar 13 17:11:14 2007 +0900
@@ -582,7 +582,19 @@ class Guest(object):

     def _set_defaults(self):
         if self.uuid is None:
-            self.uuid = util.uuidToString(util.randomUUID())
+            while 1:
+                self.uuid = util.uuidToString(util.randomUUID())
+                try:
+                    if self.conn.lookupByUUIDString(self.uuid) is not None:
+                        continue
+                except libvirt.libvirtError:
+                    break
+        else:
+            try:
+                if self.conn.lookupByUUIDString(self.uuid) is not None:
+                    raise RuntimeError, "UUID has been already used by
the other guests!"
+            except libvirt.libvirtError:
+                pass
         if self.vcpus is None:
             self.vcpus = 1
         if self.name is None or self.memory is None:
------------------------------------------------------

-- 
====================================================================
 Tatsuro Enokura    Toyama Fujitsu Limited
                    Software Development)2nd Development)2nd Project
 E-mail:fj7716hz at aa.jp.fujitsu.com
 Phone:(076)455-3131  Fax:(076)455-0956  Toll:7576-3622
====================================================================




More information about the et-mgmt-tools mailing list