From patchwork Thu Sep 20 08:50:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 10607145 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2227014BD for ; Thu, 20 Sep 2018 08:51:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1314F2D128 for ; Thu, 20 Sep 2018 08:51:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0771D2D135; Thu, 20 Sep 2018 08:51:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A92CD2D128 for ; Thu, 20 Sep 2018 08:51:50 +0000 (UTC) Received: from localhost ([::1]:48946 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g2ugf-00013L-Ru for patchwork-qemu-devel@patchwork.kernel.org; Thu, 20 Sep 2018 04:51:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56632) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g2ufQ-0000A7-Ao for qemu-devel@nongnu.org; Thu, 20 Sep 2018 04:50:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g2ufO-0004MU-HW for qemu-devel@nongnu.org; Thu, 20 Sep 2018 04:50:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48248) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g2ufO-0004Ly-8u for qemu-devel@nongnu.org; Thu, 20 Sep 2018 04:50:30 -0400 Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9943D19D223; Thu, 20 Sep 2018 08:50:29 +0000 (UTC) Received: from thuth.com (ovpn-116-107.ams2.redhat.com [10.36.116.107]) by smtp.corp.redhat.com (Postfix) with ESMTP id 33CCB3091330; Thu, 20 Sep 2018 08:50:28 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org Date: Thu, 20 Sep 2018 10:50:14 +0200 Message-Id: <1537433416-4262-3-git-send-email-thuth@redhat.com> In-Reply-To: <1537433416-4262-1-git-send-email-thuth@redhat.com> References: <1537433416-4262-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 20 Sep 2018 08:50:29 +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] [PATCH v2 2/4] net: Deprecate the "name" parameter of -net 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 , Jason Wang , Markus Armbruster , Peter Xu Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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. Signed-off-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Markus Armbruster --- net/net.c | 4 ++++ qemu-deprecated.texi | 5 +++++ 2 files changed, 9 insertions(+) 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: diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi index 8a2e399..60fd7f7 100644 --- a/qemu-deprecated.texi +++ b/qemu-deprecated.texi @@ -83,6 +83,11 @@ 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. + @section QEMU Machine Protocol (QMP) commands @subsection block-dirty-bitmap-add "autoload" parameter (since 2.12.0)