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 <address@hidden>
---
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;