render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
Blob Blame History Raw
From e79d54ff8e760ac1a200a37fb05cc9aa758c48d3 Mon Sep 17 00:00:00 2001
Message-Id: <e79d54ff8e760ac1a200a37fb05cc9aa758c48d3@dist-git>
From: John Ferlan <jferlan@redhat.com>
Date: Mon, 17 Dec 2018 20:42:33 -0500
Subject: [PATCH] RHEL: qemu: Alter qemuSetUnprivSGIO hostdev shareable logic
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

https://bugzilla.redhat.com/show_bug.cgi?id=1656362 (RHEL8)
https://bugzilla.redhat.com/show_bug.cgi?id=1656360 (RHEL7)

RHEL-only

Fix the logic to handle the case where if the <shareable/> element
was removed from the domain <hostdev.../>, then we have to reset the
SGIO value back to 0. Without this patch the check for not shareable
and return 0 would bypass resetting the value back to 0.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
 src/qemu/qemu_conf.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index faabc4d49f..590052b035 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1844,9 +1844,6 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
     } else if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV) {
         hostdev = dev->data.hostdev;
 
-        if (!qemuIsSharedHostdev(hostdev))
-            return 0;
-
         if (!(hostdev_path = qemuGetHostdevPath(hostdev)))
             return -1;
 
@@ -1863,7 +1860,9 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
         disk->sgio == VIR_DOMAIN_DEVICE_SGIO_UNFILTERED) {
         val = 1;
     } else {
-        if (hostdev->source.subsys.u.scsi.sgio ==
+        /* Only settable if <shareable/> was present for hostdev */
+        if (qemuIsSharedHostdev(hostdev) &&
+            hostdev->source.subsys.u.scsi.sgio ==
             VIR_DOMAIN_DEVICE_SGIO_UNFILTERED)
             val = 1;
     }
-- 
2.25.0