render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
a41c76
From 5a192657ad4e08fc773fef90c6b07df3620fa1c2 Mon Sep 17 00:00:00 2001
a41c76
Message-Id: <5a192657ad4e08fc773fef90c6b07df3620fa1c2@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>
edecca
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
edecca
(cherry picked from commit 712005bcf26190dc6fd1fe56283377987909cc4b)
edecca
Reviewed-by: Ján Tomko <jtomko@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
a41c76
index ce7869e6be..2a84972fd9 100644
edecca
--- a/src/qemu/qemu_conf.c
edecca
+++ b/src/qemu/qemu_conf.c
a41c76
@@ -1717,13 +1717,29 @@ qemuSharedHostdevAddRemoveInternal(virQEMUDriverPtr driver,
edecca
 {
a41c76
     g_autofree char *dev_path = NULL;
a41c76
     g_autofree char *key = NULL;
edecca
+    virDomainHostdevSubsysSCSIPtr scsisrc = &hostdev->source.subsys.u.scsi;
edecca
+    virDomainHostdevSubsysSCSIHostPtr 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
-- 
a41c76
2.25.0
edecca