Fix BZ 239763 -- we shouldn't add a disk twice when we add it to a live domain on Xen 3.1.

This commit is contained in:
Hugh O. Brock 2007-06-13 15:20:43 -04:00
parent 8ff8679b10
commit 04501bbe77

View File

@ -538,10 +538,13 @@ class vmmDomain(gobject.GObject):
def add_device(self, xml):
logging.debug("Adding device " + xml)
# get the XML for the live domain before we attach the device
# otherwise the device gets added to the XML twice.
vmxml = self.vm.XMLDesc(0)
if self.is_active():
self.vm.attachDevice(xml)
vmxml = self.vm.XMLDesc(0)
index = vmxml.find("</devices>")
newxml = vmxml[0:index] + xml + vmxml[index:]