From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=49036 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PmSIb-00069x-Ef for qemu-devel@nongnu.org; Mon, 07 Feb 2011 09:42:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PmSIZ-0004Kv-UY for qemu-devel@nongnu.org; Mon, 07 Feb 2011 09:42:41 -0500 Received: from mail-wy0-f173.google.com ([74.125.82.173]:63850) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PmSIZ-0004KZ-Ml for qemu-devel@nongnu.org; Mon, 07 Feb 2011 09:42:39 -0500 Received: by wyg36 with SMTP id 36so4831948wyg.4 for ; Mon, 07 Feb 2011 06:42:38 -0800 (PST) Subject: Re: [Qemu-devel] [PATCH] Remove a detached device from qemu_device_opts. From: William Dauchy In-Reply-To: <20110127180057.eb28d17f.oomichi@mxs.nes.nec.co.jp> References: <20110127180057.eb28d17f.oomichi@mxs.nes.nec.co.jp> Content-Type: text/plain; charset="UTF-8" Date: Mon, 07 Feb 2011 15:40:09 +0100 Message-ID: <1297089609.27183.5.camel@hitchhiker.gandi.net> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Ken'ichi Ohmichi 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 > --- > --- 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