2022-05-10 07:04:06 +00:00
|
|
|
From d6956a1aaa8757fab60132c3ee46c2bb199a78a8 Mon Sep 17 00:00:00 2001
|
|
|
|
Message-Id: <d6956a1aaa8757fab60132c3ee46c2bb199a78a8@dist-git>
|
2020-04-28 09:33:33 +00:00
|
|
|
From: John Ferlan <jferlan@redhat.com>
|
|
|
|
Date: Mon, 17 Dec 2018 20:42:30 -0500
|
|
|
|
Subject: [PATCH] RHEL: qemu: Add ability to set sgio values for hostdev
|
|
|
|
MIME-Version: 1.0
|
|
|
|
Content-Type: text/plain; charset=UTF-8
|
|
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
|
|
|
|
https://bugzilla.redhat.com/show_bug.cgi?id=1582424
|
|
|
|
|
|
|
|
RHEL-only
|
|
|
|
|
|
|
|
Add necessary checks in order to allow setting sgio values for a scsi
|
|
|
|
host device
|
|
|
|
|
|
|
|
Signed-off-by: John Ferlan <jferlan@redhat.com>
|
2022-05-10 07:04:06 +00:00
|
|
|
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
2020-04-28 09:33:33 +00:00
|
|
|
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
|
---
|
2022-05-10 07:04:06 +00:00
|
|
|
src/qemu/qemu_conf.c | 25 ++++++++++++++++---------
|
|
|
|
1 file changed, 16 insertions(+), 9 deletions(-)
|
2020-04-28 09:33:33 +00:00
|
|
|
|
|
|
|
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
|
2022-05-10 07:04:06 +00:00
|
|
|
index 6077457ff4..ba85fc6e22 100644
|
2020-04-28 09:33:33 +00:00
|
|
|
--- a/src/qemu/qemu_conf.c
|
|
|
|
+++ b/src/qemu/qemu_conf.c
|
2022-05-10 07:04:06 +00:00
|
|
|
@@ -1841,8 +1841,9 @@ qemuSetUnprivSGIO(virDomainDeviceDef *dev)
|
|
|
|
virDomainDiskDef *disk = NULL;
|
|
|
|
virDomainHostdevDef *hostdev = NULL;
|
2020-11-03 12:01:38 +00:00
|
|
|
g_autofree char *sysfs_path = NULL;
|
|
|
|
+ g_autofree char *hostdev_path = NULL;
|
2020-04-28 09:33:33 +00:00
|
|
|
const char *path = NULL;
|
2022-05-10 07:04:06 +00:00
|
|
|
- int val = -1;
|
|
|
|
+ int val = 0;
|
2020-11-03 12:01:38 +00:00
|
|
|
|
2022-05-10 07:04:06 +00:00
|
|
|
/* "sgio" is only valid for block disk; cdrom
|
|
|
|
* and floopy disk can have empty source.
|
|
|
|
@@ -1858,17 +1859,14 @@ qemuSetUnprivSGIO(virDomainDeviceDef *dev)
|
|
|
|
} else if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV) {
|
|
|
|
hostdev = dev->data.hostdev;
|
|
|
|
|
|
|
|
- if (!qemuIsSharedHostdev(hostdev))
|
|
|
|
+ if (hostdev->source.subsys.u.scsi.protocol ==
|
|
|
|
+ VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI)
|
2020-04-28 09:33:33 +00:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
- if (hostdev->source.subsys.u.scsi.sgio) {
|
|
|
|
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
|
|
|
- _("'sgio' is not supported for SCSI "
|
|
|
|
- "generic device yet "));
|
|
|
|
+ if (!(hostdev_path = qemuGetHostdevPath(hostdev)))
|
2020-11-03 12:01:38 +00:00
|
|
|
return -1;
|
2020-04-28 09:33:33 +00:00
|
|
|
- }
|
|
|
|
|
|
|
|
- return 0;
|
|
|
|
+ path = hostdev_path;
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
2022-05-10 07:04:06 +00:00
|
|
|
@@ -1877,7 +1875,16 @@ qemuSetUnprivSGIO(virDomainDeviceDef *dev)
|
2020-11-03 12:01:38 +00:00
|
|
|
return -1;
|
2020-04-28 09:33:33 +00:00
|
|
|
|
|
|
|
/* By default, filter the SG_IO commands, i.e. set unpriv_sgio to 0. */
|
|
|
|
- val = (disk->sgio == VIR_DOMAIN_DEVICE_SGIO_UNFILTERED);
|
2022-05-10 07:04:06 +00:00
|
|
|
+ if (dev->type == VIR_DOMAIN_DEVICE_DISK) {
|
|
|
|
+ if (disk->sgio == VIR_DOMAIN_DEVICE_SGIO_UNFILTERED)
|
|
|
|
+ val = 1;
|
|
|
|
+ } else {
|
|
|
|
+ /* Only settable if <shareable/> was present for hostdev */
|
|
|
|
+ if (qemuIsSharedHostdev(hostdev) &&
|
|
|
|
+ hostdev->source.subsys.u.scsi.sgio ==
|
|
|
|
+ VIR_DOMAIN_DEVICE_SGIO_UNFILTERED)
|
|
|
|
+ val = 1;
|
|
|
|
+ }
|
2020-04-28 09:33:33 +00:00
|
|
|
|
|
|
|
/* Do not do anything if unpriv_sgio is not supported by the kernel and the
|
|
|
|
* whitelist is enabled. But if requesting unfiltered access, always call
|
|
|
|
--
|
2022-05-10 07:04:06 +00:00
|
|
|
2.34.1
|
2020-04-28 09:33:33 +00:00
|
|
|
|