Apart from setting @migratable prop to the
query-cpu-model-expansion command, we will need @hv-passthrough
so that we can query for expansion of Hyper-V Enlightenments
supported on the current host. The idea is to run:
{
"execute": "query-cpu-model-expansion",
"arguments": {
"type": "full",
"model": {
"name": "host",
"props": {
"hv-passthrough": true
}
}
}
}
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/qemu/qemu_monitor_json.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 9822097bd7..f9928b0393 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -4921,7 +4921,8 @@ qemuMonitorJSONParseCPUModelProperty(const char *key,
static virJSONValue *
qemuMonitorJSONMakeCPUModel(virCPUDef *cpu,
- bool migratable)
+ bool migratable,
+ bool hv_passthrough)
{
g_autoptr(virJSONValue) model = virJSONValueNewObject();
size_t i;
@@ -4929,7 +4930,7 @@ qemuMonitorJSONMakeCPUModel(virCPUDef *cpu,
if (virJSONValueObjectAppendString(model, "name", cpu->model) < 0)
return NULL;
- if (cpu->nfeatures || !migratable) {
+ if (cpu->nfeatures || !migratable || hv_passthrough) {
g_autoptr(virJSONValue) props = virJSONValueNewObject();
for (i = 0; i < cpu->nfeatures; i++) {
@@ -4951,6 +4952,11 @@ qemuMonitorJSONMakeCPUModel(virCPUDef *cpu,
return NULL;
}
+ if (hv_passthrough &&
+ virJSONValueObjectAppendBoolean(props, "hv-passthrough", true) <
0) {
+ return NULL;
+ }
+
if (virJSONValueObjectAppend(model, "props", &props) < 0)
return NULL;
}
@@ -5079,7 +5085,7 @@ qemuMonitorJSONGetCPUModelExpansion(qemuMonitor *mon,
*model_info = NULL;
- if (!(model = qemuMonitorJSONMakeCPUModel(cpu, migratable)))
+ if (!(model = qemuMonitorJSONMakeCPUModel(cpu, migratable, false)))
return -1;
if ((rc = qemuMonitorJSONQueryCPUModelExpansionOne(mon, type, &model, &data))
<= 0)
@@ -5128,8 +5134,8 @@ qemuMonitorJSONGetCPUModelBaseline(qemuMonitor *mon,
virJSONValue *cpu_props = NULL;
const char *cpu_name = "";
- if (!(model_a = qemuMonitorJSONMakeCPUModel(cpu_a, true)) ||
- !(model_b = qemuMonitorJSONMakeCPUModel(cpu_b, true)))
+ if (!(model_a = qemuMonitorJSONMakeCPUModel(cpu_a, true, false)) ||
+ !(model_b = qemuMonitorJSONMakeCPUModel(cpu_b, true, false)))
return -1;
if (!(cmd = qemuMonitorJSONMakeCommand("query-cpu-model-baseline",
@@ -5166,8 +5172,8 @@ qemuMonitorJSONGetCPUModelComparison(qemuMonitor *mon,
const char *data_result;
virJSONValue *data;
- if (!(model_a = qemuMonitorJSONMakeCPUModel(cpu_a, true)) ||
- !(model_b = qemuMonitorJSONMakeCPUModel(cpu_b, true)))
+ if (!(model_a = qemuMonitorJSONMakeCPUModel(cpu_a, true, false)) ||
+ !(model_b = qemuMonitorJSONMakeCPUModel(cpu_b, true, false)))
return -1;
if (!(cmd = qemuMonitorJSONMakeCommand("query-cpu-model-comparison",
--
2.38.2