Just like for domain starting, this sets the disk's unpriv_sgio
if cdbfilter is specified when attaching disk.
---
src/qemu/qemu_driver.c | 23 +++++++++++++++++------
1 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index a2700de..b7a59ab 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -6046,12 +6046,23 @@ qemuDomainAttachDeviceDiskLive(virConnectPtr conn,
NULLSTR(disk->src));
}
- if (ret == 0 &&
- disk->type == VIR_DOMAIN_DISK_TYPE_BLOCK &&
- disk->shared) {
- if (qemuAddSharedDisk(driver->sharedDisks, disk->src) < 0)
- VIR_WARN("Failed to add disk '%s' to shared disk table",
- disk->src);
+ if (ret == 0) {
+ if (disk->type == VIR_DOMAIN_DISK_TYPE_BLOCK && disk->shared) {
+ if (qemuAddSharedDisk(driver->sharedDisks, disk->src) < 0)
+ VIR_WARN("Failed to add disk '%s' to shared disk
table",
+ disk->src);
+ }
+
+ /* 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) {
+ VIR_WARN("Failed to set unpriv_sgio of disk '%s'",
disk->src);
+ goto end;
+ }
+ }
}
end:
--
1.7.7.6