6d3351
From e2bf7a17d464c989378278c3121425e7b90442e3 Mon Sep 17 00:00:00 2001
6d3351
Message-Id: <e2bf7a17d464c989378278c3121425e7b90442e3@dist-git>
6d3351
From: Andrea Bolognani <abologna@redhat.com>
6d3351
Date: Mon, 21 Aug 2017 14:46:39 +0200
6d3351
Subject: [PATCH] conf: Use the correct limit for the number of PHBs
6d3351
6d3351
I mistakenly thought pSeries guests supported 32 PHBs,
6d3351
but it turns out they only support 31. Validate the
6d3351
target index accordingly.
6d3351
6d3351
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1479647
6d3351
6d3351
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6d3351
(cherry picked from commit 64357c3f9373127aa8bdf5a829df4a9d895e1ef9)
6d3351
6d3351
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1479647
6d3351
6d3351
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6d3351
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
6d3351
---
6d3351
 src/conf/domain_conf.c                                              | 4 ++--
6d3351
 .../qemuxml2argv-pseries-phb-invalid-target-index-3.xml             | 6 +++---
6d3351
 2 files changed, 5 insertions(+), 5 deletions(-)
6d3351
6d3351
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
6d3351
index 7889f5335c..3d38f668fa 100644
6d3351
--- a/src/conf/domain_conf.c
6d3351
+++ b/src/conf/domain_conf.c
6d3351
@@ -5058,10 +5058,10 @@ virDomainControllerDefValidate(const virDomainControllerDef *controller)
6d3351
         /* Only validate the target index if it's been set */
6d3351
         if (opts->targetIndex != -1) {
6d3351
 
6d3351
-            if (opts->targetIndex < 0 || opts->targetIndex > 31) {
6d3351
+            if (opts->targetIndex < 0 || opts->targetIndex > 30) {
6d3351
                 virReportError(VIR_ERR_XML_ERROR,
6d3351
                                _("PCI controller target index '%d' out of "
6d3351
-                                 "range - must be 0-31"),
6d3351
+                                 "range - must be 0-30"),
6d3351
                                opts->targetIndex);
6d3351
                 return -1;
6d3351
             }
6d3351
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-invalid-target-index-3.xml b/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-invalid-target-index-3.xml
6d3351
index 864c5d8758..3d99da4995 100644
6d3351
--- a/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-invalid-target-index-3.xml
6d3351
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-invalid-target-index-3.xml
6d3351
@@ -8,10 +8,10 @@
6d3351
   </os>
6d3351
   <devices>
6d3351
     <emulator>/usr/bin/qemu-system-ppc64</emulator>
6d3351
-    
6d3351
-         so attempting to use target index 32 should fail -->
6d3351
+    
6d3351
+         so attempting to use target index 31 should fail -->
6d3351
     <controller type='pci' model='pci-root'>
6d3351
-      <target index='32'/>
6d3351
+      <target index='31'/>
6d3351
     </controller>
6d3351
     <controller type='usb' model='none'/>
6d3351
     <memballoon model='none'/>
6d3351
-- 
6d3351
2.14.1
6d3351