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

Tatsuro Enokura fj7716hz at aa.jp.fujitsu.com
Thu Mar 1 08:11:28 UTC 2007


Hi

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 1776ef836bf6 virtinst/Guest.py
--- a/virtinst/Guest.py Wed Feb 28 07:47:31 2007 -0500
+++ b/virtinst/Guest.py Fri Mar 02 00:07:29 2007 +0900
@@ -554,7 +554,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 must be specified for all
guests!"
+            except libvirt.libvirtError:
+                pass
         if self.vcpus is None:
             self.vcpus = 1
         if self.name is None or self.memory is None:
=======================================================================




More information about the et-mgmt-tools mailing list