aboutsummaryrefslogtreecommitdiff
path: root/net/net.c
diff options
context:
space:
mode:
authorThomas Huth <thuth@redhat.com>2018-09-20 10:14:08 +0200
committerThomas Huth <thuth@redhat.com>2018-09-25 17:26:17 +0200
commit101625a4d4ac7e96227a156bc5f6d21a9cc383cd (patch)
tree5055d974e9b5b0e670408f4b1ccbe51056a1633d /net/net.c
parent681a1eafe27d7520818e3827ef87e093fb2387e0 (diff)
downloadqemu-101625a4d4ac7e96227a156bc5f6d21a9cc383cd.zip
qemu-101625a4d4ac7e96227a156bc5f6d21a9cc383cd.tar.gz
qemu-101625a4d4ac7e96227a156bc5f6d21a9cc383cd.tar.bz2
net: Deprecate the "name" parameter of -net
In early times, network backends were specified by a "vlan" and "name" tuple. With the introduction of netdevs, the "name" was replaced by an "id" (which is supposed to be unique), but the "name" parameter stayed as an alias which could be used instead of "id". Unfortunately, we miss the duplication check for "name": $ qemu-system-x86_64 -net user,name=n1 -net user,name=n1 ... starts without an error, while "id" correctly complains: $ qemu-system-x86_64 -net user,id=n1 -net user,id=n1 qemu-system-x86_64: -net user,id=n1: Duplicate ID 'n1' for net Instead of trying to fix the code for the legacy "name" parameter, let's rather get rid of this old interface and deprecate the "name" parameter now - this will also be less confusing for the users in the long run. Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'net/net.c')
-rw-r--r--net/net.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/net/net.c b/net/net.c
index 2a31339..cdcd5cf 100644
--- a/net/net.c
+++ b/net/net.c
@@ -984,6 +984,10 @@ static int net_client_init1(const void *object, bool is_netdev, Error **errp)
/* missing optional values have been initialized to "all bits zero" */
name = net->has_id ? net->id : net->name;
+ if (net->has_name) {
+ warn_report("The 'name' parameter is deprecated, use 'id' instead");
+ }
+
/* Map the old options to the new flat type */
switch (opts->type) {
case NET_LEGACY_OPTIONS_TYPE_NONE: