From 81738cd01401e6bde049dd8587db02b031169419 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Mon, 18 Feb 2013 14:45:03 +0100 Subject: [PATCH] storage: move qemu-img options before positional arguments 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 bd7e741b21..b32c7efe0c 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 3ac9010883..2be10a29e9 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 2d37c50835..7add158f8f 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 2d37c50835..7add158f8f 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 18e8f64b8e..037e9f6701 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 8980cc40f7..62ad85fe52 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 8980cc40f7..62ad85fe52 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 828f5fcc94..ebeabc8940 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 f2dfd159ab..10b71752f2 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 -- GitLab