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