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