* [Qemu-devel] [PATCH v3] qapi: report the default CPU type for each machine
@ 2019-08-22 10:04 Daniel P. Berrangé
2019-08-22 14:21 ` Eduardo Habkost
0 siblings, 1 reply; 2+ messages in thread
From: Daniel P. Berrangé @ 2019-08-22 10:04 UTC (permalink / raw)
To: qemu-devel
Cc: Daniel P. Berrangé,
Eduardo Habkost, Markus Armbruster, Paolo Bonzini, Jiri Denemark
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>
---
hw/core/machine-qmp-cmds.c | 4 ++++
qapi/machine.json | 5 ++++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c
index 526fbd5ced..033b76f7bd 100644
--- a/hw/core/machine-qmp-cmds.c
+++ b/hw/core/machine-qmp-cmds.c
@@ -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;
diff --git a/qapi/machine.json b/qapi/machine.json
index 6db8a7e2ec..bd9cfb02da 100644
--- a/qapi/machine.json
+++ b/qapi/machine.json
@@ -325,13 +325,16 @@
# 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:
--
2.21.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH v3] qapi: report the default CPU type for each machine
2019-08-22 10:04 [Qemu-devel] [PATCH v3] qapi: report the default CPU type for each machine Daniel P. Berrangé
@ 2019-08-22 14:21 ` Eduardo Habkost
0 siblings, 0 replies; 2+ messages in thread
From: Eduardo Habkost @ 2019-08-22 14:21 UTC (permalink / raw)
To: Daniel P. Berrangé
Cc: Paolo Bonzini, Jiri Denemark, qemu-devel, Markus Armbruster
On Thu, Aug 22, 2019 at 11:04:12AM +0100, Daniel P. Berrangé wrote:
> 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>
Sorry for making this miss 4.1. Queueing now.
--
Eduardo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-08-22 14:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-22 10:04 [Qemu-devel] [PATCH v3] qapi: report the default CPU type for each machine Daniel P. Berrangé
2019-08-22 14:21 ` Eduardo Habkost
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).