Note that cdbfilter is not exactly match unpriv_sgio's value.
VIR_DOMAIN_DISK_CDB_FILTER_YES mean the kernel will filter the
SCSI commands, which maps to 0 of unpriv_sgio;
VIR_DOMAIN_DISK_CDB_FILTER_NO maps to 1 of unpriv_sgio.
---
src/qemu/qemu_process.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index c3ecf6f..bcea0ff 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3730,10 +3730,19 @@ int qemuProcessStart(virConnectPtr conn,
_("Raw I/O is not supported on this platform"));
#endif
- if (disk->type == VIR_DOMAIN_DISK_TYPE_BLOCK && disk->shared) {
+ if (disk->type == VIR_DOMAIN_DISK_TYPE_BLOCK && disk->shared) {
if (qemuAddSharedDisk(driver->sharedDisks, disk->src) < 0)
goto cleanup;
}
+
+ /* Set sysfs unpriv_sgio if cdbfilter is specified */
+ if (disk->cdbfilter) {
+ if (virSetDeviceUnprivSGIO(disk->src, NULL,
+ (disk->cdbfilter ==
+ VIR_DOMAIN_DISK_CDB_FILTER_NO)
+ ? 1 : 0) < 0)
+ goto cleanup;
+ }
}
virCommandSetPreExecHook(cmd, qemuProcessHook, &hookData);
--
1.7.7.6