[1/2] net: Drop the legacy "name" parameter from the -net option
diff mbox series

Message ID 20191206053640.29368-2-thuth@redhat.com
State New
Headers show
Series
  • net: Drop legacy "name" from -net and remove NetLegacy
Related show

Commit Message

Thomas Huth Dec. 6, 2019, 5:36 a.m. UTC
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@redhat.com>
---
 net/net.c            | 10 +---------
 qapi/net.json        |  4 +---
 qemu-deprecated.texi | 12 +++++++-----
 3 files changed, 9 insertions(+), 17 deletions(-)

Comments

Eric Blake Dec. 6, 2019, 3:07 p.m. UTC | #1
On 12/5/19 11:36 PM, Thomas Huth wrote:
> 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@redhat.com>
> ---
>   net/net.c            | 10 +---------
>   qapi/net.json        |  4 +---
>   qemu-deprecated.texi | 12 +++++++-----
>   3 files changed, 9 insertions(+), 17 deletions(-)
> 

Reviewed-by: Eric Blake <eblake@redhat.com>

A quick grep of 'name.*netdev' and 'netdev.*name' in libvirt did not 
seem to find any uses of the deprecated syntax.
Markus Armbruster Dec. 10, 2019, 11:06 a.m. UTC | #2
Thomas Huth <thuth@redhat.com> writes:

> 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@redhat.com>
[...]
> 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
>  ##

Uh, when did we start to add "dropped in" to our doc comments?

We should either do this systematically, or not at all.  If the former,
we have quite a few "dropped in" to add belatedly.

I vote for "not at all".

>  { 'struct': 'NetLegacy',
>    'data': {
>      '*id':   'str',
> -    '*name': 'str',
>      'opts':  'NetLegacyOptions' } }
>  
>  ##
[...]

History:

$ git-log -S"dropped in" -- qapi qapi-schema.json
commit ffaee83bcb28913b8b854aeab78b1a1f2115712d
Author: Markus Armbruster <armbru@redhat.com>
Date:   Tue Jul 9 17:20:53 2019 +0200

    qapi: Move query-target from misc.json to machine.json
    
    Move query-target and its return type TargetInfo from misc.json to
    machine.json, where they are covered by MAINTAINERS section "Machine
    core".  Also move its implementation from arch_init.c to
    hw/core/machine-qmp-cmds, where it is likewise covered.
    
    All users of SysEmuTarget are now in machine.json.  Move it there from
    common.json.
    
    Signed-off-by: Markus Armbruster <armbru@redhat.com>
    Message-Id: <20190709152053.16670-3-armbru@redhat.com>

commit 416756cc049006ab8a05fe39e5f2e6af25cad9d2
Author: Thomas Huth <thuth@redhat.com>
Date:   Tue Aug 21 13:27:48 2018 +0200

    Record history of ppcemb target in common.json
    
    We recently removed the long deprecated "ppcemb" target.  This adds a
    comment in common.json about the SysEmuTarget type, recording when it was
    removed.
    
    Suggested-by: Eric Blake <eblake@redhat.com>
    Signed-off-by: David Gibson <david@gibson.dropbear.id.au>

commit 4088b5536436090207dcf6d15e47908f74b2d8f2
Author: Thomas Huth <thuth@redhat.com>
Date:   Tue May 15 18:26:20 2018 +0200

    qapi/net.json: Fix the version number of the "vlan" removal
    
    "vlan" will be dropped in 2.13, not in 2.12. And while we're at it,
    use the better wording "dropped in" instead of "removed with" (also
    for the "dump" removal).
    
    Reported-by: Stefan Hajnoczi <stefanha@redhat.com>
    Reported-by: Eric Blake <eblake@redhat.com>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    Reviewed-by: Eric Blake <eblake@redhat.com>
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>

commit 608cfed66a6adeac136b0c09cd62d081062256f3
Author: Markus Armbruster <armbru@redhat.com>
Date:   Thu Aug 24 21:14:00 2017 +0200

    qapi-schema: Collect UI stuff in qapi/ui.json
    
    UI stuff is remote desktop stuff (Spice, VNC) and input stuff (mouse,
    keyboard).
    
    Cc: Gerd Hoffmann <kraxel@redhat.com>
    Signed-off-by: Markus Armbruster <armbru@redhat.com>
    Message-Id: <1503602048-12268-9-git-send-email-armbru@redhat.com>
    Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
    Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>

commit 912092b8e47f31c3db25e088af8460d9e752da29
Author: Gerd Hoffmann <kraxel@redhat.com>
Date:   Thu Jul 27 12:47:20 2017 +0200

    ui: drop altgr and altgr_r QKeyCodes
    
    The right alt key (alt_r aka KEY_RIGHTALT) is used for AltGr.
    The altgr and altgr_r keys simply don't exist.  Drop them.
    
    Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
    Reviewed-by: Eric Blake <eblake@redhat.com>
    Message-id: 20170727104720.30061-1-kraxel@redhat.com
Thomas Huth Dec. 10, 2019, 11:28 a.m. UTC | #3
On 10/12/2019 12.06, Markus Armbruster wrote:
> Thomas Huth <thuth@redhat.com> writes:
> 
>> 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@redhat.com>
> [...]
>> 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
>>  ##
> 
> Uh, when did we start to add "dropped in" to our doc comments?
> 
> We should either do this systematically, or not at all.  If the former,
> we have quite a few "dropped in" to add belatedly.

IIRC this has been suggested by Eric, see e.g.:

 https://patchwork.kernel.org/patch/10227335/#21501161

Anyway, it should not matter much for this patch here, since the line
gets removed again in the 2nd patch anyway.

 Thomas

Patch
diff mbox series

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.
 
-@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.
 
+@section System emulator command line arguments
+
+@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)