[et-mgmt-tools] [PATCH] In virt-manager GUI, when the disk is added, VM cannot be started.

Masayuki Sunou fj1826dm at aa.jp.fujitsu.com
Fri Jun 8 07:57:37 UTC 2007


Hi

When the disk is added to active VM by virt-manager, VM cannot be
restarted after VM is stopped.
--> Bugzilla Bug 239763
    https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=239763

This patch fixes it.

When the device is attached to active VM, virt-manager adds the device
twice in add_device() of "domain.py".
1. Call attachDevice()
2. Call define_domain() after the XML is updated
Therefore, the same device is doubly attached.
(So, when the device is disk, VM cannot be started)

This patch fixes "domain.py" as follows so that the same device is not
doubly attached.
  VM is active   : Call attachDevice() only
  VM is inactive : Call define_domain() after the XML is updated


Signed-off-by: Masayuki Sunou <fj1826dm at aa.jp.fujitsu.com>

Thanks,
Masayuki Sunou.

----------------------------------------------------------------------
diff -r 27ad8c7fbc3e src/virtManager/domain.py
--- a/src/virtManager/domain.py	Thu May 24 16:49:13 2007 -0400
+++ b/src/virtManager/domain.py	Sat Jun 09 14:45:20 2007 +0900
@@ -540,15 +540,15 @@ class vmmDomain(gobject.GObject):
 
         if self.is_active():
             self.vm.attachDevice(xml)
-
-        vmxml = self.vm.XMLDesc(0)
-
-        index = vmxml.find("</devices>")
-        newxml = vmxml[0:index] + xml + vmxml[index:]
-
-        logging.debug("Redefine with " + newxml)
-
-        self.get_connection().define_domain(newxml)
+        else:
+            vmxml = self.vm.XMLDesc(0)
+
+            index = vmxml.find("</devices>")
+            newxml = vmxml[0:index] + xml + vmxml[index:]
+
+            logging.debug("Redefine with " + newxml)
+
+            self.get_connection().define_domain(newxml)
 
     def remove_device(self, dev_xml):
         logging.debug("Removing device " + dev_xml)




More information about the et-mgmt-tools mailing list