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