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