qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Amit Shah <amit.shah@redhat.com>
To: qemu list <qemu-devel@nongnu.org>
Cc: Amit Shah <amit.shah@redhat.com>,
	Juan Quintela <quintela@redhat.com>,
	Gerd Hoffmann <kraxel@redhat.com>,
	Markus Armbruster <armbru@redhat.com>
Subject: [Qemu-devel] [PATCH] net: Fix hotplug with pci_add
Date: Tue,  8 Jun 2010 20:47:53 +0530	[thread overview]
Message-ID: <96e6e74c3b7adc90d57e1303cd09d272bc9f7e06.1276010252.git.amit.shah@redhat.com> (raw)

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 <amit.shah@redhat.com>
---
 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

             reply	other threads:[~2010-06-08 15:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-08 15:17 Amit Shah [this message]
2010-06-08 15:31 ` [Qemu-devel] Re: [PATCH] net: Fix hotplug with pci_add Gerd Hoffmann
2010-06-08 16:40   ` Amit Shah

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=96e6e74c3b7adc90d57e1303cd09d272bc9f7e06.1276010252.git.amit.shah@redhat.com \
    --to=amit.shah@redhat.com \
    --cc=armbru@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).