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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxx>

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@xxxxxxxxxxxxxxxxx
 Phone:(076)455-3131  Fax:(076)455-0956  Toll:7576-3622
====================================================================


[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux