render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
c1c534
From aa370aac88baeea6a35558f3c22a9206cc667eb9 Mon Sep 17 00:00:00 2001
c1c534
Message-Id: <aa370aac88baeea6a35558f3c22a9206cc667eb9@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
c1c534
index f1c142efb6..4e5b33b788 100644
6d3351
--- a/src/qemu/qemu_conf.c
6d3351
+++ b/src/qemu/qemu_conf.c
c1c534
@@ -1410,6 +1410,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))
c1c534
@@ -1418,6 +1420,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
-- 
c1c534
2.14.3
6d3351