Blame SOURCES/libvirt-RHEL-qemu-Add-check-for-unpriv-sgio-for-SCSI-generic-host-device.patch

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