render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
edecca
From c39257f41ccb22272c6161777bf71390676bf7f0 Mon Sep 17 00:00:00 2001
edecca
Message-Id: <c39257f41ccb22272c6161777bf71390676bf7f0@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
---
edecca
 src/qemu/qemu_conf.c | 15 +++++++++++++++
edecca
 1 file changed, 15 insertions(+)
edecca
edecca
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
edecca
index 3ea9784854..7d15af9c0b 100644
edecca
--- a/src/qemu/qemu_conf.c
edecca
+++ b/src/qemu/qemu_conf.c
edecca
@@ -1473,6 +1473,8 @@ qemuAddSharedHostdev(virQEMUDriverPtr driver,
edecca
 {
edecca
     char *dev_path = NULL;
edecca
     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))
edecca
@@ -1481,6 +1483,19 @@ qemuAddSharedHostdev(virQEMUDriverPtr driver,
edecca
     if (!(dev_path = qemuGetHostdevPath(hostdev)))
edecca
         goto cleanup;
edecca
 
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
+            ret = -1;
edecca
+        }
edecca
+        goto cleanup;
edecca
+    }
edecca
+
edecca
     if (!(key = qemuGetSharedDeviceKey(dev_path)))
edecca
         goto cleanup;
edecca
 
edecca
-- 
edecca
2.20.1
edecca