render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
76f597
From d43807caf54d1ded1d79f5338ad63e4af9af3ca3 Mon Sep 17 00:00:00 2001
76f597
Message-Id: <d43807caf54d1ded1d79f5338ad63e4af9af3ca3@dist-git>
d76c62
From: John Ferlan <jferlan@redhat.com>
d76c62
Date: Mon, 17 Dec 2018 20:42:31 -0500
d76c62
Subject: [PATCH] RHEL: qemu: Add check for unpriv sgio for SCSI generic host
d76c62
 device
d76c62
MIME-Version: 1.0
d76c62
Content-Type: text/plain; charset=UTF-8
d76c62
Content-Transfer-Encoding: 8bit
d76c62
d76c62
https://bugzilla.redhat.com/show_bug.cgi?id=1582424
d76c62
d76c62
RHEL-only
d76c62
d76c62
Check if the hostdev has set the sgio filtered/unfiltered and handle
d76c62
appropriately.
d76c62
d76c62
This restores functionality removed by upstream commit id 'ce346623'
d76c62
to remove sgio support for the SCSI generic host device.
d76c62
d76c62
Signed-off-by: John Ferlan <jferlan@redhat.com>
9de337
Signed-off-by: Ján Tomko <jtomko@redhat.com>
d76c62
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
d76c62
---
d76c62
 src/qemu/qemu_conf.c | 20 ++++++++++++++++++--
d76c62
 1 file changed, 18 insertions(+), 2 deletions(-)
d76c62
d76c62
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
76f597
index 3fee5fe687..12afed8aa2 100644
d76c62
--- a/src/qemu/qemu_conf.c
d76c62
+++ b/src/qemu/qemu_conf.c
9de337
@@ -1743,13 +1743,29 @@ qemuSharedHostdevAddRemoveInternal(virQEMUDriver *driver,
d76c62
 {
d76c62
     g_autofree char *dev_path = NULL;
d76c62
     g_autofree char *key = NULL;
9de337
+    virDomainHostdevSubsysSCSI *scsisrc = &hostdev->source.subsys.u.scsi;
9de337
+    virDomainHostdevSubsysSCSIHost *scsihostsrc = &scsisrc->u.host;
d76c62
     int ret = -1;
d76c62
 
d76c62
     if (!qemuIsSharedHostdev(hostdev))
d76c62
         return 0;
d76c62
 
d76c62
-    if (!(dev_path = qemuGetHostdevPath(hostdev)) ||
d76c62
-        !(key = qemuGetSharedDeviceKey(dev_path)))
d76c62
+    if (!(dev_path = qemuGetHostdevPath(hostdev)))
d76c62
+        return -1;
d76c62
+
d76c62
+    if ((ret = qemuCheckUnprivSGIO(driver->sharedDevices, dev_path,
d76c62
+                                   scsisrc->sgio)) < 0) {
d76c62
+        if (ret == -2) {
d76c62
+            virReportError(VIR_ERR_OPERATION_INVALID,
d76c62
+                           _("sgio of shared scsi host device '%s-%u-%u-%llu' "
d76c62
+                             "conflicts with other active domains"),
d76c62
+                           scsihostsrc->adapter, scsihostsrc->bus,
d76c62
+                           scsihostsrc->target, scsihostsrc->unit);
d76c62
+        }
d76c62
+        return -1;
d76c62
+    }
d76c62
+
d76c62
+    if (!(key = qemuGetSharedDeviceKey(dev_path)))
d76c62
         return -1;
d76c62
 
d76c62
     qemuDriverLock(driver);
d76c62
-- 
76f597
2.33.1
d76c62