mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-25 10:03:49 +03:00
qemu: Add qemuProcessVerifyCPU
Separated from qemuProcessUpdateLiveGuestCPU. The function makes sure a guest CPU provides all features required by a domain definition. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
40d246a22b
commit
5cac2fe108
@ -3974,6 +3974,31 @@ qemuProcessFetchGuestCPU(virQEMUDriverPtr driver,
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuProcessVerifyCPU(virDomainObjPtr vm,
|
||||
virCPUDataPtr cpu)
|
||||
{
|
||||
virDomainDefPtr def = vm->def;
|
||||
|
||||
if (!cpu)
|
||||
return 0;
|
||||
|
||||
if (qemuProcessVerifyKVMFeatures(def, cpu) < 0 ||
|
||||
qemuProcessVerifyHypervFeatures(def, cpu) < 0)
|
||||
return -1;
|
||||
|
||||
if (!def->cpu ||
|
||||
(def->cpu->mode == VIR_CPU_MODE_CUSTOM &&
|
||||
!def->cpu->model))
|
||||
return 0;
|
||||
|
||||
if (qemuProcessVerifyCPUFeatures(def, cpu) < 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuProcessUpdateLiveGuestCPU(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
@ -3990,11 +4015,10 @@ qemuProcessUpdateLiveGuestCPU(virQEMUDriverPtr driver,
|
||||
if (qemuProcessFetchGuestCPU(driver, vm, asyncJob, &cpu, &disabled) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (cpu) {
|
||||
if (qemuProcessVerifyKVMFeatures(def, cpu) < 0 ||
|
||||
qemuProcessVerifyHypervFeatures(def, cpu) < 0)
|
||||
goto cleanup;
|
||||
if (qemuProcessVerifyCPU(vm, cpu) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (cpu) {
|
||||
if (!def->cpu ||
|
||||
(def->cpu->mode == VIR_CPU_MODE_CUSTOM &&
|
||||
!def->cpu->model)) {
|
||||
@ -4002,9 +4026,6 @@ qemuProcessUpdateLiveGuestCPU(virQEMUDriverPtr driver,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (qemuProcessVerifyCPUFeatures(def, cpu) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (!(orig = virCPUDefCopy(def->cpu)))
|
||||
goto cleanup;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user