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