[PATCH] storage: Update qemu-img flag checking

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

 



For newer qemu-img, the help string for "backing file format" is
"[-F backing_fmt]".

Fix the wrong logic error by commit e997c268.

* src/storage/storage_backend.c
---
 src/storage/storage_backend.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index 0751fde..6d8e8b0 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -595,7 +595,8 @@ static int virStorageBackendQEMUImgBackingFormat(const char *qemuimg)

     start = strstr(help, " create ");
     end = strstr(start, "\n");
-    if ((tmp = strstr(start, "-F fmt")) && tmp < end)
+    if (((tmp = strstr(start, "-F fmt")) && tmp < end) ||
+        ((tmp = strstr(start, "-F backing_fmt")) && tmp < end))
         ret = QEMU_IMG_BACKING_FORMAT_FLAG;
     else if ((tmp = strstr(start, "[-o options]")) && tmp < end)
         ret = QEMU_IMG_BACKING_FORMAT_OPTIONS;
@@ -757,7 +758,7 @@ virStorageBackendCreateQemuImg(virConnectPtr conn,
         };

         if (vol->target.encryption != NULL) {
-            if (imgformat == QEMU_IMG_BACKING_FORMAT_FLAG) {
+            if (imgformat == QEMU_IMG_BACKING_FORMAT_OPTIONS) {
                 imgargv[8] = "-o";
                 imgargv[9] = "encryption=on";
             } else {
@@ -837,7 +838,7 @@ virStorageBackendCreateQemuImg(virConnectPtr conn,
         };

         if (vol->target.encryption != NULL) {
-            if (imgformat == QEMU_IMG_BACKING_FORMAT_FLAG) {
+            if (imgformat == QEMU_IMG_BACKING_FORMAT_OPTIONS) {
                 imgargv[6] = "-o";
                 imgargv[7] = "encryption=on";
             } else {
--
1.7.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]