d76c62
From e79d54ff8e760ac1a200a37fb05cc9aa758c48d3 Mon Sep 17 00:00:00 2001
d76c62
Message-Id: <e79d54ff8e760ac1a200a37fb05cc9aa758c48d3@dist-git>
d76c62
From: John Ferlan <jferlan@redhat.com>
d76c62
Date: Mon, 17 Dec 2018 20:42:33 -0500
d76c62
Subject: [PATCH] RHEL: qemu: Alter qemuSetUnprivSGIO hostdev shareable logic
d76c62
MIME-Version: 1.0
d76c62
Content-Type: text/plain; charset=UTF-8
d76c62
Content-Transfer-Encoding: 8bit
d76c62
d76c62
https://bugzilla.redhat.com/show_bug.cgi?id=1656362 (RHEL8)
d76c62
https://bugzilla.redhat.com/show_bug.cgi?id=1656360 (RHEL7)
d76c62
d76c62
RHEL-only
d76c62
d76c62
Fix the logic to handle the case where if the <shareable/> element
d76c62
was removed from the domain <hostdev.../>, then we have to reset the
d76c62
SGIO value back to 0. Without this patch the check for not shareable
d76c62
and return 0 would bypass resetting the value back to 0.
d76c62
d76c62
Signed-off-by: John Ferlan <jferlan@redhat.com>
d76c62
Reviewed-by: Ján Tomko <jtomko@redhat.com>
d76c62
---
d76c62
 src/qemu/qemu_conf.c | 7 +++----
d76c62
 1 file changed, 3 insertions(+), 4 deletions(-)
d76c62
d76c62
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
d76c62
index faabc4d49f..590052b035 100644
d76c62
--- a/src/qemu/qemu_conf.c
d76c62
+++ b/src/qemu/qemu_conf.c
d76c62
@@ -1844,9 +1844,6 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
d76c62
     } else if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV) {
d76c62
         hostdev = dev->data.hostdev;
d76c62
 
d76c62
-        if (!qemuIsSharedHostdev(hostdev))
d76c62
-            return 0;
d76c62
-
d76c62
         if (!(hostdev_path = qemuGetHostdevPath(hostdev)))
d76c62
             return -1;
d76c62
 
d76c62
@@ -1863,7 +1860,9 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
d76c62
         disk->sgio == VIR_DOMAIN_DEVICE_SGIO_UNFILTERED) {
d76c62
         val = 1;
d76c62
     } else {
d76c62
-        if (hostdev->source.subsys.u.scsi.sgio ==
d76c62
+        /* Only settable if <shareable/> was present for hostdev */
d76c62
+        if (qemuIsSharedHostdev(hostdev) &&
d76c62
+            hostdev->source.subsys.u.scsi.sgio ==
d76c62
             VIR_DOMAIN_DEVICE_SGIO_UNFILTERED)
d76c62
             val = 1;
d76c62
     }
d76c62
-- 
d76c62
2.25.0
d76c62