From nobody Sun May 19 13:34:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1556054684; cv=none; d=zoho.com; s=zohoarc; b=lj9YAURQ75KIyZ+xw6fok1aQ2pCBXMCeboOn2aVTaUQ0sOuzAomg9DMCEsS2h2vxQL5OCQ4K6S68KP7AaCFCh0TrgG1z8U2nsuH2UaA1TLnHzan/UJIZjItUHHjigPXFUA5us/qOkMGTXzerHGch+8psod962NcwVYwmqkHhaCA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556054684; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=UcqLO1EwL8EtdOYn11AGrMKYOlAj+9KIgSPq/mv6M4E=; b=Rm9qsZazJa7GIqZQ8uu3hfX/hMgHR5b8l5Zs8+QzbgVaOPkbZqh/6bSMDFyde2RbRMa5OWdHPC3pWmyByJu0ND9AqwVVk6TvZPqpqmyWyX1YB6hK5qsBJIAcb40Yn09trUp3HJniKxvP1nC32BkvJIHXcx+aDK1KKQX7vsEbeiM= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1556054684354372.5619815359174; Tue, 23 Apr 2019 14:24:44 -0700 (PDT) Received: from localhost ([127.0.0.1]:59690 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJ2u0-0005BZ-76 for importer@patchew.org; Tue, 23 Apr 2019 17:24:32 -0400 Received: from eggs.gnu.org ([209.51.188.92]:46956) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJ2sR-0004IB-EL for qemu-devel@nongnu.org; Tue, 23 Apr 2019 17:22:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJ2sQ-0007eR-0I for qemu-devel@nongnu.org; Tue, 23 Apr 2019 17:22:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52644) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hJ2sP-0007c4-J6 for qemu-devel@nongnu.org; Tue, 23 Apr 2019 17:22:53 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7B7343199372; Tue, 23 Apr 2019 21:22:51 +0000 (UTC) Received: from localhost (ovpn-116-9.gru2.redhat.com [10.97.116.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id EF5F7600C2; Tue, 23 Apr 2019 21:22:50 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Tue, 23 Apr 2019 18:22:44 -0300 Message-Id: <20190423212246.3542-2-ehabkost@redhat.com> In-Reply-To: <20190423212246.3542-1-ehabkost@redhat.com> References: <20190423212246.3542-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Tue, 23 Apr 2019 21:22:51 +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 1/3] qapi: SupportStatusInfo struct 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: mprivozn@redhat.com, Markus Armbruster Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This struct will be used to represent support and deprecation status of QEMU features. Signed-off-by: Eduardo Habkost Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- qapi/common.json | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/qapi/common.json b/qapi/common.json index 99d313ef3b..b59d0dc66b 100644 --- a/qapi/common.json +++ b/qapi/common.json @@ -193,3 +193,27 @@ 'ppc64', 'riscv32', 'riscv64', 's390x', 'sh4', 'sh4eb', 'sparc', 'sparc64', 'tricore', 'unicore32', 'x86_64', 'xtensa', 'xtensaeb' ] } + +## +# @SupportStatusInfo: +# +# Information on support status of a given feature +# (e.g. machine type) +# +# @deprecated: if true, the given feature is deprecated and may be removed +# in future versions of QEMU according to the QEMU deprecation +# policy. +# +# @status-message: Human readable message describing support status +# of the feature. +# +# @suggested-alternative: Optional. Suggested alternative for a deprecated +# feature. For machine types, this should be the = name +# of an available machine-type. +# +# Since: 4.1 +## +{ 'struct': 'SupportStatusInfo', + 'data': { 'deprecated': 'bool', + '*status-message': 'str', + '*suggested-alternative': 'str' } } --=20 2.18.0.rc1.1.g3f1ff2140 From nobody Sun May 19 13:34:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1556054795; cv=none; d=zoho.com; s=zohoarc; b=d2eNyeFNVi3J0cpuOmZDE8kXuU39sPzrC0n0bOGvADmQ4FjAclaAZ6ceDnvW6X/mburC/SDIvesbV+bNNY7eJdSR2rV3DkSSDtA1wrNbW4o2U/uwmV4SzIEv7DC88XhQy3zcZLheL94bUw0aNAb+syhTEIxRTU2d9QIUgb/rWqY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556054795; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=s69yvnAYHghPR93dplYc23XgvaNZEwVu0gQ4W8UlN3w=; b=mgOf4sJVF7pT+NlKMQqRNyA0NbKNrOuWZ6clLvkpNiIcU2WbD217rrNHQ9X5/4bPYrCtvIF5zKSgKOZymCRqmOmY/L0iAqaYNHs8AG/QU7HMA5f7rZrBRz0Ug0yvs2ArjIucSEJXqk9/bc213L/zquz1eI7BRk6fsJOuk5Gqw78= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1556054795003189.35719861890527; Tue, 23 Apr 2019 14:26:35 -0700 (PDT) Received: from localhost ([127.0.0.1]:59738 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJ2vt-00073x-Tb for importer@patchew.org; Tue, 23 Apr 2019 17:26:29 -0400 Received: from eggs.gnu.org ([209.51.188.92]:47046) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJ2sl-0004Yr-9r for qemu-devel@nongnu.org; Tue, 23 Apr 2019 17:23:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJ2sf-0007mP-LW for qemu-devel@nongnu.org; Tue, 23 Apr 2019 17:23:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55520) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hJ2sX-0007h2-9A; Tue, 23 Apr 2019 17:23:03 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 88297308795B; Tue, 23 Apr 2019 21:22:57 +0000 (UTC) Received: from localhost (ovpn-116-9.gru2.redhat.com [10.97.116.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 391095C239; Tue, 23 Apr 2019 21:22:52 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Tue, 23 Apr 2019 18:22:45 -0300 Message-Id: <20190423212246.3542-3-ehabkost@redhat.com> In-Reply-To: <20190423212246.3542-1-ehabkost@redhat.com> References: <20190423212246.3542-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Tue, 23 Apr 2019 21:22:57 +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 2/3] machine: Use SupportStatusInfo for deprecation info 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: "Michael S. Tsirkin" , mprivozn@redhat.com, Markus Armbruster , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Use SupportStatusInfo to represent deprecation information of machine types. Instead of using a generic "use XXX instead" message for humans, encode the suggested alternative in a machine-friendly way at the 'suggested_alternatives' field. Signed-off-by: Eduardo Habkost Acked-by: David Gibson --- include/hw/boards.h | 7 ++++--- hw/i386/pc_piix.c | 4 +++- hw/ppc/prep.c | 4 +++- vl.c | 13 +++++++++---- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/include/hw/boards.h b/include/hw/boards.h index e231860666..243bf3c7ce 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -8,6 +8,8 @@ #include "hw/qdev.h" #include "qom/object.h" #include "qom/cpu.h" +#include "qapi/qapi-types-common.h" + =20 /** * memory_region_allocate_system_memory - Allocate a board's main memory @@ -105,8 +107,7 @@ typedef struct { =20 /** * MachineClass: - * @deprecation_reason: If set, the machine is marked as deprecated. The - * string should provide some clear information about what to use inste= ad. + * @support_status: Support and deprecation status of machine type. * @max_cpus: maximum number of CPUs supported. Default: 1 * @min_cpus: minimum number of CPUs supported. Default: 1 * @default_cpus: number of CPUs instantiated if none are specified. Defau= lt: 1 @@ -169,7 +170,7 @@ struct MachineClass { char *name; const char *alias; const char *desc; - const char *deprecation_reason; + SupportStatusInfo support_status; =20 void (*init)(MachineState *state); void (*reset)(void); diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 8ad8e885c6..97bd401618 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -781,7 +781,9 @@ static void pc_i440fx_0_15_machine_options(MachineClass= *m) =20 pc_i440fx_1_0_machine_options(m); m->hw_version =3D "0.15"; - m->deprecation_reason =3D "use a newer machine type instead"; + m->support_status.deprecated =3D true; + m->support_status.has_suggested_alternative =3D true; + m->support_status.suggested_alternative =3D g_strdup("pc"); compat_props_add(m->compat_props, compat, G_N_ELEMENTS(compat)); } =20 diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c index 847d320465..9a02b0eec4 100644 --- a/hw/ppc/prep.c +++ b/hw/ppc/prep.c @@ -587,7 +587,9 @@ static void ppc_prep_init(MachineState *machine) =20 static void prep_machine_init(MachineClass *mc) { - mc->deprecation_reason =3D "use 40p machine type instead"; + mc->support_status.deprecated =3D true; + mc->support_status.has_suggested_alternative =3D true; + mc->support_status.suggested_alternative =3D g_strdup("40p"); mc->desc =3D "PowerPC PREP platform"; mc->init =3D ppc_prep_init; mc->block_default_type =3D IF_IDE; diff --git a/vl.c b/vl.c index c696ad2a13..99b857ed2a 100644 --- a/vl.c +++ b/vl.c @@ -2610,7 +2610,7 @@ static gint machine_class_cmp(gconstpointer a, gconst= pointer b) } printf("%-20s %s%s%s\n", mc->name, mc->desc, mc->is_default ? " (default)" : "", - mc->deprecation_reason ? " (deprecated)" : ""); + mc->support_status.deprecated ? " (deprecated)" : ""); } } =20 @@ -4308,9 +4308,14 @@ int main(int argc, char **argv, char **envp) * called from configure_accelerator(). */ =20 - if (!qtest_enabled() && machine_class->deprecation_reason) { - error_report("Machine type '%s' is deprecated: %s", - machine_class->name, machine_class->deprecation_reaso= n); + if (!qtest_enabled() && machine_class->support_status.deprecated) { + error_report("Machine type '%s' is deprecated%s%s", machine_class-= >name, + machine_class->support_status.status_message ? ": " := "", + machine_class->support_status.status_message ?: ""); + if (machine_class->support_status.suggested_alternative) { + error_report("Suggested solution: use '%s' machine type instea= d", + machine_class->support_status.suggested_alternati= ve); + } } =20 /* --=20 2.18.0.rc1.1.g3f1ff2140 From nobody Sun May 19 13:34:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1556054795; cv=none; d=zoho.com; s=zohoarc; b=A8vlkRd1MxRmn9GPMo94WurjN+sJGA/nUYoMIwrlQFRH2Nn+LWcGqAcDR/kBmIP3WRHFCyeRuKzN7I7iw6GLp+MeiKrmgyAFWBx/4m5ZVVeGXIjx79CWGUPaaf78g3BWa0OCaRNLq0WnvbS/wr+HA2nnblaVLfvSFwju7VGw9wk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556054795; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=6A0GlZY5uuiE+Ih/HSh9Cv3H4bfaZsgLOGdS3UYTrao=; b=TmtKHh7qcmRDqm3pbjONAcrIIYh/8nxNQwRZOYUOz7EKNt/wNNBlvS3vo+5pshVWOKmoXqmKOGPFIrAGAWDdnD7yRc6lh6yiNtUycPC2M6SAgETiYnPMr2qf9BAIoMvkox2mB671ywqQ5um/wFjzU0Z/YDx7rYp4GvTBLwpjx6s= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1556054795243643.1498829828994; Tue, 23 Apr 2019 14:26:35 -0700 (PDT) Received: from localhost ([127.0.0.1]:59735 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJ2vt-000738-1R for importer@patchew.org; Tue, 23 Apr 2019 17:26:29 -0400 Received: from eggs.gnu.org ([209.51.188.92]:47045) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJ2sl-0004Yp-9n for qemu-devel@nongnu.org; Tue, 23 Apr 2019 17:23:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJ2sf-0007mc-Ll for qemu-devel@nongnu.org; Tue, 23 Apr 2019 17:23:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55990) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hJ2sZ-0007hs-EB for qemu-devel@nongnu.org; Tue, 23 Apr 2019 17:23:03 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 82289307D98D; Tue, 23 Apr 2019 21:22:59 +0000 (UTC) Received: from localhost (ovpn-116-9.gru2.redhat.com [10.97.116.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0FA6E1001E7D; Tue, 23 Apr 2019 21:22:58 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Tue, 23 Apr 2019 18:22:46 -0300 Message-Id: <20190423212246.3542-4-ehabkost@redhat.com> In-Reply-To: <20190423212246.3542-1-ehabkost@redhat.com> References: <20190423212246.3542-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Tue, 23 Apr 2019 21:22:59 +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 3/3] qmp: Add deprecation information to query-machines 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: mprivozn@redhat.com, Markus Armbruster Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Export machine type deprecation information through the query-machines QMP command. With this, libvirt and management software will be able to show this information to users and/or suggest changes to VM configuration to avoid deprecated machines. Signed-off-by: Eduardo Habkost --- qapi/misc.json | 5 ++++- vl.c | 6 ++++++ tests/acceptance/query_machines.py | 27 +++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 tests/acceptance/query_machines.py diff --git a/qapi/misc.json b/qapi/misc.json index 8b3ca4fdd3..941d251d17 100644 --- a/qapi/misc.json +++ b/qapi/misc.json @@ -2018,12 +2018,15 @@ # # @hotpluggable-cpus: cpu hotplug via -device is supported (since 2.7.0) # +# @support-status: Support/deprecation status information (since 4.1.0) +# # Since: 1.2.0 ## { 'struct': 'MachineInfo', 'data': { 'name': 'str', '*alias': 'str', '*is-default': 'bool', 'cpu-max': 'int', - 'hotpluggable-cpus': 'bool'} } + 'hotpluggable-cpus': 'bool', + 'support-status': 'SupportStatusInfo' } } =20 ## # @query-machines: diff --git a/vl.c b/vl.c index 99b857ed2a..ca23d2a404 100644 --- a/vl.c +++ b/vl.c @@ -1530,6 +1530,12 @@ MachineInfoList *qmp_query_machines(Error **errp) info->name =3D g_strdup(mc->name); info->cpu_max =3D !mc->max_cpus ? 1 : mc->max_cpus; info->hotpluggable_cpus =3D mc->has_hotpluggable_cpus; + assert(!mc->support_status.status_message || + mc->support_status.has_status_message); + assert(!mc->support_status.suggested_alternative || + mc->support_status.has_suggested_alternative); + info->support_status =3D + QAPI_CLONE(SupportStatusInfo, &mc->support_status); =20 entry =3D g_malloc0(sizeof(*entry)); entry->value =3D info; diff --git a/tests/acceptance/query_machines.py b/tests/acceptance/query_ma= chines.py new file mode 100644 index 0000000000..23a56ea617 --- /dev/null +++ b/tests/acceptance/query_machines.py @@ -0,0 +1,27 @@ +# Sanity check query-machines QMP command results +# +# Copyright (c) 2019 Red Hat, Inc. +# +# Author: +# Eduardo Habkost +# +# This work is licensed under the terms of the GNU GPL, version 2 or +# later. See the COPYING file in the top-level directory. + +from avocado_qemu import Test + +class QueryMachines(Test): + def test(self): + self.vm.launch() + machines =3D self.vm.command('query-machines') + machinesdict =3D dict((m['name'], m) for m in machines) + machinesdict.update((m['alias'], m) for m in machines if 'alias' i= n m) + for machine in machines: + status =3D machine['support-status'] + if status['deprecated']: + self.assertTrue(status.get('status-message') or \ + status.get('suggested-alternative'), + "Deprecated machine (%s) must have status-= message or suggested-alternative" % (machine['name'])) + if 'suggested-alternative' in status: + self.assertTrue(status['suggested-alternative'] in machine= sdict, + "suggested-alternative of %s must point to= a valid machine type" % (machine['name'])) --=20 2.18.0.rc1.1.g3f1ff2140