[PATCH REPOST 3/3] qemu: capabilities: Make virHostCPUGetKVMMaxVCPUs() errors fatal

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
---
 src/qemu/qemu_capabilities.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index c8d8a54..3ad71a2 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -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 ||
-- 
2.7.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]