render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
edecca
From 9743e1100067451a20fe1373c1d3b828f416320b Mon Sep 17 00:00:00 2001
edecca
Message-Id: <9743e1100067451a20fe1373c1d3b828f416320b@dist-git>
edecca
From: Erik Skultety <eskultet@redhat.com>
edecca
Date: Thu, 19 Jul 2018 15:03:50 +0200
edecca
Subject: [PATCH] qemu: address: Handle all the video devices within a single
edecca
 loop
edecca
MIME-Version: 1.0
edecca
Content-Type: text/plain; charset=UTF-8
edecca
Content-Transfer-Encoding: 8bit
edecca
edecca
Since 133fb140 moved the validation of a video device into a separate
edecca
function, the code handling PCI slot assignment for video devices has
edecca
been the same for both the primary device and the secondary devices.
edecca
Let's merge these and thus handle all the devices within the existing
edecca
'for' loop.
edecca
edecca
Signed-off-by: Erik Skultety <eskultet@redhat.com>
edecca
Reviewed-by: John Ferlan <jferlan@redhat.com>
edecca
(cherry picked from commit 3e90bd67a215adcb997b8c2be5d1d6b83251409f)
edecca
edecca
https://bugzilla.redhat.com/show_bug.cgi?id=1475770
edecca
Signed-off-by: Erik Skultety <eskultet@redhat.com>
edecca
Reviewed-by: Ján Tomko <jtomko@redhat.com>
edecca
---
edecca
 src/qemu/qemu_domain_address.c | 10 ++--------
edecca
 1 file changed, 2 insertions(+), 8 deletions(-)
edecca
edecca
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
edecca
index e9f460d77a..ab2ac022f1 100644
edecca
--- a/src/qemu/qemu_domain_address.c
edecca
+++ b/src/qemu/qemu_domain_address.c
edecca
@@ -2103,15 +2103,9 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
edecca
             goto error;
edecca
     }
edecca
 
edecca
-    /* Assign a PCI slot to the primary video card if there is not an
edecca
-     * assigned address. */
edecca
-    if (def->nvideos > 0 &&
edecca
-        virDeviceInfoPCIAddressWanted(&def->videos[0]->info)) {
edecca
-        if (qemuDomainPCIAddressReserveNextAddr(addrs, &def->videos[0]->info) < 0)
edecca
-            goto error;
edecca
-    }
edecca
+    /* Video devices */
edecca
+    for (i = 0; i < def->nvideos; i++) {
edecca
 
edecca
-    for (i = 1; i < def->nvideos; i++) {
edecca
         if (!virDeviceInfoPCIAddressWanted(&def->videos[i]->info))
edecca
             continue;
edecca
 
edecca
-- 
edecca
2.18.0
edecca