提交 81738cd0 编写于 作者: J Ján Tomko

storage: move qemu-img options before positional arguments

Modify the expected output of storagevolxml2argv tests as well.
上级 56e1b4c3
...@@ -773,8 +773,7 @@ virStorageBackendCreateQemuImgCmd(virConnectPtr conn, ...@@ -773,8 +773,7 @@ virStorageBackendCreateQemuImgCmd(virConnectPtr conn,
cmd = virCommandNew(create_tool); cmd = virCommandNew(create_tool);
if (inputvol) { if (inputvol) {
virCommandAddArgList(cmd, "convert", "-f", inputType, "-O", type, virCommandAddArgList(cmd, "convert", "-f", inputType, "-O", type, NULL);
inputPath, vol->target.path, NULL);
if (imgformat == QEMU_IMG_BACKING_FORMAT_OPTIONS && if (imgformat == QEMU_IMG_BACKING_FORMAT_OPTIONS &&
(do_encryption || preallocate)) { (do_encryption || preallocate)) {
...@@ -785,18 +784,18 @@ virStorageBackendCreateQemuImgCmd(virConnectPtr conn, ...@@ -785,18 +784,18 @@ virStorageBackendCreateQemuImgCmd(virConnectPtr conn,
} else if (do_encryption) { } else if (do_encryption) {
virCommandAddArg(cmd, "-e"); virCommandAddArg(cmd, "-e");
} }
virCommandAddArgList(cmd, inputPath, vol->target.path, NULL);
} else if (vol->backingStore.path) { } else if (vol->backingStore.path) {
virCommandAddArgList(cmd, "create", "-f", type, virCommandAddArgList(cmd, "create", "-f", type,
"-b", vol->backingStore.path, NULL); "-b", vol->backingStore.path, NULL);
switch (imgformat) { switch (imgformat) {
case QEMU_IMG_BACKING_FORMAT_FLAG: case QEMU_IMG_BACKING_FORMAT_FLAG:
virCommandAddArgList(cmd, "-F", backingType, vol->target.path, virCommandAddArgList(cmd, "-F", backingType, NULL);
NULL);
virCommandAddArgFormat(cmd, "%lluK", size_arg);
if (do_encryption) if (do_encryption)
virCommandAddArg(cmd, "-e"); virCommandAddArg(cmd, "-e");
virCommandAddArg(cmd, vol->target.path);
virCommandAddArgFormat(cmd, "%lluK", size_arg);
break; break;
case QEMU_IMG_BACKING_FORMAT_OPTIONS: case QEMU_IMG_BACKING_FORMAT_OPTIONS:
...@@ -811,15 +810,13 @@ virStorageBackendCreateQemuImgCmd(virConnectPtr conn, ...@@ -811,15 +810,13 @@ virStorageBackendCreateQemuImgCmd(virConnectPtr conn,
VIR_INFO("Unable to set backing store format for %s with %s", VIR_INFO("Unable to set backing store format for %s with %s",
vol->target.path, create_tool); vol->target.path, create_tool);
virCommandAddArg(cmd, vol->target.path);
virCommandAddArgFormat(cmd, "%lluK", size_arg);
if (do_encryption) if (do_encryption)
virCommandAddArg(cmd, "-e"); virCommandAddArg(cmd, "-e");
virCommandAddArg(cmd, vol->target.path);
virCommandAddArgFormat(cmd, "%lluK", size_arg);
} }
} else { } else {
virCommandAddArgList(cmd, "create", "-f", type, virCommandAddArgList(cmd, "create", "-f", type, NULL);
vol->target.path, NULL);
virCommandAddArgFormat(cmd, "%lluK", size_arg);
if (imgformat == QEMU_IMG_BACKING_FORMAT_OPTIONS && if (imgformat == QEMU_IMG_BACKING_FORMAT_OPTIONS &&
(do_encryption || preallocate)) { (do_encryption || preallocate)) {
...@@ -830,6 +827,8 @@ virStorageBackendCreateQemuImgCmd(virConnectPtr conn, ...@@ -830,6 +827,8 @@ virStorageBackendCreateQemuImgCmd(virConnectPtr conn,
} else if (do_encryption) { } else if (do_encryption) {
virCommandAddArg(cmd, "-e"); virCommandAddArg(cmd, "-e");
} }
virCommandAddArg(cmd, vol->target.path);
virCommandAddArgFormat(cmd, "%lluK", size_arg);
} }
return cmd; return cmd;
......
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
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
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
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
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
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
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
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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册