From: "Michael S. Tsirkin" <mst@redhat.com>
To: Amit Shah <amit.shah@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>,
Gerd Hoffmann <kraxel@redhat.com>,
qemu list <qemu-devel@nongnu.org>,
Juan Quintela <quintela@redhat.com>
Subject: [Qemu-devel] Re: [PATCH v2] net: Fix hotplug with pci_add
Date: Wed, 9 Jun 2010 12:58:20 +0300 [thread overview]
Message-ID: <20100609095820.GA5885@redhat.com> (raw)
In-Reply-To: <356ef9bdde008d695e7c75dd1566222d6160d4b6.1276011638.git.amit.shah@redhat.com>
On Tue, Jun 08, 2010 at 09:13:58PM +0530, Amit Shah wrote:
> 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.
>
> This was broken in 5294e2c774f120e10b44652ac143abda356f44eb
>
> Also changes the behaviour where no .init is defined for a
> net_client_type. Previously, 0 was returned, which indicated the init
> was successful and that 0 was the index into the nd_tables[] array.
> Return -1, indicating unsuccessful init, in such a case.
>
> Signed-off-by: Amit Shah <amit.shah@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
I'll pick this up if no one beats me to it.
> ---
> Sorry, v1 was a stale patch.
>
> v2:
> - Init 'ret' to -1, fixes compile err and added note in the commit msg
> explaining this.
>
> net.c | 7 +++++--
> 1 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/net.c b/net.c
> index efa8b3d..4cb93ed 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;
> @@ -1118,14 +1119,16 @@ int net_client_init(Monitor *mon, QemuOpts *opts, int is_netdev)
> vlan = qemu_find_vlan(qemu_opt_get_number(opts, "vlan", 0), 1);
> }
>
> + ret = -1;
> 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
>
prev parent reply other threads:[~2010-06-09 10:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-08 15:43 [Qemu-devel] [PATCH v2] net: Fix hotplug with pci_add Amit Shah
2010-06-08 15:55 ` [Qemu-devel] " Juan Quintela
2010-06-08 16:33 ` [Qemu-devel] " Markus Armbruster
2010-06-08 17:26 ` Amit Shah
2010-06-09 6:37 ` Markus Armbruster
2010-06-09 7:59 ` [Qemu-devel] " Juan Quintela
2010-06-09 10:28 ` Amit Shah
2010-06-09 9:58 ` [Qemu-devel] " Amit Shah
2010-06-09 11:31 ` Markus Armbruster
2010-06-15 8:05 ` Amit Shah
2010-06-09 9:58 ` Michael S. Tsirkin [this message]
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=20100609095820.GA5885@redhat.com \
--to=mst@redhat.com \
--cc=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.