From nobody Thu May 9 00:58:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1537388023303899.3907336599412; Wed, 19 Sep 2018 13:13:43 -0700 (PDT) Received: from localhost ([::1]:47130 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g2iqn-00038M-Hu for importer@patchew.org; Wed, 19 Sep 2018 16:13:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59834) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g2ipn-0002nb-Ci for qemu-devel@nongnu.org; Wed, 19 Sep 2018 16:12:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g2ipj-0003Gv-3Q for qemu-devel@nongnu.org; Wed, 19 Sep 2018 16:12:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37144) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g2ipb-00039g-9P for qemu-devel@nongnu.org; Wed, 19 Sep 2018 16:12:18 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 23B5785A01; Wed, 19 Sep 2018 20:12:10 +0000 (UTC) Received: from thuth.com (ovpn-117-73.ams2.redhat.com [10.36.117.73]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6BD3484F0; Wed, 19 Sep 2018 20:12:08 +0000 (UTC) From: Thomas Huth To: Jason Wang , qemu-devel@nongnu.org Date: Wed, 19 Sep 2018 22:12:04 +0200 Message-Id: <1537387924-2653-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 19 Sep 2018 20:12:10 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [QEMU PATCH] net: Deprecate the old way of using a legacy net via "name" instead of "id" X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: libvir-list@redhat.com, Samuel Thibault Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=3Dn1 -net user,name=3Dn1 ... starts without an error, while "id" correctly complains: $ qemu-system-x86_64 -net user,id=3Dn1 -net user,id=3Dn1 qemu-system-x86_64: -net user,id=3Dn1: 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. While we're at it, also deprecate the old syntax for the hostfwd_add and hostfwd_remove commands that still work with this legacy "hub" plus "name" tuple. It is enough to specify the netdev id there instead. Also add a missing dependency to the Makefile to make sure that the docs get correctly regenerated when qemu-deprecated.texi is changed. Signed-off-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- Makefile | 2 +- net/net.c | 4 ++++ net/slirp.c | 2 ++ qemu-deprecated.texi | 13 +++++++++++++ 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index fe623e4..f42e176 100644 --- a/Makefile +++ b/Makefile @@ -978,7 +978,7 @@ txt: qemu-doc.txt docs/interop/qemu-qmp-ref.txt docs/in= terop/qemu-ga-ref.txt =20 qemu-doc.html qemu-doc.info qemu-doc.pdf qemu-doc.txt: \ qemu-img.texi qemu-nbd.texi qemu-options.texi qemu-option-trace.texi \ - qemu-monitor.texi qemu-img-cmds.texi qemu-ga.texi \ + qemu-deprecated.texi qemu-monitor.texi qemu-img-cmds.texi qemu-ga.texi \ qemu-monitor-info.texi docs/qemu-block-drivers.texi \ docs/qemu-cpu-models.texi =20 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 i= s_netdev, Error **errp) /* missing optional values have been initialized to "all bits zero= " */ name =3D net->has_id ? net->id : net->name; =20 + if (net->has_name) { + warn_report("The 'name' parameter is deprecated, use 'id' inst= ead"); + } + /* Map the old options to the new flat type */ switch (opts->type) { case NET_LEGACY_OPTIONS_TYPE_NONE: diff --git a/net/slirp.c b/net/slirp.c index c18060f..073bc69 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -404,6 +404,8 @@ static SlirpState *slirp_lookup(Monitor *mon, const cha= r *hub_id, monitor_printf(mon, "unrecognized (hub-id, stackname) pair= \n"); return NULL; } + warn_report("Using 'hub-id' is deprecated. Specify the netdev = id " + "directly instead"); } else { nc =3D qemu_find_netdev(name); if (!nc) { diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi index 8a2e399..eed7132 100644 --- a/qemu-deprecated.texi +++ b/qemu-deprecated.texi @@ -83,6 +83,11 @@ The 'file' driver for drives is no longer appropriate fo= r 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. =20 +@subsection -net ...,name=3D@var{name} (since 3.1) + +The @option{name} parameter of the @option{-net} option is an old synonym +for the @option{id} parameter which should now be used instead. + @section QEMU Machine Protocol (QMP) commands =20 @subsection block-dirty-bitmap-add "autoload" parameter (since 2.12.0) @@ -99,6 +104,14 @@ The ``query-cpus'' command is replaced by the ``query-c= pus-fast'' command. The ``arch'' output member of the ``query-cpus-fast'' command is replaced by the ``target'' output member. =20 +@section System emulator human monitor commands + +@subsection The hub_id parameter of 'hostfwd_add' / 'hostfwd_remove' (sinc= e 3.1) + +The @option{hub_id} parameter of the 'hostfwd_add' and 'hostfwd_remove' HMP +commands is redundant. It is enough to specify the netdev ID of the backend +that should be changed. + @section System emulator devices =20 @subsection ivshmem (since 2.6.0) --=20 1.8.3.1