Blame SOURCES/libvirt-RHEL-qemu-Add-check-for-unpriv-sgio-for-SCSI-generic-host-device.patch

9c6c51
From c39257f41ccb22272c6161777bf71390676bf7f0 Mon Sep 17 00:00:00 2001
9c6c51
Message-Id: <c39257f41ccb22272c6161777bf71390676bf7f0@dist-git>
9c6c51
From: John Ferlan <jferlan@redhat.com>
9c6c51
Date: Mon, 17 Dec 2018 20:42:31 -0500
9c6c51
Subject: [PATCH] RHEL: qemu: Add check for unpriv sgio for SCSI generic host
9c6c51
 device
9c6c51
MIME-Version: 1.0
9c6c51
Content-Type: text/plain; charset=UTF-8
9c6c51
Content-Transfer-Encoding: 8bit
9c6c51
9c6c51
https://bugzilla.redhat.com/show_bug.cgi?id=1582424
9c6c51
9c6c51
RHEL-only
9c6c51
9c6c51
Check if the hostdev has set the sgio filtered/unfiltered and handle
9c6c51
appropriately.
9c6c51
9c6c51
This restores functionality removed by upstream commit id 'ce346623'
9c6c51
to remove sgio support for the SCSI generic host device.
9c6c51
9c6c51
Signed-off-by: John Ferlan <jferlan@redhat.com>
9c6c51
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9c6c51
(cherry picked from commit 712005bcf26190dc6fd1fe56283377987909cc4b)
9c6c51
Reviewed-by: Ján Tomko <jtomko@redhat.com>
9c6c51
---
9c6c51
 src/qemu/qemu_conf.c | 15 +++++++++++++++
9c6c51
 1 file changed, 15 insertions(+)
9c6c51
9c6c51
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
9c6c51
index 3ea9784854..7d15af9c0b 100644
9c6c51
--- a/src/qemu/qemu_conf.c
9c6c51
+++ b/src/qemu/qemu_conf.c
9c6c51
@@ -1473,6 +1473,8 @@ qemuAddSharedHostdev(virQEMUDriverPtr driver,
9c6c51
 {
9c6c51
     char *dev_path = NULL;
9c6c51
     char *key = NULL;
9c6c51
+    virDomainHostdevSubsysSCSIPtr scsisrc = &hostdev->source.subsys.u.scsi;
9c6c51
+    virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
9c6c51
     int ret = -1;
9c6c51
 
9c6c51
     if (!qemuIsSharedHostdev(hostdev))
9c6c51
@@ -1481,6 +1483,19 @@ qemuAddSharedHostdev(virQEMUDriverPtr driver,
9c6c51
     if (!(dev_path = qemuGetHostdevPath(hostdev)))
9c6c51
         goto cleanup;
9c6c51
 
9c6c51
+    if ((ret = qemuCheckUnprivSGIO(driver->sharedDevices, dev_path,
9c6c51
+                                   scsisrc->sgio)) < 0) {
9c6c51
+        if (ret == -2) {
9c6c51
+            virReportError(VIR_ERR_OPERATION_INVALID,
9c6c51
+                           _("sgio of shared scsi host device '%s-%u-%u-%llu' "
9c6c51
+                             "conflicts with other active domains"),
9c6c51
+                           scsihostsrc->adapter, scsihostsrc->bus,
9c6c51
+                           scsihostsrc->target, scsihostsrc->unit);
9c6c51
+            ret = -1;
9c6c51
+        }
9c6c51
+        goto cleanup;
9c6c51
+    }
9c6c51
+
9c6c51
     if (!(key = qemuGetSharedDeviceKey(dev_path)))
9c6c51
         goto cleanup;
9c6c51
 
9c6c51
-- 
9c6c51
2.20.1
9c6c51