9c6c51
From 861a1a4d299c57f31fa091c6b74cddf80681bdf0 Mon Sep 17 00:00:00 2001
9c6c51
Message-Id: <861a1a4d299c57f31fa091c6b74cddf80681bdf0@dist-git>
9c6c51
From: John Ferlan <jferlan@redhat.com>
9c6c51
Date: Mon, 17 Dec 2018 20:42:33 -0500
9c6c51
Subject: [PATCH] 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
9c6c51
index de0cbca083..5971f3eb64 100644
9c6c51
--- a/src/qemu/qemu_conf.c
9c6c51
+++ b/src/qemu/qemu_conf.c
9c6c51
@@ -1667,9 +1667,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)))
9c6c51
             goto cleanup;
9c6c51
 
9c6c51
@@ -1686,7 +1683,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
-- 
9c6c51
2.20.1
9c6c51