|
|
3e5111 |
From 5ed5c2acfb240683c3b1d7ec2e63b3c2571d707f Mon Sep 17 00:00:00 2001
|
|
|
3e5111 |
Message-Id: <5ed5c2acfb240683c3b1d7ec2e63b3c2571d707f@dist-git>
|
|
|
7a3408 |
From: John Ferlan <jferlan@redhat.com>
|
|
|
7a3408 |
Date: Thu, 9 Jul 2015 08:28:57 -0400
|
|
|
7a3408 |
Subject: [PATCH] RHEL: qemu: Add ability to set sgio values for hostdev
|
|
|
7a3408 |
|
|
|
7a3408 |
https://bugzilla.redhat.com/show_bug.cgi?id=1072736
|
|
|
7a3408 |
|
|
|
7a3408 |
RHEL-only
|
|
|
7a3408 |
|
|
|
7a3408 |
Add necessary checks in order to allow setting sgio values for a scsi
|
|
|
7a3408 |
host device
|
|
|
7a3408 |
|
|
|
7a3408 |
Signed-off-by: John Ferlan <jferlan@redhat.com>
|
|
|
7a3408 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
7a3408 |
---
|
|
|
7a3408 |
src/qemu/qemu_conf.c | 16 +++++++++-------
|
|
|
7a3408 |
1 file changed, 9 insertions(+), 7 deletions(-)
|
|
|
7a3408 |
|
|
|
7a3408 |
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
|
|
|
3e5111 |
index 3b33e37bb..9137a69f8 100644
|
|
|
7a3408 |
--- a/src/qemu/qemu_conf.c
|
|
|
7a3408 |
+++ b/src/qemu/qemu_conf.c
|
|
|
3e5111 |
@@ -1458,6 +1458,7 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
|
|
|
7a3408 |
virDomainDiskDefPtr disk = NULL;
|
|
|
7a3408 |
virDomainHostdevDefPtr hostdev = NULL;
|
|
|
7a3408 |
char *sysfs_path = NULL;
|
|
|
7a3408 |
+ char *hostdev_path = NULL;
|
|
|
7a3408 |
const char *path = NULL;
|
|
|
6ae9ed |
int val = -1;
|
|
|
7a3408 |
int ret = -1;
|
|
|
3e5111 |
@@ -1479,14 +1480,10 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
|
|
|
7a3408 |
if (!qemuIsSharedHostdev(hostdev))
|
|
|
7a3408 |
return 0;
|
|
|
7a3408 |
|
|
|
7a3408 |
- if (hostdev->source.subsys.u.scsi.sgio) {
|
|
|
7a3408 |
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
|
|
7a3408 |
- _("'sgio' is not supported for SCSI "
|
|
|
7a3408 |
- "generic device yet "));
|
|
|
7a3408 |
+ if (!(hostdev_path = qemuGetHostdevPath(hostdev)))
|
|
|
7a3408 |
goto cleanup;
|
|
|
7a3408 |
- }
|
|
|
7a3408 |
|
|
|
7a3408 |
- return 0;
|
|
|
7a3408 |
+ path = hostdev_path;
|
|
|
7a3408 |
} else {
|
|
|
7a3408 |
return 0;
|
|
|
7a3408 |
}
|
|
|
3e5111 |
@@ -1495,7 +1492,11 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
|
|
|
7a3408 |
goto cleanup;
|
|
|
7a3408 |
|
|
|
7a3408 |
/* By default, filter the SG_IO commands, i.e. set unpriv_sgio to 0. */
|
|
|
7a3408 |
- val = (disk->sgio == VIR_DOMAIN_DEVICE_SGIO_UNFILTERED);
|
|
|
7a3408 |
+ if (dev->type == VIR_DOMAIN_DEVICE_DISK)
|
|
|
7a3408 |
+ val = (disk->sgio == VIR_DOMAIN_DEVICE_SGIO_UNFILTERED);
|
|
|
7a3408 |
+ else
|
|
|
7a3408 |
+ val = (hostdev->source.subsys.u.scsi.sgio ==
|
|
|
7a3408 |
+ VIR_DOMAIN_DEVICE_SGIO_UNFILTERED);
|
|
|
7a3408 |
|
|
|
7a3408 |
/* Do not do anything if unpriv_sgio is not supported by the kernel and the
|
|
|
7a3408 |
* whitelist is enabled. But if requesting unfiltered access, always call
|
|
|
3e5111 |
@@ -1508,6 +1509,7 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
|
|
|
7a3408 |
ret = 0;
|
|
|
7a3408 |
|
|
|
7a3408 |
cleanup:
|
|
|
7a3408 |
+ VIR_FREE(hostdev_path);
|
|
|
7a3408 |
VIR_FREE(sysfs_path);
|
|
|
7a3408 |
return ret;
|
|
|
7a3408 |
}
|
|
|
7a3408 |
--
|
|
|
3e5111 |
2.12.2
|
|
|
7a3408 |
|