]> git.proxmox.com Git - mirror_qemu.git/commitdiff
qapi: report the default CPU type for each machine
authorDaniel P. Berrangé <berrange@redhat.com>
Thu, 22 Aug 2019 10:04:12 +0000 (11:04 +0100)
committerEduardo Habkost <ehabkost@redhat.com>
Tue, 3 Sep 2019 17:39:46 +0000 (14:39 -0300)
When user doesn't request any explicit CPU model with libvirt or QEMU,
a machine type specific CPU model is picked. Currently there is no way
to determine what this QEMU built-in default is, so libvirt cannot
report this back to the user in the XML config.

This extends the "query-machines" QMP command so that it reports the
default CPU model typename for each machine.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20190822100412.23746-1-berrange@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
hw/core/machine-qmp-cmds.c
qapi/machine.json

index 15cf7c62e3a8fabae26574b8672315927b6d967a..eed5aeb2f75bfb45bddbfd9671bb8feaa5d1b4f9 100644 (file)
@@ -230,6 +230,10 @@ MachineInfoList *qmp_query_machines(Error **errp)
         info->hotpluggable_cpus = mc->has_hotpluggable_cpus;
         info->numa_mem_supported = mc->numa_mem_supported;
         info->deprecated = !!mc->deprecation_reason;
+        if (mc->default_cpu_type) {
+            info->default_cpu_type = g_strdup(mc->default_cpu_type);
+            info->has_default_cpu_type = true;
+        }
 
         entry = g_malloc0(sizeof(*entry));
         entry->value = info;
index de5c742d7232a3680475ac15350305509221ec16..ca26779f1a3623e86befc00ee8d834092d409774 100644 (file)
 #              in future versions of QEMU according to the QEMU deprecation
 #              policy (since 4.1.0)
 #
+# @default-cpu-type: default CPU model typename if none is requested via
+#                    the -cpu argument. (since 4.2)
+#
 # Since: 1.2.0
 ##
 { 'struct': 'MachineInfo',
   'data': { 'name': 'str', '*alias': 'str',
             '*is-default': 'bool', 'cpu-max': 'int',
             'hotpluggable-cpus': 'bool',  'numa-mem-supported': 'bool',
-            'deprecated': 'bool' } }
+            'deprecated': 'bool', '*default-cpu-type': 'str' } }
 
 ##
 # @query-machines: