mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 07:13:54 -06:00
net: Improve error message for -net hubport a bit
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> Message-id: 1431691143-1015-2-git-send-email-armbru@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
6a8b4a5be2
commit
ca7eb1848b
2 changed files with 6 additions and 4 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue