On Thu, 2011-01-27 at 18:00 +0900, Ken'ichi Ohmichi wrote: > Hi, > > When I tried to attach the interface after detaching the same interface, > the virsh command output the following and it failed: > > # virsh detach-interface Domain01 network --mac 52:54:00:0d:78:92 > Interface detached successfully > > # virsh attach-interface Domain01 network default --mac 52:54:00:0d:78:92 > error: Failed to attach interface > error: internal error unable to execute QEMU command 'device_add': > Duplicate ID 'net0' for device > # > > The reason is that a detached device is not removed from the list > "qemu_device_opts", and this patch fixes it. > Signed-off-by: Ken'ichi Ohmichi <oomi...@mxs.nes.nec.co.jp> > --- > --- a/hw/qdev.c 2011-01-27 17:42:25.000000000 +0900 > +++ b/hw/qdev.c 2011-01-27 17:43:46.000000000 +0900 > @@ -905,6 +905,8 @@ int do_device_del(Monitor *mon, const QD > qerror_report(QERR_DEVICE_NOT_FOUND, id); > return -1; > } > + qemu_opts_del(qemu_opts_find(&qemu_device_opts, id)); > + > return qdev_unplug(dev); > }
I successfully applied and tested this patch. It resolves the attach problem. -- William