[libvirt] [PATCH 1/2] net: Drop the legacy "name" parameter from the -net option

Thomas Huth thuth at redhat.com
Fri Dec 6 05:36:39 UTC 2019


It's been deprecated since QEMU v3.1, so it's time to finally
remove it. The "id" parameter can simply be used instead.

Signed-off-by: Thomas Huth <thuth at redhat.com>
---
 net/net.c            | 10 +---------
 qapi/net.json        |  4 +---
 qemu-deprecated.texi | 12 +++++++-----
 3 files changed, 9 insertions(+), 17 deletions(-)

diff --git a/net/net.c b/net/net.c
index 84aa6d8d00..ee4a76eb3e 100644
--- a/net/net.c
+++ b/net/net.c
@@ -969,12 +969,10 @@ static int net_client_init1(const void *object, bool is_netdev, Error **errp)
 {
     Netdev legacy = {0};
     const Netdev *netdev;
-    const char *name;
     NetClientState *peer = NULL;
 
     if (is_netdev) {
         netdev = object;
-        name = netdev->id;
 
         if (netdev->type == NET_CLIENT_DRIVER_NIC ||
             !net_client_init_fun[netdev->type]) {
@@ -987,12 +985,6 @@ static int net_client_init1(const void *object, bool is_netdev, Error **errp)
         const NetLegacyOptions *opts = net->opts;
         legacy.id = net->id;
         netdev = &legacy;
-        /* 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) {
@@ -1052,7 +1044,7 @@ static int net_client_init1(const void *object, bool is_netdev, Error **errp)
         }
     }
 
-    if (net_client_init_fun[netdev->type](netdev, name, peer, errp) < 0) {
+    if (net_client_init_fun[netdev->type](netdev, netdev->id, peer, errp) < 0) {
         /* FIXME drop when all init functions store an Error */
         if (errp && !*errp) {
             error_setg(errp, QERR_DEVICE_INIT_FAILED,
diff --git a/qapi/net.json b/qapi/net.json
index 335295be50..ff280ccd16 100644
--- a/qapi/net.json
+++ b/qapi/net.json
@@ -488,18 +488,16 @@
 #
 # @id: identifier for monitor commands
 #
-# @name: identifier for monitor commands, ignored if @id is present
-#
 # @opts: device type specific properties (legacy)
 #
 # Since: 1.2
 #
 # 'vlan': dropped in 3.0
+# 'name': dropped in 5.0
 ##
 { 'struct': 'NetLegacy',
   'data': {
     '*id':   'str',
-    '*name': 'str',
     'opts':  'NetLegacyOptions' } }
 
 ##
diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi
index 2850f9a520..2f9efb45ba 100644
--- a/qemu-deprecated.texi
+++ b/qemu-deprecated.texi
@@ -42,11 +42,6 @@ The 'file' driver for drives is no longer appropriate for character or host
 devices and will only accept regular files (S_IFREG). The correct driver
 for these file types is 'host_cdrom' or 'host_device' as appropriate.
 
- at subsection -net ...,name=@var{name} (since 3.1)
-
-The @option{name} parameter of the @option{-net} option is a synonym
-for the @option{id} parameter, which should now be used instead.
-
 @subsection -smp (invalid topologies) (since 3.1)
 
 CPU topology properties should describe whole machine topology including
@@ -371,6 +366,13 @@ What follows is a record of recently removed, formerly deprecated
 features that serves as a record for users who have encountered
 trouble after a recent upgrade.
 
+ at section System emulator command line arguments
+
+ at subsection -net ...,name=@var{name} (removed in 5.0)
+
+The @option{name} parameter of the @option{-net} option was a synonym
+for the @option{id} parameter, which should now be used instead.
+
 @section Human Monitor Protocol (HMP) commands
 
 @subsection The hub_id parameter of 'hostfwd_add' / 'hostfwd_remove' (removed in 5.0)
-- 
2.18.1




More information about the libvir-list mailing list