[PATCH 7/8] qemu: Support shareable volume type disk

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

 



Since the source is already translated before. This just adds the
checking. Move !disk->shared and !disk->src to improve the performance
a bit.
---
 src/qemu/qemu_conf.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 8ae690f..c7b8045 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1113,8 +1113,12 @@ qemuAddSharedDisk(virQEMUDriverPtr driver,
      * for the shared disk is "sgio" setting, which is only
      * valid for block disk.
      */
-    if (disk->type != VIR_DOMAIN_DISK_TYPE_BLOCK ||
-        !disk->shared || !disk->src)
+    if (!disk->shared ||
+        !disk->src ||
+        (disk->type != VIR_DOMAIN_DISK_TYPE_BLOCK &&
+         !(disk->type == VIR_DOMAIN_DISK_TYPE_VOLUME &&
+           disk->srcpool &&
+           disk->srcpool->voltype == VIR_STORAGE_VOL_BLOCK)))
         return 0;
 
     qemuDriverLock(driver);
@@ -1189,8 +1193,12 @@ qemuRemoveSharedDisk(virQEMUDriverPtr driver,
     int ret = -1;
     int idx;
 
-    if (disk->type != VIR_DOMAIN_DISK_TYPE_BLOCK ||
-        !disk->shared || !disk->src)
+    if (!disk->shared ||
+        !disk->src ||
+        (disk->type != VIR_DOMAIN_DISK_TYPE_BLOCK &&
+         !(disk->type == VIR_DOMAIN_DISK_TYPE_VOLUME &&
+           disk->srcpool &&
+           disk->srcpool->voltype == VIR_STORAGE_VOL_BLOCK)))
         return 0;
 
     qemuDriverLock(driver);
-- 
1.8.1.4

--
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]