render / rpms / libvirt

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