mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
qemu: check if cpu model is supported before baselining
Check the provided CPU models against the CPU models known by the hypervisor before baselining and print an error if an unrecognized model is found. Signed-off-by: Collin Walling <walling@linux.ibm.com> Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
e2df0b488a
commit
c5ed1fdee2
@ -12417,7 +12417,8 @@ qemuConnectCPUModelBaseline(virQEMUCapsPtr qemuCaps,
|
||||
gid_t runGid,
|
||||
bool expand_features,
|
||||
virCPUDefPtr *cpus,
|
||||
int ncpus)
|
||||
int ncpus,
|
||||
virDomainCapsCPUModelsPtr cpuModels)
|
||||
{
|
||||
g_autoptr(qemuProcessQMP) proc = NULL;
|
||||
g_autoptr(virCPUDef) baseline = NULL;
|
||||
@ -12435,6 +12436,13 @@ qemuConnectCPUModelBaseline(virQEMUCapsPtr qemuCaps,
|
||||
_("no CPU model specified at index %zu"), i);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!virDomainCapsCPUModelsGet(cpuModels, cpus[i]->model)) {
|
||||
virReportError(VIR_ERR_INVALID_ARG,
|
||||
_("CPU model '%s' not supported by hypervisor"),
|
||||
cpus[i]->model);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(proc = qemuProcessQMPNew(virQEMUCapsGetBinary(qemuCaps),
|
||||
@ -12545,7 +12553,8 @@ qemuConnectBaselineHypervisorCPU(virConnectPtr conn,
|
||||
|
||||
if (!(cpu = qemuConnectCPUModelBaseline(qemuCaps, cfg->libDir,
|
||||
cfg->user, cfg->group,
|
||||
expand_features, cpus, ncpus)))
|
||||
expand_features, cpus, ncpus,
|
||||
cpuModels)))
|
||||
goto cleanup;
|
||||
} else {
|
||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
|
||||
|
Loading…
Reference in New Issue
Block a user