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