[PATCH 7/8] qemu: Set unpriv_sgio when attaching disk

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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..7239d71 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,
+                                       (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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]