提交 cd51b90f 编写于 作者: J Jiri Denemark

qemu: Don't return unusable virttype in domain capabilities

If a user asked for a KVM domain capabilities when KVM is not available,
we would happily return data we got when probing through TCG and
pretended they were relevant for KVM. Let's just report KVM is not
supported to avoid confusion.
Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
上级 8f55eef2
......@@ -18719,6 +18719,7 @@ qemuConnectGetDomainCapabilities(virConnectPtr conn,
virQEMUDriverPtr driver = conn->privateData;
virQEMUCapsPtr qemuCaps = NULL;
int virttype = VIR_DOMAIN_VIRT_NONE;
virDomainVirtType capsType;
virDomainCapsPtr domCaps = NULL;
int arch = virArchFromHost(); /* virArch */
virQEMUDriverConfigPtr cfg = NULL;
......@@ -18797,11 +18798,19 @@ qemuConnectGetDomainCapabilities(virConnectPtr conn,
machine = virQEMUCapsGetDefaultMachine(qemuCaps);
}
if (virttype == VIR_DOMAIN_VIRT_NONE) {
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM))
virttype = VIR_DOMAIN_VIRT_KVM;
capsType = VIR_DOMAIN_VIRT_KVM;
else
virttype = VIR_DOMAIN_VIRT_QEMU;
capsType = VIR_DOMAIN_VIRT_QEMU;
if (virttype == VIR_DOMAIN_VIRT_NONE)
virttype = capsType;
if (virttype == VIR_DOMAIN_VIRT_KVM && capsType == VIR_DOMAIN_VIRT_QEMU) {
virReportError(VIR_ERR_INVALID_ARG,
_("KVM is not supported by '%s' on this host"),
emulatorbin);
goto cleanup;
}
if (!(domCaps = virDomainCapsNew(emulatorbin, machine, arch, virttype)))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册