]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Do not fail virConnectCompareCPU if host CPU is not known
authorJiri Denemark <jdenemar@redhat.com>
Thu, 12 Jul 2012 09:49:15 +0000 (11:49 +0200)
committerCole Robinson <crobinso@redhat.com>
Sun, 12 Aug 2012 23:23:51 +0000 (19:23 -0400)
When host CPU could not be properly detected, virConnectCompareCPU will
just report that any CPU is incompatible with host CPU instead of
failing.
(cherry picked from commit 87c8623161f19c4f37844991deb1477e53c2b310)

src/qemu/qemu_driver.c

index 72a91d693f866b5c25e91abc485b9c31bacdcc88..0286e16562e1800c8ee52510c7494ae573acda51 100644 (file)
@@ -9322,9 +9322,12 @@ qemuCPUCompare(virConnectPtr conn,
 
     qemuDriverLock(driver);
 
-    if (!driver->caps || !driver->caps->host.cpu) {
-        qemuReportError(VIR_ERR_OPERATION_INVALID,
-                        "%s", _("cannot get host CPU capabilities"));
+    if (!driver->caps) {
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        "%s", _("cannot get host capabilities"));
+    } else if (!driver->caps->host.cpu) {
+        VIR_WARN("cannot get host CPU capabilities");
+        ret = VIR_CPU_COMPARE_INCOMPATIBLE;
     } else {
         ret = cpuCompareXML(driver->caps->host.cpu, xmlDesc);
     }