render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
aa5bf2
From c7881fb84209f897f2bd92e13ba4942ba24a87a6 Mon Sep 17 00:00:00 2001
aa5bf2
Message-Id: <c7881fb84209f897f2bd92e13ba4942ba24a87a6@dist-git>
d76c62
From: John Ferlan <jferlan@redhat.com>
d76c62
Date: Mon, 17 Dec 2018 20:42:31 -0500
d76c62
Subject: [PATCH] RHEL: qemu: Add check for unpriv sgio for SCSI generic host
d76c62
 device
d76c62
MIME-Version: 1.0
d76c62
Content-Type: text/plain; charset=UTF-8
d76c62
Content-Transfer-Encoding: 8bit
d76c62
d76c62
https://bugzilla.redhat.com/show_bug.cgi?id=1582424
d76c62
d76c62
RHEL-only
d76c62
d76c62
Check if the hostdev has set the sgio filtered/unfiltered and handle
d76c62
appropriately.
d76c62
d76c62
This restores functionality removed by upstream commit id 'ce346623'
d76c62
to remove sgio support for the SCSI generic host device.
d76c62
d76c62
Signed-off-by: John Ferlan <jferlan@redhat.com>
9de337
Signed-off-by: Ján Tomko <jtomko@redhat.com>
d76c62
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
d76c62
---
d76c62
 src/qemu/qemu_conf.c | 20 ++++++++++++++++++--
d76c62
 1 file changed, 18 insertions(+), 2 deletions(-)
d76c62
d76c62
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
9de337
index a749fc1bbc..2beef89cd1 100644
d76c62
--- a/src/qemu/qemu_conf.c
d76c62
+++ b/src/qemu/qemu_conf.c
9de337
@@ -1743,13 +1743,29 @@ qemuSharedHostdevAddRemoveInternal(virQEMUDriver *driver,
d76c62
 {
d76c62
     g_autofree char *dev_path = NULL;
d76c62
     g_autofree char *key = NULL;
9de337
+    virDomainHostdevSubsysSCSI *scsisrc = &hostdev->source.subsys.u.scsi;
9de337
+    virDomainHostdevSubsysSCSIHost *scsihostsrc = &scsisrc->u.host;
d76c62
     int ret = -1;
d76c62
 
d76c62
     if (!qemuIsSharedHostdev(hostdev))
d76c62
         return 0;
d76c62
 
d76c62
-    if (!(dev_path = qemuGetHostdevPath(hostdev)) ||
d76c62
-        !(key = qemuGetSharedDeviceKey(dev_path)))
d76c62
+    if (!(dev_path = qemuGetHostdevPath(hostdev)))
d76c62
+        return -1;
d76c62
+
d76c62
+    if ((ret = qemuCheckUnprivSGIO(driver->sharedDevices, dev_path,
d76c62
+                                   scsisrc->sgio)) < 0) {
d76c62
+        if (ret == -2) {
d76c62
+            virReportError(VIR_ERR_OPERATION_INVALID,
d76c62
+                           _("sgio of shared scsi host device '%s-%u-%u-%llu' "
d76c62
+                             "conflicts with other active domains"),
d76c62
+                           scsihostsrc->adapter, scsihostsrc->bus,
d76c62
+                           scsihostsrc->target, scsihostsrc->unit);
d76c62
+        }
d76c62
+        return -1;
d76c62
+    }
d76c62
+
d76c62
+    if (!(key = qemuGetSharedDeviceKey(dev_path)))
d76c62
         return -1;
d76c62
 
d76c62
     qemuDriverLock(driver);
d76c62
-- 
aa5bf2
2.33.0
d76c62