diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 507c7651a158906ed891586ffda1681225e1a647..5b532b247c557eb8be0cc962832219aa242cb2e4 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -3008,7 +3008,7 @@ virQEMUCapsProbeQMPCPUDefinitions(virQEMUCapsPtr qemuCaps,
usable = VIR_DOMCAPS_CPU_USABLE_NO;
if (virDomainCapsCPUModelsAddSteal(models, &cpus[i]->name, usable,
- NULL) < 0)
+ &cpus[i]->blockers) < 0)
goto cleanup;
}
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 7a2678587840b5a582d34a4846ad0afce71aa76c..aac318f787e0b047eeb4890cd69f89af29bba898 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -3736,6 +3736,8 @@ qemuMonitorCPUDefInfoFree(qemuMonitorCPUDefInfoPtr cpu)
{
if (!cpu)
return;
+
+ virStringListFree(cpu->blockers);
VIR_FREE(cpu->name);
VIR_FREE(cpu);
}
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 1647b46972a9c71759534ad6ea6de92be763667e..40d90d0da68af2feaa53d1b8b33ad331906cf555 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -973,6 +973,7 @@ typedef qemuMonitorCPUDefInfo *qemuMonitorCPUDefInfoPtr;
struct _qemuMonitorCPUDefInfo {
virTristateBool usable;
char *name;
+ char **blockers; /* NULL-terminated string list */
};
int qemuMonitorGetCPUDefinitions(qemuMonitorPtr mon,
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index e591e85073c603a7b459209bf5faa6f543e377d2..5546d1aa1f6e576eabf57b19a3b58a85d4d592d4 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -5078,6 +5078,8 @@ qemuMonitorJSONGetCPUDefinitions(qemuMonitorPtr mon,
if (virJSONValueObjectHasKey(child, "unavailable-features")) {
virJSONValuePtr blockers;
+ size_t j;
+ int len;
blockers = virJSONValueObjectGetArray(child,
"unavailable-features");
@@ -5088,10 +5090,30 @@ qemuMonitorJSONGetCPUDefinitions(qemuMonitorPtr mon,
goto cleanup;
}
- if (virJSONValueArraySize(blockers) > 0)
- cpu->usable = VIR_TRISTATE_BOOL_NO;
- else
+ len = virJSONValueArraySize(blockers);
+
+ if (len == 0) {
cpu->usable = VIR_TRISTATE_BOOL_YES;
+ continue;
+ }
+
+ cpu->usable = VIR_TRISTATE_BOOL_NO;
+ if (VIR_ALLOC_N(cpu->blockers, len + 1) < 0)
+ goto cleanup;
+
+ for (j = 0; j < len; j++) {
+ virJSONValuePtr blocker = virJSONValueArrayGet(blockers, j);
+
+ if (blocker->type != VIR_JSON_TYPE_STRING) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("unexpected value in unavailable-features "
+ "array"));
+ goto cleanup;
+ }
+
+ if (VIR_STRDUP(cpu->blockers[j], virJSONValueGetString(blocker)) < 0)
+ goto cleanup;
+ }
}
}
diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml b/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml
index 2546ebdd9dc3f7b09d3253753ad1503369f5ebc3..7e44652feb59db5ed91251de4e65b449bebca4b3 100644
--- a/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml
+++ b/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml
@@ -242,72 +242,1050 @@
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
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86_64.xml
index 10a182e185f06a1c0c7dd3eaa9d7eadf0bdb6e64..ddbd8c32fa17b8230156dfafcc7875b707d3a380 100644
--- a/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml
@@ -701,7 +701,14 @@
-
+
+
+
+
+
+
+
+
@@ -710,31 +717,104 @@
-
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
-
+
+
+
+
@@ -745,22 +825,132 @@
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml
index 88029c04ddaa8892f092a3f50127257cd4a79032..3165b2dee33bdff3f939d529225e3179e942c377 100644
--- a/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml
@@ -217,7 +217,14 @@
-
+
+
+
+
+
+
+
+
@@ -226,14 +233,32 @@
-
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -244,10 +269,15 @@
-
+
+
+
-
+
+
+
+
@@ -258,21 +288,111 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml
index e3ff1272700824f8141bbf27bd9bcee6ba14c5ef..05f9dc03086184b23d1c89f869bab73e499d34cb 100644
--- a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml
@@ -694,7 +694,14 @@
-
+
+
+
+
+
+
+
+
@@ -703,14 +710,32 @@
-
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -722,11 +747,16 @@
-
+
+
+
-
+
+
+
+
@@ -737,21 +767,111 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+