From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: eblake@redhat.co, stefanha@redhat.com
Subject: [Qemu-devel] [PATCH v2 01/15] net: Improve error message for -net hubport a bit
Date: Fri, 15 May 2015 13:58:49 +0200 [thread overview]
Message-ID: <1431691143-1015-2-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <1431691143-1015-1-git-send-email-armbru@redhat.com>
Type "hubport" is valid only with -netdev. Unfortunately, that's
detected late and the error message doesn't explain why:
$ qemu-system-i386 -net hubport,id=foo,hubid=0
qemu-system-i386: -net hubport,id=foo,hubid=0: Device 'hubport' could not be initialized
Improve the error message to "Parameter 'type' expects a net type".
Not fixed: -net hubport without the parameters required by -netdev
hubport still asks for those parameters:
$ qemu-system-i386 -net hubport
qemu-system-i386: -net hubport: Parameter 'hubid' is missing
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
net/hub.c | 5 +----
net/net.c | 5 +++++
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/net/hub.c b/net/hub.c
index 2b60ab9..261f8cc 100644
--- a/net/hub.c
+++ b/net/hub.c
@@ -286,12 +286,9 @@ int net_init_hubport(const NetClientOptions *opts, const char *name,
const NetdevHubPortOptions *hubport;
assert(opts->kind == NET_CLIENT_OPTIONS_KIND_HUBPORT);
+ assert(!peer);
hubport = opts->hubport;
- if (peer) {
- return -EINVAL;
- }
-
net_hub_add_port(hubport->hubid, name);
return 0;
}
diff --git a/net/net.c b/net/net.c
index 7427f6a..d9aaeb5 100644
--- a/net/net.c
+++ b/net/net.c
@@ -882,6 +882,11 @@ static int net_client_init1(const void *object, int is_netdev, Error **errp)
} else {
u.net = object;
opts = u.net->opts;
+ if (opts->kind == NET_CLIENT_OPTIONS_KIND_HUBPORT) {
+ error_set(errp, QERR_INVALID_PARAMETER_VALUE, "type",
+ "a net type");
+ return -1;
+ }
/* missing optional values have been initialized to "all bits zero" */
name = u.net->has_id ? u.net->id : u.net->name;
}
--
1.9.3
next prev parent reply other threads:[~2015-05-15 11:59 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-15 11:58 [Qemu-devel] [PATCH v2 00/15] net: Improve error reporting Markus Armbruster
2015-05-15 11:58 ` Markus Armbruster [this message]
2015-05-15 11:58 ` [Qemu-devel] [PATCH v2 02/15] net: Permit incremental conversion of init functions to Error Markus Armbruster
2015-05-15 11:58 ` [Qemu-devel] [PATCH v2 03/15] net: Improve -net nic error reporting Markus Armbruster
2015-05-15 11:58 ` [Qemu-devel] [PATCH v2 04/15] net/dump: Improve -net/host_net_add dump " Markus Armbruster
2015-05-15 11:58 ` [Qemu-devel] [PATCH v2 05/15] tap: net_tap_fd_init() can't fail, drop dead error handling Markus Armbruster
2015-05-15 11:58 ` [Qemu-devel] [PATCH v2 06/15] tap: Improve -netdev/netdev_add/-net/... bridge error reporting Markus Armbruster
2015-05-15 11:58 ` [Qemu-devel] [PATCH v2 07/15] tap: Convert tap_set_sndbuf() to Error Markus Armbruster
2015-05-15 11:58 ` [Qemu-devel] [PATCH v2 08/15] tap: Convert net_init_tap_one() " Markus Armbruster
2015-05-19 12:52 ` Stefan Hajnoczi
2015-05-15 11:58 ` [Qemu-devel] [PATCH v2 09/15] tap: Convert launch_script() " Markus Armbruster
2015-05-15 11:58 ` [Qemu-devel] [PATCH v2 10/15] tap: Permit incremental conversion of tap_open() " Markus Armbruster
2015-05-15 11:58 ` [Qemu-devel] [PATCH v2 11/15] tap-linux: Convert " Markus Armbruster
2015-05-15 11:59 ` [Qemu-devel] [PATCH v2 12/15] tap-bsd: " Markus Armbruster
2015-05-15 14:36 ` Eric Blake
2015-05-15 11:59 ` [Qemu-devel] [PATCH v2 13/15] tap-solaris: " Markus Armbruster
2015-05-15 11:59 ` [Qemu-devel] [PATCH v2 14/15] tap: Finish conversion of " Markus Armbruster
2015-05-15 11:59 ` [Qemu-devel] [PATCH v2 15/15] tap: Improve -netdev/netdev_add/-net/... tap error reporting Markus Armbruster
2015-05-15 14:38 ` Eric Blake
2015-05-19 13:15 ` [Qemu-devel] [PATCH v2 00/15] net: Improve " Stefan Hajnoczi
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=1431691143-1015-2-git-send-email-armbru@redhat.com \
--to=armbru@redhat.com \
--cc=eblake@redhat.co \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@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).