From 861a1a4d299c57f31fa091c6b74cddf80681bdf0 Mon Sep 17 00:00:00 2001 Message-Id: <861a1a4d299c57f31fa091c6b74cddf80681bdf0@dist-git> From: John Ferlan Date: Mon, 17 Dec 2018 20:42:33 -0500 Subject: [PATCH] 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=1656362 (RHEL8) https://bugzilla.redhat.com/show_bug.cgi?id=1656360 (RHEL7) RHEL-only Fix the logic to handle the case where if the element was removed from the domain , 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 Reviewed-by: Ján Tomko --- 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 was present for hostdev */ + if (qemuIsSharedHostdev(hostdev) && + hostdev->source.subsys.u.scsi.sgio == VIR_DOMAIN_DEVICE_SGIO_UNFILTERED) val = 1; } -- 2.20.1