From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=54972 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OM0Xx-00034W-3I for qemu-devel@nongnu.org; Tue, 08 Jun 2010 11:16:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OM0Xv-0001VU-VT for qemu-devel@nongnu.org; Tue, 08 Jun 2010 11:16:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52169) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OM0Xv-0001VL-LA for qemu-devel@nongnu.org; Tue, 08 Jun 2010 11:16:55 -0400 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o58FGrFH014926 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 8 Jun 2010 11:16:54 -0400 From: Amit Shah Date: Tue, 8 Jun 2010 20:47:53 +0530 Message-Id: <96e6e74c3b7adc90d57e1303cd09d272bc9f7e06.1276010252.git.amit.shah@redhat.com> Subject: [Qemu-devel] [PATCH] net: Fix hotplug with pci_add List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu list Cc: Amit Shah , Juan Quintela , Gerd Hoffmann , Markus Armbruster The correct model type wasn't getting added when hotplugging nics with pci_add. Testcase: start VM with default nic type. In the qemu_monitor: (qemu) pci_add auto nic model=virtio This results in a nic hot-plug of the same nic type as the default. Signed-off-by: Amit Shah --- net.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/net.c b/net.c index efa8b3d..ca421ed 100644 --- a/net.c +++ b/net.c @@ -1106,6 +1106,7 @@ int net_client_init(Monitor *mon, QemuOpts *opts, int is_netdev) for (i = 0; net_client_types[i].type != NULL; i++) { if (!strcmp(net_client_types[i].type, type)) { VLANState *vlan = NULL; + int ret; if (qemu_opts_validate(opts, &net_client_types[i].desc[0]) == -1) { return -1; @@ -1119,13 +1120,14 @@ int net_client_init(Monitor *mon, QemuOpts *opts, int is_netdev) } if (net_client_types[i].init) { - if (net_client_types[i].init(opts, mon, name, vlan) < 0) { + ret = net_client_types[i].init(opts, mon, name, vlan); + if (ret < 0) { /* TODO push error reporting into init() methods */ qerror_report(QERR_DEVICE_INIT_FAILED, type); return -1; } } - return 0; + return ret; } } -- 1.7.0.1