[PULL,v6,29/42] qmp: Add deprecation information to query-machines
diff mbox series

Message ID 20190705221504.25166-30-ehabkost@redhat.com
State New
Headers show
Series
  • [PULL,v6,01/42] hw/boards: Add struct CpuTopology to MachineState
Related show

Commit Message

Eduardo Habkost July 5, 2019, 10:14 p.m. UTC
Export machine type deprecation status 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 <ehabkost@redhat.com>
Message-Id: <20190608233447.27970-2-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 qapi/machine.json          | 7 ++++++-
 hw/core/machine-qmp-cmds.c | 1 +
 2 files changed, 7 insertions(+), 1 deletion(-)

Comments

Eric Blake July 8, 2019, 1:29 p.m. UTC | #1
On 7/5/19 5:14 PM, Eduardo Habkost wrote:
> Export machine type deprecation status 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 <ehabkost@redhat.com>
> Message-Id: <20190608233447.27970-2-ehabkost@redhat.com>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
>  qapi/machine.json          | 7 ++++++-
>  hw/core/machine-qmp-cmds.c | 1 +
>  2 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/qapi/machine.json b/qapi/machine.json
> index 78d34ef717..6db8a7e2ec 100644
> --- a/qapi/machine.json
> +++ b/qapi/machine.json
> @@ -321,12 +321,17 @@
>  # @numa-mem-supported: true if '-numa node,mem' option is supported by
>  #                      the machine type and false otherwise (since 4.1)
>  #
> +# @deprecated: if true, the machine type is deprecated and may be removed
> +#              in future versions of QEMU according to the QEMU deprecation
> +#              policy (since 4.1.0)

Here, you used 'since 4.1.0'; in patch 31, you used merely 'since 4.1'.
It's not the first time we are inconsistent, but if someone wants a
trivial cleanup job, scrubbing the docs for all 3-element versions and
converting them to 2-element may be an interesting beginner's task.

Patch
diff mbox series

diff --git a/qapi/machine.json b/qapi/machine.json
index 78d34ef717..6db8a7e2ec 100644
--- a/qapi/machine.json
+++ b/qapi/machine.json
@@ -321,12 +321,17 @@ 
 # @numa-mem-supported: true if '-numa node,mem' option is supported by
 #                      the machine type and false otherwise (since 4.1)
 #
+# @deprecated: if true, the machine type is deprecated and may be removed
+#              in future versions of QEMU according to the QEMU deprecation
+#              policy (since 4.1.0)
+#
 # Since: 1.2.0
 ##
 { 'struct': 'MachineInfo',
   'data': { 'name': 'str', '*alias': 'str',
             '*is-default': 'bool', 'cpu-max': 'int',
-            'hotpluggable-cpus': 'bool', 'numa-mem-supported': 'bool'} }
+            'hotpluggable-cpus': 'bool',  'numa-mem-supported': 'bool',
+            'deprecated': 'bool' } }
 
 ##
 # @query-machines:
diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c
index 754ce77664..5bd95b8ab0 100644
--- a/hw/core/machine-qmp-cmds.c
+++ b/hw/core/machine-qmp-cmds.c
@@ -227,6 +227,7 @@  MachineInfoList *qmp_query_machines(Error **errp)
         info->cpu_max = !mc->max_cpus ? 1 : mc->max_cpus;
         info->hotpluggable_cpus = mc->has_hotpluggable_cpus;
         info->numa_mem_supported = mc->numa_mem_supported;
+        info->deprecated = !!mc->deprecation_reason;
 
         entry = g_malloc0(sizeof(*entry));
         entry->value = info;