Blob Blame History Raw
From 74528dbcdf9eeb970d88e25e6416a5918c31b803 Mon Sep 17 00:00:00 2001
Message-Id: <74528dbcdf9eeb970d88e25e6416a5918c31b803@dist-git>
From: Andrea Bolognani <abologna@redhat.com>
Date: Mon, 17 Jul 2017 12:09:07 +0200
Subject: [PATCH] qemu: Relax pci-root index requirement for pSeries guests

pSeries guests will soon be allowed to have multiple
PHBs (pci-root controllers), meaning the current check
on the controller index no longer applies to them.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Laine Stump <laine@laine.org>
(cherry picked from commit 591b42f39f1130a6adb13646226c23bd3b1a40dc)

Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1431193

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 src/qemu/qemu_domain.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 87a437eccf..4c3897ba4e 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -3378,9 +3378,13 @@ qemuDomainControllerDefPostParse(virDomainControllerDefPtr cont,
         break;
 
     case VIR_DOMAIN_CONTROLLER_TYPE_PCI:
-        if  ((cont->model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT ||
-              cont->model == VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT) &&
-             cont->idx != 0) {
+
+        /* pSeries guests can have multiple pci-root controllers,
+         * but other machine types only support a single one */
+        if (!qemuDomainIsPSeries(def) &&
+            (cont->model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT ||
+             cont->model == VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT) &&
+            cont->idx != 0) {
             virReportError(VIR_ERR_XML_ERROR, "%s",
                            _("pci-root and pcie-root controllers "
                              "should have index 0"));
-- 
2.13.3