From nobody Wed Apr 16 07:39:13 2025 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499448285242471.63749963646296; Fri, 7 Jul 2017 10:24:45 -0700 (PDT) Received: from localhost ([::1]:57770 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dTWzi-0001hG-N2 for importer@patchew.org; Fri, 07 Jul 2017 13:24:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41594) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dTWl8-0004wF-Fq for qemu-devel@nongnu.org; Fri, 07 Jul 2017 13:09:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dTWl7-0007qb-DC for qemu-devel@nongnu.org; Fri, 07 Jul 2017 13:09:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39934) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dTWl3-0007l1-39; Fri, 07 Jul 2017 13:09:33 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 256B461D2D; Fri, 7 Jul 2017 17:09:32 +0000 (UTC) Received: from noname.redhat.com (ovpn-117-34.ams2.redhat.com [10.36.117.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3107E61F23; Fri, 7 Jul 2017 17:09:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 256B461D2D Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=kwolf@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 256B461D2D From: Kevin Wolf To: qemu-block@nongnu.org Date: Fri, 7 Jul 2017 19:07:34 +0200 Message-Id: <1499447335-6125-20-git-send-email-kwolf@redhat.com> In-Reply-To: <1499447335-6125-1-git-send-email-kwolf@redhat.com> References: <1499447335-6125-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 07 Jul 2017 17:09:32 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 019/100] blockdev: Print a warning for legacy drive options that belong to -device 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: kwolf@redhat.com, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Thomas Huth We likely do not want to carry these legacy -drive options along forever. Let's emit a deprecation warning for the -drive options that have a replacement with the -device option, so that the (hopefully few) remaining users are aware of this and can adapt their scripts / behaviour accordingly. Signed-off-by: Thomas Huth Reviewed-by: Markus Armbruster Signed-off-by: Kevin Wolf --- blockdev.c | 14 ++++++++++++++ qemu-options.hx | 9 +++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/blockdev.c b/blockdev.c index f92dcf2..e2016b6 100644 --- a/blockdev.c +++ b/blockdev.c @@ -50,6 +50,7 @@ #include "qmp-commands.h" #include "block/trace.h" #include "sysemu/arch_init.h" +#include "sysemu/qtest.h" #include "qemu/cutils.h" #include "qemu/help_option.h" #include "qemu/throttle-options.h" @@ -798,6 +799,9 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterface= Type block_default_type) const char *filename; Error *local_err =3D NULL; int i; + const char *deprecated[] =3D { + "serial", "trans", "secs", "heads", "cyls", "addr" + }; =20 /* Change legacy command line options into QMP ones */ static const struct { @@ -881,6 +885,16 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfac= eType block_default_type) "update your scripts.\n"); } =20 + /* Other deprecated options */ + if (!qtest_enabled()) { + for (i =3D 0; i < ARRAY_SIZE(deprecated); i++) { + if (qemu_opt_get(legacy_opts, deprecated[i]) !=3D NULL) { + error_report("'%s' is deprecated, please use the correspon= ding " + "option of '-device' instead", deprecated[i]); + } + } + } + /* Media type */ value =3D qemu_opt_get(legacy_opts, "media"); if (value) { diff --git a/qemu-options.hx b/qemu-options.hx index 297bd8a..ddab656 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -818,6 +818,8 @@ of available connectors of a given interface type. This option defines the type of the media: disk or cdrom. @item cyls=3D@var{c},heads=3D@var{h},secs=3D@var{s}[,trans=3D@var{t}] These options have the same definition as they have in @option{-hdachs}. +These parameters are deprecated, use the corresponding parameters +of @code{-device} instead. @item snapshot=3D@var{snapshot} @var{snapshot} is "on" or "off" and controls snapshot mode for the given d= rive (see @option{-snapshot}). @@ -852,9 +854,12 @@ Specify which disk @var{format} will be used rather th= an detecting the format. Can be used to specify format=3Draw to avoid interpreting an untrusted format header. @item serial=3D@var{serial} -This option specifies the serial number to assign to the device. +This option specifies the serial number to assign to the device. This +parameter is deprecated, use the corresponding parameter of @code{-device} +instead. @item addr=3D@var{addr} -Specify the controller's PCI address (if=3Dvirtio only). +Specify the controller's PCI address (if=3Dvirtio only). This parameter is +deprecated, use the corresponding parameter of @code{-device} instead. @item werror=3D@var{action},rerror=3D@var{action} Specify which @var{action} to take on write and read errors. Valid actions= are: "ignore" (ignore the error and try to continue), "stop" (pause QEMU), --=20 1.8.3.1