From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=51257 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OOCVb-00050z-5V for qemu-devel@nongnu.org; Mon, 14 Jun 2010 12:27:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OOCVZ-0002vu-4M for qemu-devel@nongnu.org; Mon, 14 Jun 2010 12:27:34 -0400 Received: from mail-yw0-f190.google.com ([209.85.211.190]:65481) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OOCVZ-0002vq-0N for qemu-devel@nongnu.org; Mon, 14 Jun 2010 12:27:33 -0400 Received: by ywh28 with SMTP id 28so3282257ywh.28 for ; Mon, 14 Jun 2010 09:27:29 -0700 (PDT) Message-ID: <4C16586F.7070102@codemonkey.ws> Date: Mon, 14 Jun 2010 11:27:27 -0500 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] Make netdev_del delete the netdev even when it's in use References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: qemu-devel@nongnu.org On 06/11/2010 07:21 AM, Markus Armbruster wrote: > To hot-unplug guest and host part of a network device, you do: > > device_del NIC-ID > netdev_del NETDEV-ID > > For PCI devices, device_del merely tells ACPI to unplug the device. > The device goes away for real only after the guest processed the ACPI > unplug event. > > You have to wait until then (e.g. by polling info pci) before you can > unplug the netdev. Not good. > > Fix by removing the "in use" check from do_netdev_del(). Deleting a > netdev while it's in use is safe; packets simply get routed to the bit > bucket. > > Signed-off-by: Markus Armbruster > Applied. Thanks. Regards, Anthony Liguori > --- > I can add a force option instead, if you think that's better. > > net.c | 4 ---- > 1 files changed, 0 insertions(+), 4 deletions(-) > > diff --git a/net.c b/net.c > index 4cb93ed..0703698 100644 > --- a/net.c > +++ b/net.c > @@ -1221,10 +1221,6 @@ int do_netdev_del(Monitor *mon, const QDict *qdict, QObject **ret_data) > qerror_report(QERR_DEVICE_NOT_FOUND, id); > return -1; > } > - if (vc->peer) { > - qerror_report(QERR_DEVICE_IN_USE, id); > - return -1; > - } > qemu_del_vlan_client(vc); > qemu_opts_del(qemu_opts_find(&qemu_netdev_opts, id)); > return 0; >