mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
qemu: Refactor qemuProcessVerifyGuestCPU
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
af1ca85545
commit
cfeee3373b
@ -3839,50 +3839,44 @@ qemuProcessVerifyCPUFeatures(virDomainDefPtr def,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool
|
static int
|
||||||
qemuProcessVerifyGuestCPU(virQEMUDriverPtr driver,
|
qemuProcessVerifyGuestCPU(virQEMUDriverPtr driver,
|
||||||
virDomainObjPtr vm,
|
virDomainObjPtr vm,
|
||||||
int asyncJob)
|
qemuDomainAsyncJob asyncJob)
|
||||||
{
|
{
|
||||||
virDomainDefPtr def = vm->def;
|
virDomainDefPtr def = vm->def;
|
||||||
virArch arch = def->os.arch;
|
virCPUDataPtr cpu = NULL;
|
||||||
virCPUDataPtr guestcpu = NULL;
|
|
||||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||||
int rc;
|
int rc;
|
||||||
bool ret = false;
|
int ret = -1;
|
||||||
|
|
||||||
switch (arch) {
|
if (ARCH_IS_X86(def->os.arch)) {
|
||||||
case VIR_ARCH_I686:
|
|
||||||
case VIR_ARCH_X86_64:
|
|
||||||
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
|
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
|
||||||
return false;
|
goto cleanup;
|
||||||
rc = qemuMonitorGetGuestCPU(priv->mon, arch, &guestcpu);
|
|
||||||
|
rc = qemuMonitorGetGuestCPU(priv->mon, def->os.arch, &cpu);
|
||||||
|
|
||||||
if (qemuDomainObjExitMonitor(driver, vm) < 0)
|
if (qemuDomainObjExitMonitor(driver, vm) < 0)
|
||||||
return false;
|
goto cleanup;
|
||||||
|
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
if (rc == -2)
|
if (rc == -2)
|
||||||
break;
|
ret = 0;
|
||||||
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qemuProcessVerifyKVMFeatures(def, guestcpu) < 0 ||
|
if (qemuProcessVerifyKVMFeatures(def, cpu) < 0 ||
|
||||||
qemuProcessVerifyHypervFeatures(def, guestcpu) < 0)
|
qemuProcessVerifyHypervFeatures(def, cpu) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (qemuProcessVerifyCPUFeatures(def, guestcpu) < 0)
|
if (qemuProcessVerifyCPUFeatures(def, cpu) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = true;
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virCPUDataFree(guestcpu);
|
virCPUDataFree(cpu);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5727,7 +5721,7 @@ qemuProcessLaunch(virConnectPtr conn,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
VIR_DEBUG("Detecting if required emulator features are present");
|
VIR_DEBUG("Detecting if required emulator features are present");
|
||||||
if (!qemuProcessVerifyGuestCPU(driver, vm, asyncJob))
|
if (qemuProcessVerifyGuestCPU(driver, vm, asyncJob) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
VIR_DEBUG("Setting up post-init cgroup restrictions");
|
VIR_DEBUG("Setting up post-init cgroup restrictions");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user