On Fri, Jun 08, 2007 at 04:57:37PM +0900, Masayuki Sunou wrote: > 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 It is implementation defined whether attachDevice() persists te changes it makes. In Xen 3.1.0 it happens to persist them, but in earlier Xen it does not. So we still need to use define_domain as well. > VM is inactive : Call define_domain() after the XML is updated > > > Signed-off-by: Masayuki Sunou <fj1826dm@xxxxxxxxxxxxxxxxx> > > 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) The key is that we should be calling vm.XMLDesc(0) before the call to attachDevice() so we get the original XML prior to any device addition. I'll add such a fix. Regards, Dan. -- |=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|