From nobody Sat Feb 7 04:12:57 2026 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 153570591364645.90595280330581; Fri, 31 Aug 2018 01:58:33 -0700 (PDT) Received: from localhost ([::1]:52569 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fvfG7-0006af-9j for importer@patchew.org; Fri, 31 Aug 2018 04:58:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39612) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fvf3l-0001A2-ND for qemu-devel@nongnu.org; Fri, 31 Aug 2018 04:45:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fvexR-0007Ho-E9 for qemu-devel@nongnu.org; Fri, 31 Aug 2018 04:39:10 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:38292 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fvexR-0007H4-77 for qemu-devel@nongnu.org; Fri, 31 Aug 2018 04:39:09 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AE2F840241CF; Fri, 31 Aug 2018 08:39:08 +0000 (UTC) Received: from thuth.com (ovpn-116-29.ams2.redhat.com [10.36.116.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 09FF710CD791; Fri, 31 Aug 2018 08:39:06 +0000 (UTC) From: Thomas Huth To: Peter Maydell , qemu-devel@nongnu.org Date: Fri, 31 Aug 2018 10:38:50 +0200 Message-Id: <1535704738-8986-2-git-send-email-thuth@redhat.com> In-Reply-To: <1535704738-8986-1-git-send-email-thuth@redhat.com> References: <1535704738-8986-1-git-send-email-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Fri, 31 Aug 2018 08:39:08 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Fri, 31 Aug 2018 08:39:08 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'thuth@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 1/9] Remove the deprecated -balloon option 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: Laurent Vivier , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The "-balloon" option has been replaced by "-device virtio-balloon". It's been marked as deprecated since two releases, and nobody complained, so let's remove it now. Acked-by: Paolo Bonzini Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Cornelia Huck Reviewed-by: Michael S. Tsirkin Reviewed-by: David Hildenbrand Acked-by: Peter Krempa Acked-by: J=C3=A1n Tomko Signed-off-by: Thomas Huth --- docs/virtio-balloon-stats.txt | 6 +++--- qemu-deprecated.texi | 5 ----- qemu-options.hx | 10 ---------- vl.c | 36 ------------------------------------ 4 files changed, 3 insertions(+), 54 deletions(-) diff --git a/docs/virtio-balloon-stats.txt b/docs/virtio-balloon-stats.txt index 9985e1d..1732cc8 100644 --- a/docs/virtio-balloon-stats.txt +++ b/docs/virtio-balloon-stats.txt @@ -61,9 +61,9 @@ It's also important to note the following: respond to the request the timer will never be re-armed, which has the same effect as disabling polling =20 -Here are a few examples. QEMU is started with '-balloon virtio', which -generates '/machine/peripheral-anon/device[1]' as the QOM path for the -balloon device. +Here are a few examples. QEMU is started with '-device virtio-balloon', +which generates '/machine/peripheral-anon/device[1]' as the QOM path for +the balloon device. =20 Enable polling with 2 seconds interval: =20 diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi index 1b9c007..98f5062 100644 --- a/qemu-deprecated.texi +++ b/qemu-deprecated.texi @@ -86,11 +86,6 @@ enabled via the ``-machine usb=3Don'' argument. =20 The ``-nodefconfig`` argument is a synonym for ``-no-user-config``. =20 -@subsection -balloon (since 2.12.0) - -The @option{--balloon virtio} argument has been superseded by -@option{--device virtio-balloon}. - @subsection -fsdev handle (since 2.12.0) =20 The ``handle'' fsdev backend does not support symlinks and causes the 9p diff --git a/qemu-options.hx b/qemu-options.hx index 654ef48..ccf7155 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -454,16 +454,6 @@ modprobe i810_audio clocking=3D48000 @end example ETEXI =20 -DEF("balloon", HAS_ARG, QEMU_OPTION_balloon, - "-balloon virtio[,addr=3Dstr]\n" - " enable virtio balloon device (deprecated)\n", QEMU_AR= CH_ALL) -STEXI -@item -balloon virtio[,addr=3D@var{addr}] -@findex -balloon -Enable virtio balloon device, optionally with PCI address @var{addr}. This -option is deprecated, use @option{-device virtio-balloon} instead. -ETEXI - DEF("device", HAS_ARG, QEMU_OPTION_device, "-device driver[,prop[=3Dvalue][,...]]\n" " add device (based on driver)\n" diff --git a/vl.c b/vl.c index 5ba06ad..674c42f 100644 --- a/vl.c +++ b/vl.c @@ -2127,36 +2127,6 @@ static void parse_display(const char *p) } } =20 -static int balloon_parse(const char *arg) -{ - QemuOpts *opts; - - warn_report("This option is deprecated. " - "Use '--device virtio-balloon' to enable the balloon devic= e."); - - if (strcmp(arg, "none") =3D=3D 0) { - return 0; - } - - if (!strncmp(arg, "virtio", 6)) { - if (arg[6] =3D=3D ',') { - /* have params -> parse them */ - opts =3D qemu_opts_parse_noisily(qemu_find_opts("device"), arg= + 7, - false); - if (!opts) - return -1; - } else { - /* create empty opts */ - opts =3D qemu_opts_create(qemu_find_opts("device"), NULL, 0, - &error_abort); - } - qemu_opt_set(opts, "driver", "virtio-balloon", &error_abort); - return 0; - } - - return -1; -} - char *qemu_find_file(int type, const char *name) { int i; @@ -3660,12 +3630,6 @@ int main(int argc, char **argv, char **envp) case QEMU_OPTION_no_hpet: no_hpet =3D 1; break; - case QEMU_OPTION_balloon: - if (balloon_parse(optarg) < 0) { - error_report("unknown -balloon argument %s", optarg); - exit(1); - } - break; case QEMU_OPTION_no_reboot: no_reboot =3D 1; break; --=20 1.8.3.1 From nobody Sat Feb 7 04:12:57 2026 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1535705715020206.0685185474589; Fri, 31 Aug 2018 01:55:15 -0700 (PDT) Received: from localhost ([::1]:52543 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fvfCz-0002gM-Mt for importer@patchew.org; Fri, 31 Aug 2018 04:55:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39612) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fvf3j-0001A2-PO for qemu-devel@nongnu.org; Fri, 31 Aug 2018 04:45:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fvexT-0007JE-9E for qemu-devel@nongnu.org; Fri, 31 Aug 2018 04:39:12 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:51984 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fvexT-0007J6-3z for qemu-devel@nongnu.org; Fri, 31 Aug 2018 04:39:11 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A80C45BCD8; Fri, 31 Aug 2018 08:39:10 +0000 (UTC) Received: from thuth.com (ovpn-116-29.ams2.redhat.com [10.36.116.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 15AD010F1BFB; Fri, 31 Aug 2018 08:39:08 +0000 (UTC) From: Thomas Huth To: Peter Maydell , qemu-devel@nongnu.org Date: Fri, 31 Aug 2018 10:38:51 +0200 Message-Id: <1535704738-8986-3-git-send-email-thuth@redhat.com> In-Reply-To: <1535704738-8986-1-git-send-email-thuth@redhat.com> References: <1535704738-8986-1-git-send-email-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Fri, 31 Aug 2018 08:39:10 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Fri, 31 Aug 2018 08:39:10 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'thuth@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 2/9] Remove the deprecated -nodefconfig option 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: Laurent Vivier , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" It's the same as -no-user-config and marked as deprecated since three releases already. Time to remove it now. Acked-by: Peter Krempa Acked-by: J=C3=A1n Tomko Signed-off-by: Thomas Huth --- docs/interop/live-block-operations.rst | 4 ++-- qemu-deprecated.texi | 4 ---- qemu-options.hx | 4 ++-- vl.c | 2 -- 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/docs/interop/live-block-operations.rst b/docs/interop/live-blo= ck-operations.rst index 734252b..48afdc7 100644 --- a/docs/interop/live-block-operations.rst +++ b/docs/interop/live-block-operations.rst @@ -129,7 +129,7 @@ To show some example invocations of command-line, we wi= ll use the following invocation of QEMU, with a QMP server running over UNIX socket:: =20 - $ ./x86_64-softmmu/qemu-system-x86_64 -display none -nodefconfig \ + $ ./x86_64-softmmu/qemu-system-x86_64 -display none -no-user-config \ -M q35 -nodefaults -m 512 \ -blockdev node-name=3Dnode-A,driver=3Dqcow2,file.driver=3Dfile,fil= e.node-name=3Dfile,file.filename=3D./a.qcow2 \ -device virtio-blk,drive=3Dnode-A,id=3Dvirtio0 \ @@ -694,7 +694,7 @@ instance, with the following invocation. (As noted ear= lier, for simplicity's sake, the destination QEMU is started on the same host, but it could be located elsewhere):: =20 - $ ./x86_64-softmmu/qemu-system-x86_64 -display none -nodefconfig \ + $ ./x86_64-softmmu/qemu-system-x86_64 -display none -no-user-config \ -M q35 -nodefaults -m 512 \ -blockdev node-name=3Dnode-TargetDisk,driver=3Dqcow2,file.driver= =3Dfile,file.node-name=3Dfile,file.filename=3D./target-disk.qcow2 \ -device virtio-blk,drive=3Dnode-TargetDisk,id=3Dvirtio0 \ diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi index 98f5062..19c8ae2 100644 --- a/qemu-deprecated.texi +++ b/qemu-deprecated.texi @@ -82,10 +82,6 @@ would automatically enable USB support on the machine ty= pe. If using the new syntax, USB support must be explicitly enabled via the ``-machine usb=3Don'' argument. =20 -@subsection -nodefconfig (since 2.11.0) - -The ``-nodefconfig`` argument is a synonym for ``-no-user-config``. - @subsection -fsdev handle (since 2.12.0) =20 The ``handle'' fsdev backend does not support symlinks and causes the 9p diff --git a/qemu-options.hx b/qemu-options.hx index ccf7155..d9be20b 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -3833,8 +3833,7 @@ Write device configuration to @var{file}. The @var{fi= le} can be either filename command line and device configuration into file or dash @code{-}) characte= r to print the output to stdout. This can be later used as input file for @code{-readconf= ig} option. ETEXI -HXCOMM Deprecated, same as -no-user-config -DEF("nodefconfig", 0, QEMU_OPTION_nodefconfig, "", QEMU_ARCH_ALL) + DEF("no-user-config", 0, QEMU_OPTION_nouserconfig, "-no-user-config\n" " do not load default user-provided config files at sta= rtup\n", @@ -3845,6 +3844,7 @@ STEXI The @code{-no-user-config} option makes QEMU not load any of the user-prov= ided config files on @var{sysconfdir}. ETEXI + DEF("trace", HAS_ARG, QEMU_OPTION_trace, "-trace [[enable=3D]][,events=3D][,file=3D]\n" " specify tracing options\n", diff --git a/vl.c b/vl.c index 674c42f..386c71d 100644 --- a/vl.c +++ b/vl.c @@ -2999,7 +2999,6 @@ int main(int argc, char **argv, char **envp) =20 popt =3D lookup_opt(argc, argv, &optarg, &optind); switch (popt->index) { - case QEMU_OPTION_nodefconfig: case QEMU_OPTION_nouserconfig: userconfig =3D false; break; @@ -3927,7 +3926,6 @@ int main(int argc, char **argv, char **envp) case QEMU_OPTION_enable_sync_profile: qsp_enable(); break; - case QEMU_OPTION_nodefconfig: case QEMU_OPTION_nouserconfig: /* Nothing to be parsed here. Especially, do not error out= below. */ break; --=20 1.8.3.1 From nobody Sat Feb 7 04:12:57 2026 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1535705504385806.9728145961069; Fri, 31 Aug 2018 01:51:44 -0700 (PDT) Received: from localhost ([::1]:52513 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fvf9b-0006ag-6C for importer@patchew.org; Fri, 31 Aug 2018 04:51:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39315) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fvf3j-0000r7-OL for qemu-devel@nongnu.org; Fri, 31 Aug 2018 04:45:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fvexU-0007Je-Ly for qemu-devel@nongnu.org; Fri, 31 Aug 2018 04:39:13 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:39782 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fvexU-0007JV-GF for qemu-devel@nongnu.org; Fri, 31 Aug 2018 04:39:12 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2EAAD804B4DB; Fri, 31 Aug 2018 08:39:12 +0000 (UTC) Received: from thuth.com (ovpn-116-29.ams2.redhat.com [10.36.116.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 087AC10D18E0; Fri, 31 Aug 2018 08:39:10 +0000 (UTC) From: Thomas Huth To: Peter Maydell , qemu-devel@nongnu.org Date: Fri, 31 Aug 2018 10:38:52 +0200 Message-Id: <1535704738-8986-4-git-send-email-thuth@redhat.com> In-Reply-To: <1535704738-8986-1-git-send-email-thuth@redhat.com> References: <1535704738-8986-1-git-send-email-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 31 Aug 2018 08:39:12 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 31 Aug 2018 08:39:12 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'thuth@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 3/9] Remove the deprecated options -startdate, -localtime and -rtc-td-hack 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: Laurent Vivier , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Deprecated since two releases, nobody complained, thus it's time to remove them now. Acked-by: Peter Krempa Acked-by: J=C3=A1n Tomko Signed-off-by: Thomas Huth --- qemu-deprecated.texi | 13 --------- qemu-options.hx | 7 ----- vl.c | 76 +++++++++++++++---------------------------------= ---- 3 files changed, 22 insertions(+), 74 deletions(-) diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi index 19c8ae2..ca52e83 100644 --- a/qemu-deprecated.texi +++ b/qemu-deprecated.texi @@ -96,19 +96,6 @@ The @code{--no-frame} argument works with SDL 1.2 only. = The other user interfaces never implemented this in the first place. So this will be removed together with SDL 1.2 support. =20 -@subsection -rtc-td-hack (since 2.12.0) - -The @code{-rtc-td-hack} option has been replaced by -@code{-rtc driftfix=3Dslew}. - -@subsection -localtime (since 2.12.0) - -The @code{-localtime} option has been replaced by @code{-rtc base=3Dlocalt= ime}. - -@subsection -startdate (since 2.12.0) - -The @code{-startdate} option has been replaced by @code{-rtc base=3D@var{d= ate}}. - @subsection -virtioconsole (since 3.0.0) =20 Option @option{-virtioconsole} has been replaced by diff --git a/qemu-options.hx b/qemu-options.hx index d9be20b..7ca539a 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -1711,9 +1711,6 @@ Windows 2000 is installed, you no longer need this op= tion (this option slows down the IDE transfers). ETEXI =20 -HXCOMM Deprecated by -rtc -DEF("rtc-td-hack", 0, QEMU_OPTION_rtc_td_hack, "", QEMU_ARCH_I386) - DEF("no-fd-bootchk", 0, QEMU_OPTION_no_fd_bootchk, "-no-fd-bootchk disable boot signature checking for floppy disks\n", QEMU_ARCH_I386) @@ -3471,10 +3468,6 @@ ETEXI HXCOMM Silently ignored for compatibility DEF("clock", HAS_ARG, QEMU_OPTION_clock, "", QEMU_ARCH_ALL) =20 -HXCOMM Options deprecated by -rtc -DEF("localtime", 0, QEMU_OPTION_localtime, "", QEMU_ARCH_ALL) -DEF("startdate", HAS_ARG, QEMU_OPTION_startdate, "", QEMU_ARCH_ALL) - DEF("rtc", HAS_ARG, QEMU_OPTION_rtc, \ "-rtc [base=3Dutc|localtime|date][,clock=3Dhost|rt|vm][,driftfix=3Dnon= e|slew]\n" \ " set the RTC base and clock, enable drift fix for cloc= k ticks (x86 only)\n", diff --git a/vl.c b/vl.c index 386c71d..cfeee0d 100644 --- a/vl.c +++ b/vl.c @@ -823,44 +823,33 @@ int qemu_timedate_diff(struct tm *tm) return seconds - qemu_time(); } =20 -static void configure_rtc_date_offset(const char *startdate, int legacy) +static void configure_rtc_date_offset(const char *startdate) { time_t rtc_start_date; struct tm tm; =20 - if (!strcmp(startdate, "now") && legacy) { - rtc_date_offset =3D -1; + if (sscanf(startdate, "%d-%d-%dT%d:%d:%d", &tm.tm_year, &tm.tm_mon, + &tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec) =3D=3D 6)= { + /* OK */ + } else if (sscanf(startdate, "%d-%d-%d", + &tm.tm_year, &tm.tm_mon, &tm.tm_mday) =3D=3D 3) { + tm.tm_hour =3D 0; + tm.tm_min =3D 0; + tm.tm_sec =3D 0; } else { - if (sscanf(startdate, "%d-%d-%dT%d:%d:%d", - &tm.tm_year, - &tm.tm_mon, - &tm.tm_mday, - &tm.tm_hour, - &tm.tm_min, - &tm.tm_sec) =3D=3D 6) { - /* OK */ - } else if (sscanf(startdate, "%d-%d-%d", - &tm.tm_year, - &tm.tm_mon, - &tm.tm_mday) =3D=3D 3) { - tm.tm_hour =3D 0; - tm.tm_min =3D 0; - tm.tm_sec =3D 0; - } else { - goto date_fail; - } - tm.tm_year -=3D 1900; - tm.tm_mon--; - rtc_start_date =3D mktimegm(&tm); - if (rtc_start_date =3D=3D -1) { - date_fail: - error_report("invalid date format"); - error_printf("valid formats: " - "'2006-06-17T16:01:21' or '2006-06-17'\n"); - exit(1); - } - rtc_date_offset =3D qemu_time() - rtc_start_date; + goto date_fail; + } + tm.tm_year -=3D 1900; + tm.tm_mon--; + rtc_start_date =3D mktimegm(&tm); + if (rtc_start_date =3D=3D -1) { + date_fail: + error_report("invalid date format"); + error_printf("valid formats: " + "'2006-06-17T16:01:21' or '2006-06-17'\n"); + exit(1); } + rtc_date_offset =3D qemu_time() - rtc_start_date; } =20 static void configure_rtc(QemuOpts *opts) @@ -878,7 +867,7 @@ static void configure_rtc(QemuOpts *opts) "-rtc base=3Dlocaltime"); replay_add_blocker(blocker); } else { - configure_rtc_date_offset(value, 0); + configure_rtc_date_offset(value); } } value =3D qemu_opt_get(opts, "clock"); @@ -3269,11 +3258,6 @@ int main(int argc, char **argv, char **envp) case QEMU_OPTION_k: keyboard_layout =3D optarg; break; - case QEMU_OPTION_localtime: - rtc_utc =3D 0; - warn_report("This option is deprecated, " - "use '-rtc base=3Dlocaltime' instead."); - break; case QEMU_OPTION_vga: vga_model =3D optarg; default_vga =3D 0; @@ -3526,18 +3510,6 @@ int main(int argc, char **argv, char **envp) case QEMU_OPTION_win2k_hack: win2k_install_hack =3D 1; break; - case QEMU_OPTION_rtc_td_hack: { - static GlobalProperty slew_lost_ticks =3D { - .driver =3D "mc146818rtc", - .property =3D "lost_tick_policy", - .value =3D "slew", - }; - - qdev_prop_register_global(&slew_lost_ticks); - warn_report("This option is deprecated, " - "use '-rtc driftfix=3Dslew' instead."); - break; - } case QEMU_OPTION_acpitable: opts =3D qemu_opts_parse_noisily(qemu_find_opts("acpi"), optarg, true); @@ -3723,10 +3695,6 @@ int main(int argc, char **argv, char **envp) */ warn_report("This option is ignored and will be removed so= on"); break; - case QEMU_OPTION_startdate: - warn_report("This option is deprecated, use '-rtc base=3D'= instead."); - configure_rtc_date_offset(optarg, 1); - break; case QEMU_OPTION_rtc: opts =3D qemu_opts_parse_noisily(qemu_find_opts("rtc"), op= targ, false); --=20 1.8.3.1 From nobody Sat Feb 7 04:12:57 2026 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1535705835120663.2010848968223; Fri, 31 Aug 2018 01:57:15 -0700 (PDT) Received: from localhost ([::1]:52559 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fvfEv-0003ya-OG for importer@patchew.org; Fri, 31 Aug 2018 04:57:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39558) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fvf3j-00017Y-NF for qemu-devel@nongnu.org; Fri, 31 Aug 2018 04:45:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fvexW-0007KM-Ei for qemu-devel@nongnu.org; Fri, 31 Aug 2018 04:39:15 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:38298 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fvexW-0007KI-8I for qemu-devel@nongnu.org; Fri, 31 Aug 2018 04:39:14 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E3D3040241DA; Fri, 31 Aug 2018 08:39:13 +0000 (UTC) Received: from thuth.com (ovpn-116-29.ams2.redhat.com [10.36.116.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6C70510D178A; Fri, 31 Aug 2018 08:39:12 +0000 (UTC) From: Thomas Huth To: Peter Maydell , qemu-devel@nongnu.org Date: Fri, 31 Aug 2018 10:38:53 +0200 Message-Id: <1535704738-8986-5-git-send-email-thuth@redhat.com> In-Reply-To: <1535704738-8986-1-git-send-email-thuth@redhat.com> References: <1535704738-8986-1-git-send-email-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Fri, 31 Aug 2018 08:39:13 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Fri, 31 Aug 2018 08:39:13 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'thuth@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 4/9] net: Remove the deprecated -tftp, -bootp, -redir and -smb options 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: Laurent Vivier , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" These options likely do not work as expected as soon as the user tries to use more than one network interface at once. The parameters have been marked as deprecated since QEMU v2.6, so users had plenty of time to move their scripts to the new syntax. Time to remove the old parameters now. Reviewed-by: Samuel Thibault Acked-by: Peter Krempa Acked-by: J=C3=A1n Tomko Signed-off-by: Thomas Huth --- include/net/net.h | 3 -- include/net/slirp.h | 4 -- net/slirp.c | 132 +++++++++++------------------------------------= ---- os-posix.c | 8 ---- qemu-deprecated.texi | 34 ------------- qemu-options.hx | 15 ------ vl.c | 18 ------- 7 files changed, 29 insertions(+), 185 deletions(-) diff --git a/include/net/net.h b/include/net/net.h index 1425960..7936d53 100644 --- a/include/net/net.h +++ b/include/net/net.h @@ -201,9 +201,6 @@ extern NICInfo nd_table[MAX_NICS]; extern const char *host_net_devices[]; =20 /* from net.c */ -extern const char *legacy_tftp_prefix; -extern const char *legacy_bootp_filename; - int net_client_parse(QemuOptsList *opts_list, const char *str); int net_init_clients(Error **errp); void net_check_clients(void); diff --git a/include/net/slirp.h b/include/net/slirp.h index 4d63d74..bad3e1e 100644 --- a/include/net/slirp.h +++ b/include/net/slirp.h @@ -30,10 +30,6 @@ void hmp_hostfwd_add(Monitor *mon, const QDict *qdict); void hmp_hostfwd_remove(Monitor *mon, const QDict *qdict); =20 -int net_slirp_redir(const char *redir_str); - -int net_slirp_smb(const char *exported_dir); - void hmp_info_usernet(Monitor *mon, const QDict *qdict); =20 #endif diff --git a/net/slirp.c b/net/slirp.c index 1e14318..c18060f 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -67,13 +67,11 @@ static int get_str_sep(char *buf, int buf_size, const c= har **pp, int sep) /* slirp network adapter */ =20 #define SLIRP_CFG_HOSTFWD 1 -#define SLIRP_CFG_LEGACY 2 =20 struct slirp_config_str { struct slirp_config_str *next; int flags; char str[1024]; - int legacy_format; }; =20 typedef struct SlirpState { @@ -87,19 +85,13 @@ typedef struct SlirpState { } SlirpState; =20 static struct slirp_config_str *slirp_configs; -const char *legacy_tftp_prefix; -const char *legacy_bootp_filename; static QTAILQ_HEAD(slirp_stacks, SlirpState) slirp_stacks =3D QTAILQ_HEAD_INITIALIZER(slirp_stacks); =20 -static int slirp_hostfwd(SlirpState *s, const char *redir_str, - int legacy_format, Error **errp); -static int slirp_guestfwd(SlirpState *s, const char *config_str, - int legacy_format, Error **errp); +static int slirp_hostfwd(SlirpState *s, const char *redir_str, Error **err= p); +static int slirp_guestfwd(SlirpState *s, const char *config_str, Error **e= rrp); =20 #ifndef _WIN32 -static const char *legacy_smb_export; - static int slirp_smb(SlirpState *s, const char *exported_dir, struct in_addr vserver_addr, Error **errp); static void slirp_smb_cleanup(SlirpState *s); @@ -196,13 +188,6 @@ static int net_slirp_init(NetClientState *peer, const = char *model, return -1; } =20 - if (!tftp_export) { - tftp_export =3D legacy_tftp_prefix; - } - if (!bootfile) { - bootfile =3D legacy_bootp_filename; - } - if (vnetwork) { if (get_str_sep(buf, sizeof(buf), &vnetwork, '/') < 0) { if (!inet_aton(vnetwork, &net)) { @@ -382,21 +367,16 @@ static int net_slirp_init(NetClientState *peer, const= char *model, =20 for (config =3D slirp_configs; config; config =3D config->next) { if (config->flags & SLIRP_CFG_HOSTFWD) { - if (slirp_hostfwd(s, config->str, - config->flags & SLIRP_CFG_LEGACY, errp) < 0)= { + if (slirp_hostfwd(s, config->str, errp) < 0) { goto error; } } else { - if (slirp_guestfwd(s, config->str, - config->flags & SLIRP_CFG_LEGACY, errp) < 0= ) { + if (slirp_guestfwd(s, config->str, errp) < 0) { goto error; } } } #ifndef _WIN32 - if (!smb_export) { - smb_export =3D legacy_smb_export; - } if (smb_export) { if (slirp_smb(s, smb_export, smbsrv, errp) < 0) { goto error; @@ -506,8 +486,7 @@ void hmp_hostfwd_remove(Monitor *mon, const QDict *qdic= t) monitor_printf(mon, "invalid format\n"); } =20 -static int slirp_hostfwd(SlirpState *s, const char *redir_str, - int legacy_format, Error **errp) +static int slirp_hostfwd(SlirpState *s, const char *redir_str, Error **err= p) { struct in_addr host_addr =3D { .s_addr =3D INADDR_ANY }; struct in_addr guest_addr =3D { .s_addr =3D 0 }; @@ -532,18 +511,16 @@ static int slirp_hostfwd(SlirpState *s, const char *r= edir_str, goto fail_syntax; } =20 - if (!legacy_format) { - if (get_str_sep(buf, sizeof(buf), &p, ':') < 0) { - fail_reason =3D "Missing : separator"; - goto fail_syntax; - } - if (buf[0] !=3D '\0' && !inet_aton(buf, &host_addr)) { - fail_reason =3D "Bad host address"; - goto fail_syntax; - } + if (get_str_sep(buf, sizeof(buf), &p, ':') < 0) { + fail_reason =3D "Missing : separator"; + goto fail_syntax; + } + if (buf[0] !=3D '\0' && !inet_aton(buf, &host_addr)) { + fail_reason =3D "Bad host address"; + goto fail_syntax; } =20 - if (get_str_sep(buf, sizeof(buf), &p, legacy_format ? ':' : '-') < 0) { + if (get_str_sep(buf, sizeof(buf), &p, '-') < 0) { fail_reason =3D "Bad host port separator"; goto fail_syntax; } @@ -602,35 +579,13 @@ void hmp_hostfwd_add(Monitor *mon, const QDict *qdict) } if (s) { Error *err =3D NULL; - if (slirp_hostfwd(s, redir_str, 0, &err) < 0) { + if (slirp_hostfwd(s, redir_str, &err) < 0) { error_report_err(err); } } =20 } =20 -int net_slirp_redir(const char *redir_str) -{ - struct slirp_config_str *config; - Error *err =3D NULL; - int res; - - if (QTAILQ_EMPTY(&slirp_stacks)) { - config =3D g_malloc(sizeof(*config)); - pstrcpy(config->str, sizeof(config->str), redir_str); - config->flags =3D SLIRP_CFG_HOSTFWD | SLIRP_CFG_LEGACY; - config->next =3D slirp_configs; - slirp_configs =3D config; - return 0; - } - - res =3D slirp_hostfwd(QTAILQ_FIRST(&slirp_stacks), redir_str, 1, &err); - if (res < 0) { - error_report_err(err); - } - return res; -} - #ifndef _WIN32 =20 /* automatic user mode samba server configuration */ @@ -746,28 +701,6 @@ static int slirp_smb(SlirpState* s, const char *export= ed_dir, return 0; } =20 -/* automatic user mode samba server configuration (legacy interface) */ -int net_slirp_smb(const char *exported_dir) -{ - struct in_addr vserver_addr =3D { .s_addr =3D 0 }; - - if (legacy_smb_export) { - fprintf(stderr, "-smb given twice\n"); - return -1; - } - legacy_smb_export =3D exported_dir; - if (!QTAILQ_EMPTY(&slirp_stacks)) { - Error *err =3D NULL; - int res =3D slirp_smb(QTAILQ_FIRST(&slirp_stacks), exported_dir, - vserver_addr, &err); - if (res < 0) { - error_report_err(err); - } - return res; - } - return 0; -} - #endif /* !defined(_WIN32) */ =20 struct GuestFwd { @@ -789,8 +722,7 @@ static void guestfwd_read(void *opaque, const uint8_t *= buf, int size) slirp_socket_recv(fwd->slirp, fwd->server, fwd->port, buf, size); } =20 -static int slirp_guestfwd(SlirpState *s, const char *config_str, - int legacy_format, Error **errp) +static int slirp_guestfwd(SlirpState *s, const char *config_str, Error **e= rrp) { struct in_addr server =3D { .s_addr =3D 0 }; struct GuestFwd *fwd; @@ -800,26 +732,20 @@ static int slirp_guestfwd(SlirpState *s, const char *= config_str, int port; =20 p =3D config_str; - if (legacy_format) { - if (get_str_sep(buf, sizeof(buf), &p, ':') < 0) { - goto fail_syntax; - } - } else { - if (get_str_sep(buf, sizeof(buf), &p, ':') < 0) { - goto fail_syntax; - } - if (strcmp(buf, "tcp") && buf[0] !=3D '\0') { - goto fail_syntax; - } - if (get_str_sep(buf, sizeof(buf), &p, ':') < 0) { - goto fail_syntax; - } - if (buf[0] !=3D '\0' && !inet_aton(buf, &server)) { - goto fail_syntax; - } - if (get_str_sep(buf, sizeof(buf), &p, '-') < 0) { - goto fail_syntax; - } + if (get_str_sep(buf, sizeof(buf), &p, ':') < 0) { + goto fail_syntax; + } + if (strcmp(buf, "tcp") && buf[0] !=3D '\0') { + goto fail_syntax; + } + if (get_str_sep(buf, sizeof(buf), &p, ':') < 0) { + goto fail_syntax; + } + if (buf[0] !=3D '\0' && !inet_aton(buf, &server)) { + goto fail_syntax; + } + if (get_str_sep(buf, sizeof(buf), &p, '-') < 0) { + goto fail_syntax; } port =3D strtol(buf, &end, 10); if (*end !=3D '\0' || port < 1 || port > 65535) { diff --git a/os-posix.c b/os-posix.c index 9ce6f74..8f39447 100644 --- a/os-posix.c +++ b/os-posix.c @@ -168,14 +168,6 @@ static bool os_parse_runas_uid_gid(const char *optarg) int os_parse_cmd_args(int index, const char *optarg) { switch (index) { -#ifdef CONFIG_SLIRP - case QEMU_OPTION_smb: - error_report("The -smb option is deprecated. " - "Please use '-netdev user,smb=3D...' instead."); - if (net_slirp_smb(optarg) < 0) - exit(1); - break; -#endif case QEMU_OPTION_runas: user_pwd =3D getpwnam(optarg); if (user_pwd) { diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi index ca52e83..8a2e399 100644 --- a/qemu-deprecated.texi +++ b/qemu-deprecated.texi @@ -40,40 +40,6 @@ which is the default. The ``-no-kvm'' argument is now a synonym for setting ``-machine accel=3Dtcg''. =20 -@subsection -tftp (since 2.6.0) - -The ``-tftp /some/dir'' argument is replaced by either -``-netdev user,id=3Dx,tftp=3D/some/dir '' (for pluggable NICs, accompanied -with ``-device ...,netdev=3Dx''), or ``-nic user,tftp=3D/some/dir'' -(for embedded NICs). The new syntax allows different settings to be -provided per NIC. - -@subsection -bootp (since 2.6.0) - -The ``-bootp /some/file'' argument is replaced by either -``-netdev user,id=3Dx,bootp=3D/some/file '' (for pluggable NICs, accompani= ed -with ``-device ...,netdev=3Dx''), or ``-nic user,bootp=3D/some/file'' -(for embedded NICs). The new syntax allows different settings to be -provided per NIC. - -@subsection -redir (since 2.6.0) - -The ``-redir [tcp|udp]:hostport:[guestaddr]:guestport'' argument is -replaced by either -``-netdev user,id=3Dx,hostfwd=3D[tcp|udp]:[hostaddr]:hostport-[guestaddr]:= guestport'' -(for pluggable NICs, accompanied with ``-device ...,netdev=3Dx'') or -``-nic user,hostfwd=3D[tcp|udp]:[hostaddr]:hostport-[guestaddr]:guestport'' -(for embedded NICs). The new syntax allows different settings to be -provided per NIC. - -@subsection -smb (since 2.6.0) - -The ``-smb /some/dir'' argument is replaced by either -``-netdev user,id=3Dx,smb=3D/some/dir '' (for pluggable NICs, accompanied -with ``-device ...,netdev=3Dx''), or ``-nic user,smb=3D/some/dir'' -(for embedded NICs). The new syntax allows different settings to be -provided per NIC. - @subsection -usbdevice (since 2.10.0) =20 The ``-usbdevice DEV'' argument is now a synonym for setting diff --git a/qemu-options.hx b/qemu-options.hx index 7ca539a..a642ad2 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -1813,16 +1813,6 @@ STEXI @table @option ETEXI =20 -HXCOMM Legacy slirp options (now moved to -net user): -#ifdef CONFIG_SLIRP -DEF("tftp", HAS_ARG, QEMU_OPTION_tftp, "", QEMU_ARCH_ALL) -DEF("bootp", HAS_ARG, QEMU_OPTION_bootp, "", QEMU_ARCH_ALL) -DEF("redir", HAS_ARG, QEMU_OPTION_redir, "", QEMU_ARCH_ALL) -#ifndef _WIN32 -DEF("smb", HAS_ARG, QEMU_OPTION_smb, "", QEMU_ARCH_ALL) -#endif -#endif - DEF("netdev", HAS_ARG, QEMU_OPTION_netdev, #ifdef CONFIG_SLIRP "-netdev user,id=3Dstr[,ipv4[=3Don|off]][,net=3Daddr[/mask]][,host=3Da= ddr]\n" @@ -2150,11 +2140,6 @@ qemu-system-i386 -nic 'user,id=3Dn1,guestfwd=3Dtcp:= 10.0.2.100:1234-cmd:netcat 10.10 =20 @end table =20 -Note: Legacy stand-alone options -tftp, -bootp, -smb and -redir are still -processed and applied to -net user. Mixing them with the new configuration -syntax gives undefined results. Their use for new applications is discoura= ged -as they will be removed from future versions. - @item -netdev tap,id=3D@var{id}[,fd=3D@var{h}][,ifname=3D@var{name}][,scri= pt=3D@var{file}][,downscript=3D@var{dfile}][,br=3D@var{bridge}][,helper=3D@= var{helper}] Configure a host TAP network backend with ID @var{id}. =20 diff --git a/vl.c b/vl.c index cfeee0d..1b8ff85 100644 --- a/vl.c +++ b/vl.c @@ -3168,24 +3168,6 @@ int main(int argc, char **argv, char **envp) } break; #endif -#ifdef CONFIG_SLIRP - case QEMU_OPTION_tftp: - error_report("The -tftp option is deprecated. " - "Please use '-netdev user,tftp=3D...' instead= ."); - legacy_tftp_prefix =3D optarg; - break; - case QEMU_OPTION_bootp: - error_report("The -bootp option is deprecated. " - "Please use '-netdev user,bootfile=3D...' ins= tead."); - legacy_bootp_filename =3D optarg; - break; - case QEMU_OPTION_redir: - error_report("The -redir option is deprecated. " - "Please use '-netdev user,hostfwd=3D...' inst= ead."); - if (net_slirp_redir(optarg) < 0) - exit(1); - break; -#endif case QEMU_OPTION_bt: add_device_config(DEV_BT, optarg); break; --=20 1.8.3.1 From nobody Sat Feb 7 04:12:57 2026 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1535705303081107.89478369834251; Fri, 31 Aug 2018 01:48:23 -0700 (PDT) Received: from localhost ([::1]:52494 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fvf6L-0003yk-KQ for importer@patchew.org; Fri, 31 Aug 2018 04:48:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39315) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fvf3i-0000r7-96 for qemu-devel@nongnu.org; Fri, 31 Aug 2018 04:45:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fvexY-0007Kj-BL for qemu-devel@nongnu.org; Fri, 31 Aug 2018 04:39:19 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:53628 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fvexY-0007KY-76 for qemu-devel@nongnu.org; Fri, 31 Aug 2018 04:39:16 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DCBE8401EF02; Fri, 31 Aug 2018 08:39:15 +0000 (UTC) Received: from thuth.com (ovpn-116-29.ams2.redhat.com [10.36.116.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4BE4510CD791; Fri, 31 Aug 2018 08:39:14 +0000 (UTC) From: Thomas Huth To: Peter Maydell , qemu-devel@nongnu.org Date: Fri, 31 Aug 2018 10:38:54 +0200 Message-Id: <1535704738-8986-6-git-send-email-thuth@redhat.com> In-Reply-To: <1535704738-8986-1-git-send-email-thuth@redhat.com> References: <1535704738-8986-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 31 Aug 2018 08:39:15 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 31 Aug 2018 08:39:15 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'thuth@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 5/9] tests/libqos: Utilize newer glib spawn check 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: Laurent Vivier , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= 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" From: Eric Blake During development, I got a 'make check' failure that claimed: qemu-img returned status code 32512 ** ERROR:tests/libqos/libqos.c:202:mkimg: assertion failed: (!rc) But 32512 is too big for a normal exit status value, which means we failed to use WEXITSTATUS() to shift the bits to the desired value for printing. However, instead of worrying about how to portably parse g_spawn()'s rc in the proper platform-dependent manner, it's better to just rely on the fact that we now require glib 2.40 (since commit e7b3af815) and can therefore use glib's portable checker instead, where the message under my same condition improves to: Child process exited with code 127 ** ERROR:tests/libqos/libqos.c:192:mkimg: assertion failed: (ret && !err) Signed-off-by: Eric Blake Reviewed-by: Thomas Huth Signed-off-by: Thomas Huth --- tests/libqos/libqos.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/tests/libqos/libqos.c b/tests/libqos/libqos.c index 013ca68..c514187 100644 --- a/tests/libqos/libqos.c +++ b/tests/libqos/libqos.c @@ -185,22 +185,12 @@ void mkimg(const char *file, const char *fmt, unsigne= d size_mb) cli =3D g_strdup_printf("%s create -f %s %s %uM", qemu_img_abs_path, fmt, file, size_mb); ret =3D g_spawn_command_line_sync(cli, &out, &out2, &rc, &err); - if (err) { + if (err || !g_spawn_check_exit_status(rc, &err)) { fprintf(stderr, "%s\n", err->message); g_error_free(err); } g_assert(ret && !err); =20 - /* In glib 2.34, we have g_spawn_check_exit_status. in 2.12, we don't. - * glib 2.43.91 implementation assumes that any non-zero is an error f= or - * windows, but uses extra precautions for Linux. However, - * 0 is only possible if the program exited normally, so that should be - * sufficient for our purposes on all platforms, here. */ - if (rc) { - fprintf(stderr, "qemu-img returned status code %d\n", rc); - } - g_assert(!rc); - g_free(out); g_free(out2); g_free(cli); --=20 1.8.3.1 From nobody Sat Feb 7 04:12:57 2026 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1535705506582883.2749832466828; Fri, 31 Aug 2018 01:51:46 -0700 (PDT) Received: from localhost ([::1]:52514 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fvf9d-0006bm-DE for importer@patchew.org; Fri, 31 Aug 2018 04:51:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39612) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fvf3i-0001A2-5n for qemu-devel@nongnu.org; Fri, 31 Aug 2018 04:45:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fvexb-0007PK-Po for qemu-devel@nongnu.org; Fri, 31 Aug 2018 04:39:20 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:39792 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fvexb-0007P1-JL for qemu-devel@nongnu.org; Fri, 31 Aug 2018 04:39:19 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2E4F08077102; Fri, 31 Aug 2018 08:39:19 +0000 (UTC) Received: from thuth.com (ovpn-116-29.ams2.redhat.com [10.36.116.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2D6B510CD794; Fri, 31 Aug 2018 08:39:16 +0000 (UTC) From: Thomas Huth To: Peter Maydell , qemu-devel@nongnu.org Date: Fri, 31 Aug 2018 10:38:55 +0200 Message-Id: <1535704738-8986-7-git-send-email-thuth@redhat.com> In-Reply-To: <1535704738-8986-1-git-send-email-thuth@redhat.com> References: <1535704738-8986-1-git-send-email-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 31 Aug 2018 08:39:19 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 31 Aug 2018 08:39:19 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'thuth@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 6/9] tests: add qmp_assert_error_class() 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: Laurent Vivier , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Marc-Andr=C3=A9 Lureau This helper will simplify a bunch of code checking for QMP errors and can be shared by various tests. Note that test-qga does check for error description as well, so don't replace the code there for now. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Thomas Huth Signed-off-by: Thomas Huth --- tests/drive_del-test.c | 5 +--- tests/libqtest.c | 11 ++++++++ tests/libqtest.h | 9 +++++++ tests/qmp-test.c | 73 ++++++++++++++++------------------------------= ---- tests/test-qga.c | 9 ++----- 5 files changed, 46 insertions(+), 61 deletions(-) diff --git a/tests/drive_del-test.c b/tests/drive_del-test.c index 673c101..4a1a088 100644 --- a/tests/drive_del-test.c +++ b/tests/drive_del-test.c @@ -67,7 +67,6 @@ static void test_after_failed_device_add(void) { char driver[32]; QDict *response; - QDict *error; =20 snprintf(driver, sizeof(driver), "virtio-blk-%s", qvirtio_get_dev_type()); @@ -83,9 +82,7 @@ static void test_after_failed_device_add(void) " 'drive': 'drive0'" "}}", driver); g_assert(response); - error =3D qdict_get_qdict(response, "error"); - g_assert_cmpstr(qdict_get_try_str(error, "class"), =3D=3D, "GenericErr= or"); - qobject_unref(response); + qmp_assert_error_class(response, "GenericError"); =20 /* Delete the drive */ drive_del(); diff --git a/tests/libqtest.c b/tests/libqtest.c index d635c5b..2cd5736 100644 --- a/tests/libqtest.c +++ b/tests/libqtest.c @@ -1194,3 +1194,14 @@ bool qmp_rsp_is_err(QDict *rsp) qobject_unref(rsp); return !!error; } + +void qmp_assert_error_class(QDict *rsp, const char *class) +{ + QDict *error =3D qdict_get_qdict(rsp, "error"); + + g_assert_cmpstr(qdict_get_try_str(error, "class"), =3D=3D, class); + g_assert_nonnull(qdict_get_try_str(error, "desc")); + g_assert(!qdict_haskey(rsp, "return")); + + qobject_unref(rsp); +} diff --git a/tests/libqtest.h b/tests/libqtest.h index 36d5cae..ed88ff9 100644 --- a/tests/libqtest.h +++ b/tests/libqtest.h @@ -1004,4 +1004,13 @@ void qtest_qmp_device_del(const char *id); */ bool qmp_rsp_is_err(QDict *rsp); =20 +/** + * qmp_assert_error_class: + * @rsp: QMP response to check for error + * @class: an error class + * + * Assert the response has the given error class and discard @rsp. + */ +void qmp_assert_error_class(QDict *rsp, const char *class); + #endif diff --git a/tests/qmp-test.c b/tests/qmp-test.c index 4ae2245..b347228 100644 --- a/tests/qmp-test.c +++ b/tests/qmp-test.c @@ -21,15 +21,6 @@ =20 const char common_args[] =3D "-nodefaults -machine none"; =20 -static const char *get_error_class(QDict *resp) -{ - QDict *error =3D qdict_get_qdict(resp, "error"); - const char *desc =3D qdict_get_try_str(error, "desc"); - - g_assert(desc); - return error ? qdict_get_try_str(error, "class") : NULL; -} - static void test_version(QObject *version) { Visitor *v; @@ -42,15 +33,12 @@ static void test_version(QObject *version) visit_free(v); } =20 -static bool recovered(QTestState *qts) +static void assert_recovered(QTestState *qts) { QDict *resp; - bool ret; =20 resp =3D qtest_qmp(qts, "{ 'execute': 'no-such-cmd' }"); - ret =3D !strcmp(get_error_class(resp), "CommandNotFound"); - qobject_unref(resp); - return ret; + qmp_assert_error_class(resp, "CommandNotFound"); } =20 static void test_malformed(QTestState *qts) @@ -60,73 +48,61 @@ static void test_malformed(QTestState *qts) /* syntax error */ qtest_qmp_send_raw(qts, "{]\n"); resp =3D qtest_qmp_receive(qts); - g_assert_cmpstr(get_error_class(resp), =3D=3D, "GenericError"); - qobject_unref(resp); - g_assert(recovered(qts)); + qmp_assert_error_class(resp, "GenericError"); + assert_recovered(qts); =20 /* lexical error: impossible byte outside string */ qtest_qmp_send_raw(qts, "{\xFF"); resp =3D qtest_qmp_receive(qts); - g_assert_cmpstr(get_error_class(resp), =3D=3D, "GenericError"); - qobject_unref(resp); - g_assert(recovered(qts)); + qmp_assert_error_class(resp, "GenericError"); + assert_recovered(qts); =20 /* lexical error: funny control character outside string */ qtest_qmp_send_raw(qts, "{\x01"); resp =3D qtest_qmp_receive(qts); - g_assert_cmpstr(get_error_class(resp), =3D=3D, "GenericError"); - qobject_unref(resp); - g_assert(recovered(qts)); + qmp_assert_error_class(resp, "GenericError"); + assert_recovered(qts); =20 /* lexical error: impossible byte in string */ qtest_qmp_send_raw(qts, "{'bad \xFF"); resp =3D qtest_qmp_receive(qts); - g_assert_cmpstr(get_error_class(resp), =3D=3D, "GenericError"); - qobject_unref(resp); - g_assert(recovered(qts)); + qmp_assert_error_class(resp, "GenericError"); + assert_recovered(qts); =20 /* lexical error: control character in string */ qtest_qmp_send_raw(qts, "{'execute': 'nonexistent', 'id':'\n"); resp =3D qtest_qmp_receive(qts); - g_assert_cmpstr(get_error_class(resp), =3D=3D, "GenericError"); - qobject_unref(resp); - g_assert(recovered(qts)); + qmp_assert_error_class(resp, "GenericError"); + assert_recovered(qts); =20 /* lexical error: interpolation */ qtest_qmp_send_raw(qts, "%%p\n"); /* two errors, one for "%", one for "p" */ resp =3D qtest_qmp_receive(qts); - g_assert_cmpstr(get_error_class(resp), =3D=3D, "GenericError"); - qobject_unref(resp); + qmp_assert_error_class(resp, "GenericError"); resp =3D qtest_qmp_receive(qts); - g_assert_cmpstr(get_error_class(resp), =3D=3D, "GenericError"); - qobject_unref(resp); - g_assert(recovered(qts)); + qmp_assert_error_class(resp, "GenericError"); + assert_recovered(qts); =20 /* Not even a dictionary */ resp =3D qtest_qmp(qts, "null"); - g_assert_cmpstr(get_error_class(resp), =3D=3D, "GenericError"); - qobject_unref(resp); + qmp_assert_error_class(resp, "GenericError"); =20 /* No "execute" key */ resp =3D qtest_qmp(qts, "{}"); - g_assert_cmpstr(get_error_class(resp), =3D=3D, "GenericError"); - qobject_unref(resp); + qmp_assert_error_class(resp, "GenericError"); =20 /* "execute" isn't a string */ resp =3D qtest_qmp(qts, "{ 'execute': true }"); - g_assert_cmpstr(get_error_class(resp), =3D=3D, "GenericError"); - qobject_unref(resp); + qmp_assert_error_class(resp, "GenericError"); =20 /* "arguments" isn't a dictionary */ resp =3D qtest_qmp(qts, "{ 'execute': 'no-such-cmd', 'arguments': [] }= "); - g_assert_cmpstr(get_error_class(resp), =3D=3D, "GenericError"); - qobject_unref(resp); + qmp_assert_error_class(resp, "GenericError"); =20 /* extra key */ resp =3D qtest_qmp(qts, "{ 'execute': 'no-such-cmd', 'extra': true }"); - g_assert_cmpstr(get_error_class(resp), =3D=3D, "GenericError"); - qobject_unref(resp); + qmp_assert_error_class(resp, "GenericError"); } =20 static void test_qmp_protocol(void) @@ -148,8 +124,7 @@ static void test_qmp_protocol(void) =20 /* Test valid command before handshake */ resp =3D qtest_qmp(qts, "{ 'execute': 'query-version' }"); - g_assert_cmpstr(get_error_class(resp), =3D=3D, "CommandNotFound"); - qobject_unref(resp); + qmp_assert_error_class(resp, "CommandNotFound"); =20 /* Test malformed commands before handshake */ test_malformed(qts); @@ -162,8 +137,7 @@ static void test_qmp_protocol(void) =20 /* Test repeated handshake */ resp =3D qtest_qmp(qts, "{ 'execute': 'qmp_capabilities' }"); - g_assert_cmpstr(get_error_class(resp), =3D=3D, "CommandNotFound"); - qobject_unref(resp); + qmp_assert_error_class(resp, "CommandNotFound"); =20 /* Test valid command */ resp =3D qtest_qmp(qts, "{ 'execute': 'query-version' }"); @@ -182,9 +156,8 @@ static void test_qmp_protocol(void) =20 /* Test command failure with 'id' */ resp =3D qtest_qmp(qts, "{ 'execute': 'human-monitor-command', 'id': 2= }"); - g_assert_cmpstr(get_error_class(resp), =3D=3D, "GenericError"); g_assert_cmpint(qdict_get_int(resp, "id"), =3D=3D, 2); - qobject_unref(resp); + qmp_assert_error_class(resp, "GenericError"); =20 qtest_quit(qts); } diff --git a/tests/test-qga.c b/tests/test-qga.c index f69cdf6..3d63774 100644 --- a/tests/test-qga.c +++ b/tests/test-qga.c @@ -244,17 +244,12 @@ static void test_qga_invalid_id(gconstpointer fix) static void test_qga_invalid_oob(gconstpointer fix) { const TestFixture *fixture =3D fix; - QDict *ret, *error; - const char *class; + QDict *ret; =20 ret =3D qmp_fd(fixture->fd, "{'exec-oob': 'guest-ping'}"); g_assert_nonnull(ret); =20 - error =3D qdict_get_qdict(ret, "error"); - class =3D qdict_get_try_str(error, "class"); - g_assert_cmpstr(class, =3D=3D, "GenericError"); - - qobject_unref(ret); + qmp_assert_error_class(ret, "GenericError"); } =20 static void test_qga_invalid_args(gconstpointer fix) --=20 1.8.3.1 From nobody Sat Feb 7 04:12:57 2026 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 15357056270941023.6372950164734; Fri, 31 Aug 2018 01:53:47 -0700 (PDT) Received: from localhost ([::1]:52530 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fvfBX-0001gS-70 for importer@patchew.org; Fri, 31 Aug 2018 04:53:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39558) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fvf3h-00017Y-Eb for qemu-devel@nongnu.org; Fri, 31 Aug 2018 04:45:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fvexd-0007Tm-M4 for qemu-devel@nongnu.org; Fri, 31 Aug 2018 04:39:22 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:37082 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fvexd-0007S8-Gm for qemu-devel@nongnu.org; Fri, 31 Aug 2018 04:39:21 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 30D2D40201BD; Fri, 31 Aug 2018 08:39:21 +0000 (UTC) Received: from thuth.com (ovpn-116-29.ams2.redhat.com [10.36.116.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8260610D18E0; Fri, 31 Aug 2018 08:39:19 +0000 (UTC) From: Thomas Huth To: Peter Maydell , qemu-devel@nongnu.org Date: Fri, 31 Aug 2018 10:38:56 +0200 Message-Id: <1535704738-8986-8-git-send-email-thuth@redhat.com> In-Reply-To: <1535704738-8986-1-git-send-email-thuth@redhat.com> References: <1535704738-8986-1-git-send-email-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 31 Aug 2018 08:39:21 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 31 Aug 2018 08:39:21 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'thuth@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 7/9] tests: add qmp/object-add-without-props test 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: Laurent Vivier , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Marc-Andr=C3=A9 Lureau test_object_add_without_props() tests a bug in qmp_object_add() we fixed in commit e64c75a975. Sadly, we don't have systematic object-add tests. This lone test can go into qmp-cmd-test for want of a better home. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Thomas Huth Signed-off-by: Thomas Huth --- tests/qmp-cmd-test.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/qmp-cmd-test.c b/tests/qmp-cmd-test.c index c5b70df..d12cac5 100644 --- a/tests/qmp-cmd-test.c +++ b/tests/qmp-cmd-test.c @@ -197,6 +197,19 @@ static void add_query_tests(QmpSchema *schema) } } =20 +static void test_object_add_without_props(void) +{ + QTestState *qts; + QDict *resp; + + qts =3D qtest_init(common_args); + resp =3D qtest_qmp(qts, "{'execute': 'object-add', 'arguments':" + " {'qom-type': 'memory-backend-ram', 'id': 'ram1' } }"= ); + g_assert_nonnull(resp); + qmp_assert_error_class(resp, "GenericError"); + qtest_quit(qts); +} + int main(int argc, char *argv[]) { QmpSchema schema; @@ -206,6 +219,11 @@ int main(int argc, char *argv[]) =20 qmp_schema_init(&schema); add_query_tests(&schema); + + qtest_add_func("qmp/object-add-without-props", + test_object_add_without_props); + /* TODO: add coverage of generic object-add failure modes */ + ret =3D g_test_run(); =20 qmp_schema_cleanup(&schema); --=20 1.8.3.1 From nobody Sat Feb 7 04:12:57 2026 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1535705300351745.1075756926735; Fri, 31 Aug 2018 01:48:20 -0700 (PDT) Received: from localhost ([::1]:52495 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fvf6J-0003zo-68 for importer@patchew.org; Fri, 31 Aug 2018 04:48:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39315) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fvf3h-0000r7-EH for qemu-devel@nongnu.org; Fri, 31 Aug 2018 04:45:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fvexh-0007Vf-46 for qemu-devel@nongnu.org; Fri, 31 Aug 2018 04:39:28 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:39798 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fvexg-0007VZ-Vx for qemu-devel@nongnu.org; Fri, 31 Aug 2018 04:39:25 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A644A804B4DB; Fri, 31 Aug 2018 08:39:24 +0000 (UTC) Received: from thuth.com (ovpn-116-29.ams2.redhat.com [10.36.116.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8E01F10F1BF8; Fri, 31 Aug 2018 08:39:21 +0000 (UTC) From: Thomas Huth To: Peter Maydell , qemu-devel@nongnu.org Date: Fri, 31 Aug 2018 10:38:57 +0200 Message-Id: <1535704738-8986-9-git-send-email-thuth@redhat.com> In-Reply-To: <1535704738-8986-1-git-send-email-thuth@redhat.com> References: <1535704738-8986-1-git-send-email-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 31 Aug 2018 08:39:24 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 31 Aug 2018 08:39:24 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'thuth@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 8/9] tests: add qmp/qom-set-without-value test 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: Laurent Vivier , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Marc-Andr=C3=A9 Lureau test_qom_set_without_value() is about a bug in infrastructure used by the QMP core, fixed in commit c489780203. We covered the bug in infrastructure unit tests (commit bce3035a44). I wrote that test earlier, to cover QMP level as well, the test could go into qmp-test. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Thomas Huth Signed-off-by: Thomas Huth --- tests/qmp-test.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/qmp-test.c b/tests/qmp-test.c index b347228..2b923f0 100644 --- a/tests/qmp-test.c +++ b/tests/qmp-test.c @@ -321,6 +321,19 @@ static void test_qmp_preconfig(void) qtest_quit(qs); } =20 +static void test_qom_set_without_value(void) +{ + QTestState *qts; + QDict *resp; + + qts =3D qtest_init(common_args); + resp =3D qtest_qmp(qts, "{'execute': 'qom-set', 'arguments':" + " { 'path': '/machine', 'property': 'rtc-time' } }"); + g_assert_nonnull(resp); + qmp_assert_error_class(resp, "GenericError"); + qtest_quit(qts); +} + int main(int argc, char *argv[]) { g_test_init(&argc, &argv, NULL); @@ -328,6 +341,7 @@ int main(int argc, char *argv[]) qtest_add_func("qmp/protocol", test_qmp_protocol); qtest_add_func("qmp/oob", test_qmp_oob); qtest_add_func("qmp/preconfig", test_qmp_preconfig); + qtest_add_func("qmp/qom-set-without-value", test_qom_set_without_value= ); =20 return g_test_run(); } --=20 1.8.3.1 From nobody Sat Feb 7 04:12:57 2026 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1535705457627376.8975512125096; Fri, 31 Aug 2018 01:50:57 -0700 (PDT) Received: from localhost ([::1]:52507 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fvf8q-0005yf-Js for importer@patchew.org; Fri, 31 Aug 2018 04:50:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39315) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fvf3e-0000r7-0V for qemu-devel@nongnu.org; Fri, 31 Aug 2018 04:45:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fvexj-0007W2-DS for qemu-devel@nongnu.org; Fri, 31 Aug 2018 04:39:28 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:52012 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fvexj-0007Vw-5p for qemu-devel@nongnu.org; Fri, 31 Aug 2018 04:39:27 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CAA845BCD3; Fri, 31 Aug 2018 08:39:26 +0000 (UTC) Received: from thuth.com (ovpn-116-29.ams2.redhat.com [10.36.116.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0F68E10D18E0; Fri, 31 Aug 2018 08:39:24 +0000 (UTC) From: Thomas Huth To: Peter Maydell , qemu-devel@nongnu.org Date: Fri, 31 Aug 2018 10:38:58 +0200 Message-Id: <1535704738-8986-10-git-send-email-thuth@redhat.com> In-Reply-To: <1535704738-8986-1-git-send-email-thuth@redhat.com> References: <1535704738-8986-1-git-send-email-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Fri, 31 Aug 2018 08:39:26 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Fri, 31 Aug 2018 08:39:26 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'thuth@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 9/9] tests: add a qmp success-response test 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: Laurent Vivier , Paolo Bonzini , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Marc-Andr=C3=A9 Lureau Verify the usage of this schema feature and the API behaviour. This should be the only case where qmp_dispatch() returns NULL. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Markus Armbruster Signed-off-by: Thomas Huth --- tests/qapi-schema/qapi-schema-test.json | 2 ++ tests/qapi-schema/qapi-schema-test.out | 2 ++ tests/test-qmp-cmds.c | 17 +++++++++++++++++ 3 files changed, 21 insertions(+) diff --git a/tests/qapi-schema/qapi-schema-test.json b/tests/qapi-schema/qa= pi-schema-test.json index 11aa4c8..fb03163 100644 --- a/tests/qapi-schema/qapi-schema-test.json +++ b/tests/qapi-schema/qapi-schema-test.json @@ -137,6 +137,8 @@ 'data': {'ud1a': 'UserDefOne', '*ud1b': 'UserDefOne'}, 'returns': 'UserDefTwo' } =20 +{ 'command': 'cmd-success-response', 'data': {}, 'success-response': false= } + # Returning a non-dictionary requires a name from the whitelist { 'command': 'guest-get-time', 'data': {'a': 'int', '*b': 'int' }, 'returns': 'int' } diff --git a/tests/qapi-schema/qapi-schema-test.out b/tests/qapi-schema/qap= i-schema-test.out index 0da9245..218ac7d 100644 --- a/tests/qapi-schema/qapi-schema-test.out +++ b/tests/qapi-schema/qapi-schema-test.out @@ -156,6 +156,8 @@ object q_obj_user_def_cmd2-arg member ud1b: UserDefOne optional=3DTrue command user_def_cmd2 q_obj_user_def_cmd2-arg -> UserDefTwo gen=3DTrue success_response=3DTrue boxed=3DFalse oob=3DFalse preconfig= =3DFalse +command cmd-success-response None -> None + gen=3DTrue success_response=3DFalse boxed=3DFalse oob=3DFalse preconfig= =3DFalse object q_obj_guest-get-time-arg member a: int optional=3DFalse member b: int optional=3DTrue diff --git a/tests/test-qmp-cmds.c b/tests/test-qmp-cmds.c index ab414fa..4ab2b6e 100644 --- a/tests/test-qmp-cmds.c +++ b/tests/test-qmp-cmds.c @@ -32,6 +32,10 @@ void qmp_test_flags_command(Error **errp) { } =20 +void qmp_cmd_success_response(Error **errp) +{ +} + Empty2 *qmp_user_def_cmd0(Error **errp) { return g_new0(Empty2, 1); @@ -153,6 +157,17 @@ static void test_dispatch_cmd_failure(void) qobject_unref(req); } =20 +static void test_dispatch_cmd_success_response(void) +{ + QDict *req =3D qdict_new(); + QDict *resp; + + qdict_put_str(req, "execute", "cmd-success-response"); + resp =3D qmp_dispatch(&qmp_commands, QOBJECT(req), false); + g_assert_null(resp); + qobject_unref(req); +} + static QObject *test_qmp_dispatch(QDict *req) { QDict *resp; @@ -289,6 +304,8 @@ int main(int argc, char **argv) g_test_add_func("/qmp/dispatch_cmd", test_dispatch_cmd); g_test_add_func("/qmp/dispatch_cmd_failure", test_dispatch_cmd_failure= ); g_test_add_func("/qmp/dispatch_cmd_io", test_dispatch_cmd_io); + g_test_add_func("/qmp/dispatch_cmd_success_response", + test_dispatch_cmd_success_response); g_test_add_func("/qmp/dealloc_types", test_dealloc_types); g_test_add_func("/qmp/dealloc_partial", test_dealloc_partial); =20 --=20 1.8.3.1