render / rpms / libvirt

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