diff mbox series

[v2,1/1] qmp: Add deprecation information to query-machines

Message ID 20190608233447.27970-2-ehabkost@redhat.com
State New
Headers show
Series [v2,1/1] qmp: Add deprecation information to query-machines | expand

Commit Message

Eduardo Habkost June 8, 2019, 11:34 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>
---
Changes v1 -> v2:
* Take a much simpler approach: add a simple `deprecated` bool
  field, instead of including a human-readable message and
  suggested alternatives
---
 qapi/misc.json | 7 ++++++-
 vl.c           | 1 +
 2 files changed, 7 insertions(+), 1 deletion(-)

Comments

Marcel Apfelbaum June 25, 2019, 8:37 a.m. UTC | #1
On 6/9/19 2:34 AM, 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>
> ---
> Changes v1 -> v2:
> * Take a much simpler approach: add a simple `deprecated` bool
>    field, instead of including a human-readable message and
>    suggested alternatives
> ---
>   qapi/misc.json | 7 ++++++-
>   vl.c           | 1 +
>   2 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/qapi/misc.json b/qapi/misc.json
> index 8b3ca4fdd3..fca793d39c 100644
> --- a/qapi/misc.json
> +++ b/qapi/misc.json
> @@ -2018,12 +2018,17 @@
>   #
>   # @hotpluggable-cpus: cpu hotplug via -device is supported (since 2.7.0)
>   #
> +# @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'} }
> +            'hotpluggable-cpus': 'bool',
> +            'deprecated': 'bool' } }
>   
>   ##
>   # @query-machines:
> diff --git a/vl.c b/vl.c
> index cd1fbc4cdc..f825d2159c 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -1428,6 +1428,7 @@ MachineInfoList *qmp_query_machines(Error **errp)
>           info->name = g_strdup(mc->name);
>           info->cpu_max = !mc->max_cpus ? 1 : mc->max_cpus;
>           info->hotpluggable_cpus = mc->has_hotpluggable_cpus;
> +        info->deprecated = !!mc->deprecation_reason;
>   
>           entry = g_malloc0(sizeof(*entry));
>           entry->value = info;

Reviewed-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>

Thanks,
Marcel
diff mbox series

Patch

diff --git a/qapi/misc.json b/qapi/misc.json
index 8b3ca4fdd3..fca793d39c 100644
--- a/qapi/misc.json
+++ b/qapi/misc.json
@@ -2018,12 +2018,17 @@ 
 #
 # @hotpluggable-cpus: cpu hotplug via -device is supported (since 2.7.0)
 #
+# @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'} }
+            'hotpluggable-cpus': 'bool',
+            'deprecated': 'bool' } }
 
 ##
 # @query-machines:
diff --git a/vl.c b/vl.c
index cd1fbc4cdc..f825d2159c 100644
--- a/vl.c
+++ b/vl.c
@@ -1428,6 +1428,7 @@  MachineInfoList *qmp_query_machines(Error **errp)
         info->name = g_strdup(mc->name);
         info->cpu_max = !mc->max_cpus ? 1 : mc->max_cpus;
         info->hotpluggable_cpus = mc->has_hotpluggable_cpus;
+        info->deprecated = !!mc->deprecation_reason;
 
         entry = g_malloc0(sizeof(*entry));
         entry->value = info;