1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-04-01 20:05:19 +00:00

qemu: capabilities: Make virHostCPUGetKVMMaxVCPUs() errors fatal

An error in virHostCPUGetKVMMaxVCPUs() means we've been unable
to access /dev/kvm, or we're running on a platform that doesn't
support KVM in the first place.

If that's the case, we shouldn't ignore the error and report
domcapabilities even though we know the user won't be able to
start any KVM guest.
This commit is contained in:
Andrea Bolognani 2016-06-27 13:53:43 +02:00
parent 1addfa3300
commit 4074a82c0c

View File

@ -4347,9 +4347,12 @@ virQEMUCapsFillDomainCaps(virDomainCapsPtr domCaps,
domCaps->maxvcpus = virQEMUCapsGetMachineMaxCpus(qemuCaps,
domCaps->machine);
if (domCaps->virttype == VIR_DOMAIN_VIRT_KVM) {
int hostmaxvcpus = virHostCPUGetKVMMaxVCPUs();
if (hostmaxvcpus >= 0)
domCaps->maxvcpus = MIN(domCaps->maxvcpus, hostmaxvcpus);
int hostmaxvcpus;
if ((hostmaxvcpus = virHostCPUGetKVMMaxVCPUs()) < 0)
return -1;
domCaps->maxvcpus = MIN(domCaps->maxvcpus, hostmaxvcpus);
}
if (virQEMUCapsFillDomainOSCaps(os, firmwares, nfirmwares) < 0 ||