Blame SOURCES/libvirt-virQEMUCapsHasPCIMultiBus-assume-true-if-we-have-no-version-information.patch

c1c534
From 7bac1e059259bee2f00d6e363dad32ca2c2decb6 Mon Sep 17 00:00:00 2001
c1c534
Message-Id: <7bac1e059259bee2f00d6e363dad32ca2c2decb6@dist-git>
c1c534
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
c1c534
Date: Thu, 30 Nov 2017 17:46:00 +0100
c1c534
Subject: [PATCH] virQEMUCapsHasPCIMultiBus: assume true if we have no version
c1c534
 information
c1c534
MIME-Version: 1.0
c1c534
Content-Type: text/plain; charset=UTF-8
c1c534
Content-Transfer-Encoding: 8bit
c1c534
c1c534
In status XML, we do not store the QEMU version information, we only
c1c534
format all the capabilities. We dropped QEMU_CAPS_PCI_MULTIBUS
c1c534
in commit 5b783379 which was released in libvirt 3.2.0.
c1c534
c1c534
Therefore the only way of telling if the already running domain
c1c534
at the time of daemon restart has been started with a QEMU that does
c1c534
use 'pci.0' or not on PPC is to look at the pci-root controller's
c1c534
alias. This is not an option if the domain has a user-specified alias
c1c534
for the pci-root.
c1c534
c1c534
Instead of reintroducing the capability, assume 'pci.0' when we have
c1c534
no version information. That way the only left broken use case would
c1c534
be the combination of user aliases and very old QEMU.
c1c534
c1c534
Partially reverts commit 3a37af1e4.
c1c534
c1c534
https://bugzilla.redhat.com/show_bug.cgi?id=1518148
c1c534
(cherry picked from commit 65108d94d093de082dc5a2d4a73844dd569506db)
c1c534
Signed-off-by: Ján Tomko <jtomko@redhat.com>
c1c534
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
c1c534
---
c1c534
 src/qemu/qemu_capabilities.c | 16 ++++++++--------
c1c534
 src/qemu/qemu_capspriv.h     |  4 ----
c1c534
 tests/qemuxml2argvtest.c     |  5 -----
c1c534
 3 files changed, 8 insertions(+), 17 deletions(-)
c1c534
c1c534
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
c1c534
index 81f7e4e440..13ff1286c4 100644
c1c534
--- a/src/qemu/qemu_capabilities.c
c1c534
+++ b/src/qemu/qemu_capabilities.c
c1c534
@@ -2435,6 +2435,14 @@ bool virQEMUCapsHasPCIMultiBus(virQEMUCapsPtr qemuCaps,
c1c534
          *     ppce500: 1.6.0
c1c534
          */
c1c534
 
c1c534
+        /* We do not store the qemu version in domain status XML.
c1c534
+         * Hope the user is using a QEMU new enough to use 'pci.0',
c1c534
+         * otherwise the results of this function will be wrong
c1c534
+         * for domains already running at the time of daemon
c1c534
+         * restart */
c1c534
+        if (qemuCaps->version == 0)
c1c534
+            return true;
c1c534
+
c1c534
         if (qemuCaps->version >= 2000000)
c1c534
             return true;
c1c534
 
c1c534
@@ -2486,14 +2494,6 @@ virArch virQEMUCapsGetArch(virQEMUCapsPtr qemuCaps)
c1c534
 }
c1c534
 
c1c534
 
c1c534
-void
c1c534
-virQEMUCapsSetVersion(virQEMUCapsPtr qemuCaps,
c1c534
-                      unsigned int version)
c1c534
-{
c1c534
-    qemuCaps->version = version;
c1c534
-}
c1c534
-
c1c534
-
c1c534
 unsigned int virQEMUCapsGetVersion(virQEMUCapsPtr qemuCaps)
c1c534
 {
c1c534
     return qemuCaps->version;
c1c534
diff --git a/src/qemu/qemu_capspriv.h b/src/qemu/qemu_capspriv.h
c1c534
index f23995ec6e..219daa3629 100644
c1c534
--- a/src/qemu/qemu_capspriv.h
c1c534
+++ b/src/qemu/qemu_capspriv.h
c1c534
@@ -55,10 +55,6 @@ void
c1c534
 virQEMUCapsSetArch(virQEMUCapsPtr qemuCaps,
c1c534
                    virArch arch);
c1c534
 
c1c534
-void
c1c534
-virQEMUCapsSetVersion(virQEMUCapsPtr qemuCaps,
c1c534
-                      unsigned int version);
c1c534
-
c1c534
 void
c1c534
 virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps,
c1c534
                             virArch hostArch,
c1c534
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
c1c534
index 72cefe4906..686a63855c 100644
c1c534
--- a/tests/qemuxml2argvtest.c
c1c534
+++ b/tests/qemuxml2argvtest.c
c1c534
@@ -384,11 +384,6 @@ testUpdateQEMUCaps(const struct testInfo *info,
c1c534
 
c1c534
     virQEMUCapsInitQMPBasicArch(info->qemuCaps);
c1c534
 
c1c534
-    /* We need to pretend QEMU 2.0.0 is in use so that pSeries guests
c1c534
-     * will get the correct alias assigned to their buses.
c1c534
-     * See virQEMUCapsHasPCIMultiBus() */
c1c534
-    virQEMUCapsSetVersion(info->qemuCaps, 2000000);
c1c534
-
c1c534
     if (testAddCPUModels(info->qemuCaps, info->skipLegacyCPUs) < 0)
c1c534
         goto cleanup;
c1c534
 
c1c534
-- 
c1c534
2.15.1
c1c534