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