[PATCH 4/5] storage: move qemu-img options before positional arguments

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

 



Modify the expected output of storagevolxml2argv tests as well.
---
 src/storage/storage_backend.c                       | 21 ++++++++++-----------
 tests/storagevolxml2argvdata/qcow2-flag.argv        |  2 +-
 .../qcow2-nobacking-convert-flag.argv               |  2 +-
 .../qcow2-nobacking-convert-none.argv               |  2 +-
 .../qcow2-nobacking-convert-prealloc.argv           |  2 +-
 .../qcow2-nobacking-flag.argv                       |  2 +-
 .../qcow2-nobacking-none.argv                       |  2 +-
 .../qcow2-nobacking-prealloc.argv                   |  2 +-
 tests/storagevolxml2argvdata/qcow2-none.argv        |  2 +-
 9 files changed, 18 insertions(+), 19 deletions(-)

diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index bd7e741..b32c7ef 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -773,8 +773,7 @@ virStorageBackendCreateQemuImgCmd(virConnectPtr conn,
     cmd = virCommandNew(create_tool);
 
     if (inputvol) {
-        virCommandAddArgList(cmd, "convert", "-f", inputType, "-O", type,
-                             inputPath, vol->target.path, NULL);
+        virCommandAddArgList(cmd, "convert", "-f", inputType, "-O", type, NULL);
 
         if (imgformat == QEMU_IMG_BACKING_FORMAT_OPTIONS &&
             (do_encryption || preallocate)) {
@@ -785,18 +784,18 @@ virStorageBackendCreateQemuImgCmd(virConnectPtr conn,
         } else if (do_encryption) {
             virCommandAddArg(cmd, "-e");
         }
+        virCommandAddArgList(cmd, inputPath, vol->target.path, NULL);
     } else if (vol->backingStore.path) {
         virCommandAddArgList(cmd, "create", "-f", type,
                              "-b", vol->backingStore.path, NULL);
 
         switch (imgformat) {
         case QEMU_IMG_BACKING_FORMAT_FLAG:
-            virCommandAddArgList(cmd, "-F", backingType, vol->target.path,
-                                 NULL);
-            virCommandAddArgFormat(cmd, "%lluK", size_arg);
-
+            virCommandAddArgList(cmd, "-F", backingType, NULL);
             if (do_encryption)
                 virCommandAddArg(cmd, "-e");
+            virCommandAddArg(cmd, vol->target.path);
+            virCommandAddArgFormat(cmd, "%lluK", size_arg);
             break;
 
         case QEMU_IMG_BACKING_FORMAT_OPTIONS:
@@ -811,15 +810,13 @@ virStorageBackendCreateQemuImgCmd(virConnectPtr conn,
             VIR_INFO("Unable to set backing store format for %s with %s",
                      vol->target.path, create_tool);
 
-            virCommandAddArg(cmd, vol->target.path);
-            virCommandAddArgFormat(cmd, "%lluK", size_arg);
             if (do_encryption)
                 virCommandAddArg(cmd, "-e");
+            virCommandAddArg(cmd, vol->target.path);
+            virCommandAddArgFormat(cmd, "%lluK", size_arg);
         }
     } else {
-        virCommandAddArgList(cmd, "create", "-f", type,
-                             vol->target.path, NULL);
-        virCommandAddArgFormat(cmd, "%lluK", size_arg);
+        virCommandAddArgList(cmd, "create", "-f", type, NULL);
 
         if (imgformat == QEMU_IMG_BACKING_FORMAT_OPTIONS &&
             (do_encryption || preallocate)) {
@@ -830,6 +827,8 @@ virStorageBackendCreateQemuImgCmd(virConnectPtr conn,
         } else if (do_encryption) {
             virCommandAddArg(cmd, "-e");
         }
+        virCommandAddArg(cmd, vol->target.path);
+        virCommandAddArgFormat(cmd, "%lluK", size_arg);
     }
 
     return cmd;
diff --git a/tests/storagevolxml2argvdata/qcow2-flag.argv b/tests/storagevolxml2argvdata/qcow2-flag.argv
index 3ac9010..2be10a2 100644
--- a/tests/storagevolxml2argvdata/qcow2-flag.argv
+++ b/tests/storagevolxml2argvdata/qcow2-flag.argv
@@ -1 +1 @@
-qemu-img create -f qcow2 -b /dev/null -F raw /var/lib/libvirt/images/OtherDemo.img 5242880K -e
+qemu-img create -f qcow2 -b /dev/null -F raw -e /var/lib/libvirt/images/OtherDemo.img 5242880K
diff --git a/tests/storagevolxml2argvdata/qcow2-nobacking-convert-flag.argv b/tests/storagevolxml2argvdata/qcow2-nobacking-convert-flag.argv
index 2d37c50..7add158 100644
--- a/tests/storagevolxml2argvdata/qcow2-nobacking-convert-flag.argv
+++ b/tests/storagevolxml2argvdata/qcow2-nobacking-convert-flag.argv
@@ -1 +1 @@
-qemu-img convert -f raw -O qcow2 /var/lib/libvirt/images/sparse.img /var/lib/libvirt/images/OtherDemo.img -e
+qemu-img convert -f raw -O qcow2 -e /var/lib/libvirt/images/sparse.img /var/lib/libvirt/images/OtherDemo.img
diff --git a/tests/storagevolxml2argvdata/qcow2-nobacking-convert-none.argv b/tests/storagevolxml2argvdata/qcow2-nobacking-convert-none.argv
index 2d37c50..7add158 100644
--- a/tests/storagevolxml2argvdata/qcow2-nobacking-convert-none.argv
+++ b/tests/storagevolxml2argvdata/qcow2-nobacking-convert-none.argv
@@ -1 +1 @@
-qemu-img convert -f raw -O qcow2 /var/lib/libvirt/images/sparse.img /var/lib/libvirt/images/OtherDemo.img -e
+qemu-img convert -f raw -O qcow2 -e /var/lib/libvirt/images/sparse.img /var/lib/libvirt/images/OtherDemo.img
diff --git a/tests/storagevolxml2argvdata/qcow2-nobacking-convert-prealloc.argv b/tests/storagevolxml2argvdata/qcow2-nobacking-convert-prealloc.argv
index 18e8f64..037e9f6 100644
--- a/tests/storagevolxml2argvdata/qcow2-nobacking-convert-prealloc.argv
+++ b/tests/storagevolxml2argvdata/qcow2-nobacking-convert-prealloc.argv
@@ -1 +1 @@
-qemu-img convert -f raw -O qcow2 /var/lib/libvirt/images/sparse.img /var/lib/libvirt/images/OtherDemo.img -o encryption=on,preallocation=metadata
+qemu-img convert -f raw -O qcow2 -o encryption=on,preallocation=metadata /var/lib/libvirt/images/sparse.img /var/lib/libvirt/images/OtherDemo.img
diff --git a/tests/storagevolxml2argvdata/qcow2-nobacking-flag.argv b/tests/storagevolxml2argvdata/qcow2-nobacking-flag.argv
index 8980cc4..62ad85f 100644
--- a/tests/storagevolxml2argvdata/qcow2-nobacking-flag.argv
+++ b/tests/storagevolxml2argvdata/qcow2-nobacking-flag.argv
@@ -1 +1 @@
-qemu-img create -f qcow2 /var/lib/libvirt/images/OtherDemo.img 5242880K -e
+qemu-img create -f qcow2 -e /var/lib/libvirt/images/OtherDemo.img 5242880K
diff --git a/tests/storagevolxml2argvdata/qcow2-nobacking-none.argv b/tests/storagevolxml2argvdata/qcow2-nobacking-none.argv
index 8980cc4..62ad85f 100644
--- a/tests/storagevolxml2argvdata/qcow2-nobacking-none.argv
+++ b/tests/storagevolxml2argvdata/qcow2-nobacking-none.argv
@@ -1 +1 @@
-qemu-img create -f qcow2 /var/lib/libvirt/images/OtherDemo.img 5242880K -e
+qemu-img create -f qcow2 -e /var/lib/libvirt/images/OtherDemo.img 5242880K
diff --git a/tests/storagevolxml2argvdata/qcow2-nobacking-prealloc.argv b/tests/storagevolxml2argvdata/qcow2-nobacking-prealloc.argv
index 828f5fc..ebeabc8 100644
--- a/tests/storagevolxml2argvdata/qcow2-nobacking-prealloc.argv
+++ b/tests/storagevolxml2argvdata/qcow2-nobacking-prealloc.argv
@@ -1 +1 @@
-qemu-img create -f qcow2 /var/lib/libvirt/images/OtherDemo.img 5242880K -o encryption=on,preallocation=metadata
+qemu-img create -f qcow2 -o encryption=on,preallocation=metadata /var/lib/libvirt/images/OtherDemo.img 5242880K
diff --git a/tests/storagevolxml2argvdata/qcow2-none.argv b/tests/storagevolxml2argvdata/qcow2-none.argv
index f2dfd15..10b7175 100644
--- a/tests/storagevolxml2argvdata/qcow2-none.argv
+++ b/tests/storagevolxml2argvdata/qcow2-none.argv
@@ -1 +1 @@
-qemu-img create -f qcow2 -b /dev/null /var/lib/libvirt/images/OtherDemo.img 5242880K -e
+qemu-img create -f qcow2 -b /dev/null -e /var/lib/libvirt/images/OtherDemo.img 5242880K
-- 
1.7.12.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]