982648
From 712005bcf26190dc6fd1fe56283377987909cc4b Mon Sep 17 00:00:00 2001
982648
Message-Id: <712005bcf26190dc6fd1fe56283377987909cc4b@dist-git>
6d3351
From: John Ferlan <jferlan@redhat.com>
6d3351
Date: Thu, 9 Jul 2015 08:28:58 -0400
6d3351
Subject: [PATCH] RHEL: qemu: Add check for unpriv sgio for SCSI generic host
6d3351
 device
6d3351
6d3351
https://bugzilla.redhat.com/show_bug.cgi?id=1072736
6d3351
6d3351
RHEL-only
6d3351
6d3351
Check if the hostdev has set the sgio filtered/unfiltered and handle
6d3351
appropriately.
6d3351
6d3351
This restores functionality removed by upstream commit id 'ce346623'
6d3351
to remove sgio support for the SCSI generic host device.
6d3351
6d3351
Signed-off-by: John Ferlan <jferlan@redhat.com>
6d3351
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
6d3351
---
6d3351
 src/qemu/qemu_conf.c | 15 +++++++++++++++
6d3351
 1 file changed, 15 insertions(+)
6d3351
6d3351
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
982648
index 3ea9784854..7d15af9c0b 100644
6d3351
--- a/src/qemu/qemu_conf.c
6d3351
+++ b/src/qemu/qemu_conf.c
982648
@@ -1473,6 +1473,8 @@ qemuAddSharedHostdev(virQEMUDriverPtr driver,
6d3351
 {
6d3351
     char *dev_path = NULL;
6d3351
     char *key = NULL;
6d3351
+    virDomainHostdevSubsysSCSIPtr scsisrc = &hostdev->source.subsys.u.scsi;
6d3351
+    virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
6d3351
     int ret = -1;
6d3351
 
6d3351
     if (!qemuIsSharedHostdev(hostdev))
982648
@@ -1481,6 +1483,19 @@ qemuAddSharedHostdev(virQEMUDriverPtr driver,
6d3351
     if (!(dev_path = qemuGetHostdevPath(hostdev)))
6d3351
         goto cleanup;
6d3351
 
6d3351
+    if ((ret = qemuCheckUnprivSGIO(driver->sharedDevices, dev_path,
6d3351
+                                   scsisrc->sgio)) < 0) {
6d3351
+        if (ret == -2) {
6d3351
+            virReportError(VIR_ERR_OPERATION_INVALID,
6d3351
+                           _("sgio of shared scsi host device '%s-%u-%u-%llu' "
6d3351
+                             "conflicts with other active domains"),
6d3351
+                           scsihostsrc->adapter, scsihostsrc->bus,
6d3351
+                           scsihostsrc->target, scsihostsrc->unit);
6d3351
+            ret = -1;
6d3351
+        }
6d3351
+        goto cleanup;
6d3351
+    }
6d3351
+
6d3351
     if (!(key = qemuGetSharedDeviceKey(dev_path)))
6d3351
         goto cleanup;
6d3351
 
6d3351
-- 
982648
2.18.0
6d3351