Received: from [140.186.70.92] (port=33890 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ON3F0-0001yZ-QC for qemu-devel@nongnu.org; Fri, 11 Jun 2010 08:21:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1ON3Ew-0007nn-Kf for qemu-devel@nongnu.org; Fri, 11 Jun 2010 08:21:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:16459) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ON3Ew-0007nS-Ct for qemu-devel@nongnu.org; Fri, 11 Jun 2010 08:21:38 -0400 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o5BCLauN017424 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 11 Jun 2010 08:21:37 -0400 Received: from blackfin.pond.sub.org (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o5BCLZ4f029590 for ; Fri, 11 Jun 2010 08:21:36 -0400 From: Markus Armbruster Date: Fri, 11 Jun 2010 14:21:34 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: [Qemu-devel] [PATCH] Make netdev_del delete the netdev even when it's in use List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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 --- 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; -- 1.6.6.1