diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 601f17249c..e47eecf028 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -561,6 +561,7 @@ struct _virQEMUCapsMachineType {
unsigned int maxCpus;
bool hotplugCpus;
bool qemuDefault;
+ char *defaultCPU;
};
typedef struct _virQEMUCapsHostCPUData virQEMUCapsHostCPUData;
@@ -1708,6 +1709,7 @@ virQEMUCapsAccelCopyMachineTypes(virQEMUCapsAccelPtr dst,
for (i = 0; i < src->nmachineTypes; i++) {
dst->machineTypes[i].name = g_strdup(src->machineTypes[i].name);
dst->machineTypes[i].alias = g_strdup(src->machineTypes[i].alias);
+ dst->machineTypes[i].defaultCPU = g_strdup(src->machineTypes[i].defaultCPU);
dst->machineTypes[i].maxCpus = src->machineTypes[i].maxCpus;
dst->machineTypes[i].hotplugCpus = src->machineTypes[i].hotplugCpus;
dst->machineTypes[i].qemuDefault = src->machineTypes[i].qemuDefault;
@@ -1787,6 +1789,7 @@ virQEMUCapsAccelClear(virQEMUCapsAccelPtr caps)
for (i = 0; i < caps->nmachineTypes; i++) {
VIR_FREE(caps->machineTypes[i].name);
VIR_FREE(caps->machineTypes[i].alias);
+ VIR_FREE(caps->machineTypes[i].defaultCPU);
}
VIR_FREE(caps->machineTypes);
@@ -2423,6 +2426,7 @@ virQEMUCapsProbeQMPMachineTypes(virQEMUCapsPtr qemuCaps,
mach->alias = g_strdup(machines[i]->alias);
mach->name = g_strdup(machines[i]->name);
+ mach->defaultCPU = g_strdup(machines[i]->defaultCPU);
mach->maxCpus = machines[i]->maxCpus;
mach->hotplugCpus = machines[i]->hotplugCpus;
@@ -3644,6 +3648,8 @@ virQEMUCapsLoadMachines(virQEMUCapsAccelPtr caps,
if (STREQ_NULLABLE(str, "yes"))
caps->machineTypes[i].qemuDefault = true;
VIR_FREE(str);
+
+ caps->machineTypes[i].defaultCPU = virXMLPropString(nodes[i], "defaultCPU");
}
return 0;
@@ -4084,6 +4090,8 @@ virQEMUCapsFormatMachines(virQEMUCapsAccelPtr caps,
caps->machineTypes[i].maxCpus);
if (caps->machineTypes[i].qemuDefault)
virBufferAddLit(buf, " default='yes'");
+ virBufferEscapeString(buf, " defaultCPU='%s'",
+ caps->machineTypes[i].defaultCPU);
virBufferAddLit(buf, "/>\n");
}
}
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 1131616291..231387a3f3 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -3544,6 +3544,7 @@ qemuMonitorMachineInfoFree(qemuMonitorMachineInfoPtr machine)
return;
VIR_FREE(machine->name);
VIR_FREE(machine->alias);
+ VIR_FREE(machine->defaultCPU);
VIR_FREE(machine);
}
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 868f94fa99..d30d075b43 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -1077,6 +1077,7 @@ struct _qemuMonitorMachineInfo {
char *alias;
unsigned int maxCpus;
bool hotplugCpus;
+ char *defaultCPU;
};
int qemuMonitorGetMachines(qemuMonitorPtr mon,
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index d504a7f191..c729450a52 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -5551,6 +5551,18 @@ int qemuMonitorJSONGetMachines(qemuMonitorPtr mon,
ignore_value(virJSONValueObjectGetBoolean(child, "hotpluggable-cpus",
&info->hotplugCpus));
+
+ if (virJSONValueObjectHasKey(child, "default-cpu-type")) {
+ if (!(tmp = virJSONValueObjectGetString(child, "default-cpu-type"))) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("query-machines reply has malformed "
+ "'default-cpu-type' data"));
+ goto cleanup;
+ }
+
+ if (VIR_STRDUP(info->defaultCPU, tmp) < 0)
+ goto cleanup;
+ }
}
ret = n;
diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml
index 3fd7c0ab0d..1ea633f45f 100644
--- a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml
+++ b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml
@@ -233,77 +233,77 @@
-
+
-
-
-
-
+
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
+
-
-
-
+
+
+
-
+
-
-
-
-
-
-
+
+
+
+
+
+
-
+
-
-
+
+
-
-
+
+
-
+
-
+
-
+
@@ -362,76 +362,76 @@
-
+
-
-
-
-
+
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
+
-
-
-
+
+
+
-
+
-
-
-
-
-
-
+
+
+
+
+
+
-
+
-
-
-
-
+
+
+
+
-
+
-
+
-
+
diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml
index eca48b59d9..998e16ec6d 100644
--- a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml
+++ b/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml
@@ -616,37 +616,37 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
@@ -1084,35 +1084,35 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml b/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml
index b291deab44..902672bf71 100644
--- a/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml
+++ b/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml
@@ -371,20 +371,20 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -3342,18 +3342,18 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml
index 39b9db63fd..465db243eb 100644
--- a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml
@@ -841,52 +841,52 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1950,50 +1950,50 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+