mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 20:45:18 +00:00
qemuMonitorJSONMakeCPUModel: Introduce @hv_passthrough argument
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@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
7c1ecfd512
commit
7c12eb2397
@ -4921,7 +4921,8 @@ qemuMonitorJSONParseCPUModelProperty(const char *key,
|
|||||||
|
|
||||||
static virJSONValue *
|
static virJSONValue *
|
||||||
qemuMonitorJSONMakeCPUModel(virCPUDef *cpu,
|
qemuMonitorJSONMakeCPUModel(virCPUDef *cpu,
|
||||||
bool migratable)
|
bool migratable,
|
||||||
|
bool hv_passthrough)
|
||||||
{
|
{
|
||||||
g_autoptr(virJSONValue) model = virJSONValueNewObject();
|
g_autoptr(virJSONValue) model = virJSONValueNewObject();
|
||||||
size_t i;
|
size_t i;
|
||||||
@ -4929,7 +4930,7 @@ qemuMonitorJSONMakeCPUModel(virCPUDef *cpu,
|
|||||||
if (virJSONValueObjectAppendString(model, "name", cpu->model) < 0)
|
if (virJSONValueObjectAppendString(model, "name", cpu->model) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (cpu->nfeatures || !migratable) {
|
if (cpu->nfeatures || !migratable || hv_passthrough) {
|
||||||
g_autoptr(virJSONValue) props = virJSONValueNewObject();
|
g_autoptr(virJSONValue) props = virJSONValueNewObject();
|
||||||
|
|
||||||
for (i = 0; i < cpu->nfeatures; i++) {
|
for (i = 0; i < cpu->nfeatures; i++) {
|
||||||
@ -4951,6 +4952,11 @@ qemuMonitorJSONMakeCPUModel(virCPUDef *cpu,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hv_passthrough &&
|
||||||
|
virJSONValueObjectAppendBoolean(props, "hv-passthrough", true) < 0) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (virJSONValueObjectAppend(model, "props", &props) < 0)
|
if (virJSONValueObjectAppend(model, "props", &props) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -5079,7 +5085,7 @@ qemuMonitorJSONGetCPUModelExpansion(qemuMonitor *mon,
|
|||||||
|
|
||||||
*model_info = NULL;
|
*model_info = NULL;
|
||||||
|
|
||||||
if (!(model = qemuMonitorJSONMakeCPUModel(cpu, migratable)))
|
if (!(model = qemuMonitorJSONMakeCPUModel(cpu, migratable, false)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if ((rc = qemuMonitorJSONQueryCPUModelExpansionOne(mon, type, &model, &data)) <= 0)
|
if ((rc = qemuMonitorJSONQueryCPUModelExpansionOne(mon, type, &model, &data)) <= 0)
|
||||||
@ -5128,8 +5134,8 @@ qemuMonitorJSONGetCPUModelBaseline(qemuMonitor *mon,
|
|||||||
virJSONValue *cpu_props = NULL;
|
virJSONValue *cpu_props = NULL;
|
||||||
const char *cpu_name = "";
|
const char *cpu_name = "";
|
||||||
|
|
||||||
if (!(model_a = qemuMonitorJSONMakeCPUModel(cpu_a, true)) ||
|
if (!(model_a = qemuMonitorJSONMakeCPUModel(cpu_a, true, false)) ||
|
||||||
!(model_b = qemuMonitorJSONMakeCPUModel(cpu_b, true)))
|
!(model_b = qemuMonitorJSONMakeCPUModel(cpu_b, true, false)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (!(cmd = qemuMonitorJSONMakeCommand("query-cpu-model-baseline",
|
if (!(cmd = qemuMonitorJSONMakeCommand("query-cpu-model-baseline",
|
||||||
@ -5166,8 +5172,8 @@ qemuMonitorJSONGetCPUModelComparison(qemuMonitor *mon,
|
|||||||
const char *data_result;
|
const char *data_result;
|
||||||
virJSONValue *data;
|
virJSONValue *data;
|
||||||
|
|
||||||
if (!(model_a = qemuMonitorJSONMakeCPUModel(cpu_a, true)) ||
|
if (!(model_a = qemuMonitorJSONMakeCPUModel(cpu_a, true, false)) ||
|
||||||
!(model_b = qemuMonitorJSONMakeCPUModel(cpu_b, true)))
|
!(model_b = qemuMonitorJSONMakeCPUModel(cpu_b, true, false)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (!(cmd = qemuMonitorJSONMakeCommand("query-cpu-model-comparison",
|
if (!(cmd = qemuMonitorJSONMakeCommand("query-cpu-model-comparison",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user