mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
storagevolxml2argvtest: Use internal wrapping of command line arguments
virCommandToString has the possibility to return an already wrapped string with better format than what we get from the test wrapper script. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
eba7491c59
commit
19d7f60133
@ -1,4 +1,6 @@
|
|||||||
qemu-img \
|
qemu-img \
|
||||||
convert \
|
convert \
|
||||||
-f raw \
|
-f raw \
|
||||||
-O raw /var/lib/libvirt/images/test.iso /var/lib/libvirt/images/sparse.img
|
-O raw \
|
||||||
|
/var/lib/libvirt/images/test.iso \
|
||||||
|
/var/lib/libvirt/images/sparse.img
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
qemu-img \
|
qemu-img \
|
||||||
create \
|
create \
|
||||||
-f raw /var/lib/libvirt/images/test.iso 1024K
|
-f raw \
|
||||||
|
/var/lib/libvirt/images/test.iso \
|
||||||
|
1024K
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
qemu-img \
|
qemu-img \
|
||||||
convert \
|
convert \
|
||||||
-f qcow2 \
|
-f qcow2 \
|
||||||
-O raw /var/lib/libvirt/images/OtherDemo.img /dev/HostVG/Swap
|
-O raw \
|
||||||
|
/var/lib/libvirt/images/OtherDemo.img \
|
||||||
|
/dev/HostVG/Swap
|
||||||
|
@ -2,6 +2,6 @@ qemu-img \
|
|||||||
create \
|
create \
|
||||||
-f luks \
|
-f luks \
|
||||||
--object secret,id=LuksDemo.img_encrypt0,file=/path/to/secretFile \
|
--object secret,id=LuksDemo.img_encrypt0,file=/path/to/secretFile \
|
||||||
-o key-secret=LuksDemo.img_encrypt0,cipher-alg=serpent-256,cipher-mode=cbc,\
|
-o key-secret=LuksDemo.img_encrypt0,cipher-alg=serpent-256,cipher-mode=cbc,hash-alg=sha256,ivgen-alg=plain64,ivgen-hash-alg=sha256 \
|
||||||
hash-alg=sha256,ivgen-alg=plain64,\
|
/var/lib/libvirt/images/LuksDemo.img \
|
||||||
ivgen-hash-alg=sha256 /var/lib/libvirt/images/LuksDemo.img 5242880K
|
5242880K
|
||||||
|
@ -2,7 +2,8 @@ qemu-img \
|
|||||||
create \
|
create \
|
||||||
-f luks \
|
-f luks \
|
||||||
--object secret,id=LuksDemo.img_encrypt0,file=/path/to/secretFile \
|
--object secret,id=LuksDemo.img_encrypt0,file=/path/to/secretFile \
|
||||||
-o key-secret=LuksDemo.img_encrypt0 /var/lib/libvirt/images/LuksDemo.img \
|
-o key-secret=LuksDemo.img_encrypt0 \
|
||||||
|
/var/lib/libvirt/images/LuksDemo.img \
|
||||||
5242880K
|
5242880K
|
||||||
qemu-img \
|
qemu-img \
|
||||||
convert \
|
convert \
|
||||||
@ -10,9 +11,6 @@ convert \
|
|||||||
-n \
|
-n \
|
||||||
--target-image-opts \
|
--target-image-opts \
|
||||||
--object secret,id=LuksDemo.img_encrypt0,file=/path/to/secretFile \
|
--object secret,id=LuksDemo.img_encrypt0,file=/path/to/secretFile \
|
||||||
--object secret,id=OtherDemo.img_encrypt0,\
|
--object secret,id=OtherDemo.img_encrypt0,file=/path/to/inputSecretFile \
|
||||||
file=/path/to/inputSecretFile driver=luks,\
|
driver=luks,file.filename=/var/lib/libvirt/images/OtherDemo.img,key-secret=OtherDemo.img_encrypt0 \
|
||||||
file.filename=/var/lib/libvirt/images/OtherDemo.img,\
|
driver=luks,file.filename=/var/lib/libvirt/images/LuksDemo.img,key-secret=LuksDemo.img_encrypt0
|
||||||
key-secret=OtherDemo.img_encrypt0 driver=luks,\
|
|
||||||
file.filename=/var/lib/libvirt/images/LuksDemo.img,\
|
|
||||||
key-secret=LuksDemo.img_encrypt0
|
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
qemu-img \
|
qemu-img \
|
||||||
create \
|
create \
|
||||||
-f qcow2 \
|
-f qcow2 \
|
||||||
-o compat=0.10 /var/lib/libvirt/images/sparse-qcow2.img 1073741824K
|
-o compat=0.10 \
|
||||||
|
/var/lib/libvirt/images/sparse-qcow2.img \
|
||||||
|
1073741824K
|
||||||
qemu-img \
|
qemu-img \
|
||||||
convert \
|
convert \
|
||||||
--image-opts \
|
--image-opts \
|
||||||
-n \
|
-n \
|
||||||
--target-image-opts \
|
--target-image-opts \
|
||||||
--object secret,id=OtherDemo.img_encrypt0,\
|
--object secret,id=OtherDemo.img_encrypt0,file=/path/to/inputSecretFile \
|
||||||
file=/path/to/inputSecretFile driver=luks,\
|
driver=luks,file.filename=/var/lib/libvirt/images/OtherDemo.img,key-secret=OtherDemo.img_encrypt0 \
|
||||||
file.filename=/var/lib/libvirt/images/OtherDemo.img,\
|
driver=qcow2,file.filename=/var/lib/libvirt/images/sparse-qcow2.img
|
||||||
key-secret=OtherDemo.img_encrypt0 driver=qcow2,\
|
|
||||||
file.filename=/var/lib/libvirt/images/sparse-qcow2.img
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
qemu-img \
|
qemu-img \
|
||||||
create \
|
create \
|
||||||
-f raw /var/lib/libvirt/images/sparse.img 1073741824K
|
-f raw \
|
||||||
|
/var/lib/libvirt/images/sparse.img \
|
||||||
|
1073741824K
|
||||||
qemu-img \
|
qemu-img \
|
||||||
convert \
|
convert \
|
||||||
--image-opts \
|
--image-opts \
|
||||||
-n \
|
-n \
|
||||||
--target-image-opts \
|
--target-image-opts \
|
||||||
--object secret,id=OtherDemo.img_encrypt0,\
|
--object secret,id=OtherDemo.img_encrypt0,file=/path/to/inputSecretFile \
|
||||||
file=/path/to/inputSecretFile driver=luks,\
|
driver=luks,file.filename=/var/lib/libvirt/images/OtherDemo.img,key-secret=OtherDemo.img_encrypt0 \
|
||||||
file.filename=/var/lib/libvirt/images/OtherDemo.img,\
|
driver=raw,file.filename=/var/lib/libvirt/images/sparse.img
|
||||||
key-secret=OtherDemo.img_encrypt0 driver=raw,\
|
|
||||||
file.filename=/var/lib/libvirt/images/sparse.img
|
|
||||||
|
@ -2,15 +2,14 @@ qemu-img \
|
|||||||
create \
|
create \
|
||||||
-f luks \
|
-f luks \
|
||||||
--object secret,id=OtherDemo.img_encrypt0,file=/path/to/secretFile \
|
--object secret,id=OtherDemo.img_encrypt0,file=/path/to/secretFile \
|
||||||
-o key-secret=OtherDemo.img_encrypt0 /var/lib/libvirt/images/OtherDemo.img \
|
-o key-secret=OtherDemo.img_encrypt0 \
|
||||||
|
/var/lib/libvirt/images/OtherDemo.img \
|
||||||
5242880K
|
5242880K
|
||||||
qemu-img \
|
qemu-img \
|
||||||
convert \
|
convert \
|
||||||
--image-opts \
|
--image-opts \
|
||||||
-n \
|
-n \
|
||||||
--target-image-opts \
|
--target-image-opts \
|
||||||
--object secret,id=OtherDemo.img_encrypt0,\
|
--object secret,id=OtherDemo.img_encrypt0,file=/path/to/secretFile \
|
||||||
file=/path/to/secretFile driver=qcow2,\
|
driver=qcow2,file.filename=/var/lib/libvirt/images/sparse-qcow2.img \
|
||||||
file.filename=/var/lib/libvirt/images/sparse-qcow2.img driver=luks,\
|
driver=luks,file.filename=/var/lib/libvirt/images/OtherDemo.img,key-secret=OtherDemo.img_encrypt0
|
||||||
file.filename=/var/lib/libvirt/images/OtherDemo.img,\
|
|
||||||
key-secret=OtherDemo.img_encrypt0
|
|
||||||
|
@ -2,14 +2,14 @@ qemu-img \
|
|||||||
create \
|
create \
|
||||||
-f luks \
|
-f luks \
|
||||||
--object secret,id=OtherDemo.img_encrypt0,file=/path/to/secretFile \
|
--object secret,id=OtherDemo.img_encrypt0,file=/path/to/secretFile \
|
||||||
-o key-secret=OtherDemo.img_encrypt0 /var/lib/libvirt/images/OtherDemo.img \
|
-o key-secret=OtherDemo.img_encrypt0 \
|
||||||
|
/var/lib/libvirt/images/OtherDemo.img \
|
||||||
5242880K
|
5242880K
|
||||||
qemu-img \
|
qemu-img \
|
||||||
convert \
|
convert \
|
||||||
--image-opts \
|
--image-opts \
|
||||||
-n \
|
-n \
|
||||||
--target-image-opts \
|
--target-image-opts \
|
||||||
--object secret,id=OtherDemo.img_encrypt0,file=/path/to/secretFile driver=raw,\
|
--object secret,id=OtherDemo.img_encrypt0,file=/path/to/secretFile \
|
||||||
file.filename=/var/lib/libvirt/images/sparse.img driver=luks,\
|
driver=raw,file.filename=/var/lib/libvirt/images/sparse.img \
|
||||||
file.filename=/var/lib/libvirt/images/OtherDemo.img,\
|
driver=luks,file.filename=/var/lib/libvirt/images/OtherDemo.img,key-secret=OtherDemo.img_encrypt0
|
||||||
key-secret=OtherDemo.img_encrypt0
|
|
||||||
|
@ -2,5 +2,6 @@ qemu-img \
|
|||||||
create \
|
create \
|
||||||
-f luks \
|
-f luks \
|
||||||
--object secret,id=LuksDemo.img_encrypt0,file=/path/to/secretFile \
|
--object secret,id=LuksDemo.img_encrypt0,file=/path/to/secretFile \
|
||||||
-o key-secret=LuksDemo.img_encrypt0 /var/lib/libvirt/images/LuksDemo.img \
|
-o key-secret=LuksDemo.img_encrypt0 \
|
||||||
|
/var/lib/libvirt/images/LuksDemo.img \
|
||||||
5242880K
|
5242880K
|
||||||
|
@ -2,4 +2,6 @@ qemu-img \
|
|||||||
create \
|
create \
|
||||||
-f qcow2 \
|
-f qcow2 \
|
||||||
-b /dev/null \
|
-b /dev/null \
|
||||||
-o backing_fmt=raw,compat=1.1 /var/lib/libvirt/images/OtherDemo.img 5242880K
|
-o backing_fmt=raw,compat=1.1 \
|
||||||
|
/var/lib/libvirt/images/OtherDemo.img \
|
||||||
|
5242880K
|
||||||
|
@ -2,4 +2,6 @@ qemu-img \
|
|||||||
create \
|
create \
|
||||||
-f qcow2 \
|
-f qcow2 \
|
||||||
-b /dev/null \
|
-b /dev/null \
|
||||||
-o backing_fmt=raw,compat=0.10 /var/lib/libvirt/images/OtherDemo.img 5242880K
|
-o backing_fmt=raw,compat=0.10 \
|
||||||
|
/var/lib/libvirt/images/OtherDemo.img \
|
||||||
|
5242880K
|
||||||
|
@ -2,4 +2,6 @@ qemu-img \
|
|||||||
convert \
|
convert \
|
||||||
-f raw \
|
-f raw \
|
||||||
-O qcow2 \
|
-O qcow2 \
|
||||||
-o compat=0.10 /dev/HostVG/Swap /var/lib/libvirt/images/OtherDemo.img
|
-o compat=0.10 \
|
||||||
|
/dev/HostVG/Swap \
|
||||||
|
/var/lib/libvirt/images/OtherDemo.img
|
||||||
|
@ -2,5 +2,6 @@ qemu-img \
|
|||||||
create \
|
create \
|
||||||
-f qcow2 \
|
-f qcow2 \
|
||||||
-b /dev/null \
|
-b /dev/null \
|
||||||
-o backing_fmt=raw,compat=1.1,\
|
-o backing_fmt=raw,compat=1.1,lazy_refcounts \
|
||||||
lazy_refcounts /var/lib/libvirt/images/OtherDemo.img 5242880K
|
/var/lib/libvirt/images/OtherDemo.img \
|
||||||
|
5242880K
|
||||||
|
@ -2,17 +2,15 @@ qemu-img \
|
|||||||
create \
|
create \
|
||||||
-f qcow2 \
|
-f qcow2 \
|
||||||
--object secret,id=OtherDemoLuks.img_encrypt0,file=/path/to/secretFile \
|
--object secret,id=OtherDemoLuks.img_encrypt0,file=/path/to/secretFile \
|
||||||
-o encrypt.format=luks,encrypt.key-secret=OtherDemoLuks.img_encrypt0,\
|
-o encrypt.format=luks,encrypt.key-secret=OtherDemoLuks.img_encrypt0,compat=0.10 \
|
||||||
compat=0.10 /var/lib/libvirt/images/OtherDemoLuks.img 5242880K
|
/var/lib/libvirt/images/OtherDemoLuks.img \
|
||||||
|
5242880K
|
||||||
qemu-img \
|
qemu-img \
|
||||||
convert \
|
convert \
|
||||||
--image-opts \
|
--image-opts \
|
||||||
-n \
|
-n \
|
||||||
--target-image-opts \
|
--target-image-opts \
|
||||||
--object secret,id=OtherDemoLuks.img_encrypt0,file=/path/to/secretFile \
|
--object secret,id=OtherDemoLuks.img_encrypt0,file=/path/to/secretFile \
|
||||||
--object secret,id=OtherDemoLuksConvert.img_encrypt0,\
|
--object secret,id=OtherDemoLuksConvert.img_encrypt0,file=/path/to/inputSecretFile \
|
||||||
file=/path/to/inputSecretFile driver=qcow2,\
|
driver=qcow2,file.filename=/var/lib/libvirt/images/OtherDemoLuksConvert.img,encrypt.key-secret=OtherDemoLuksConvert.img_encrypt0 \
|
||||||
file.filename=/var/lib/libvirt/images/OtherDemoLuksConvert.img,\
|
driver=qcow2,file.filename=/var/lib/libvirt/images/OtherDemoLuks.img,encrypt.key-secret=OtherDemoLuks.img_encrypt0
|
||||||
encrypt.key-secret=OtherDemoLuksConvert.img_encrypt0 driver=qcow2,\
|
|
||||||
file.filename=/var/lib/libvirt/images/OtherDemoLuks.img,\
|
|
||||||
encrypt.key-secret=OtherDemoLuks.img_encrypt0
|
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
qemu-img \
|
qemu-img \
|
||||||
create \
|
create \
|
||||||
-f qcow2 \
|
-f qcow2 \
|
||||||
-o compat=0.10 /var/lib/libvirt/images/sparse-qcow2.img 1073741824K
|
-o compat=0.10 \
|
||||||
|
/var/lib/libvirt/images/sparse-qcow2.img \
|
||||||
|
1073741824K
|
||||||
qemu-img \
|
qemu-img \
|
||||||
convert \
|
convert \
|
||||||
--image-opts \
|
--image-opts \
|
||||||
-n \
|
-n \
|
||||||
--target-image-opts \
|
--target-image-opts \
|
||||||
--object secret,id=OtherDemoLuksConvert.img_encrypt0,\
|
--object secret,id=OtherDemoLuksConvert.img_encrypt0,file=/path/to/inputSecretFile \
|
||||||
file=/path/to/inputSecretFile driver=qcow2,\
|
driver=qcow2,file.filename=/var/lib/libvirt/images/OtherDemoLuksConvert.img,encrypt.key-secret=OtherDemoLuksConvert.img_encrypt0 \
|
||||||
file.filename=/var/lib/libvirt/images/OtherDemoLuksConvert.img,\
|
driver=qcow2,file.filename=/var/lib/libvirt/images/sparse-qcow2.img
|
||||||
encrypt.key-secret=OtherDemoLuksConvert.img_encrypt0 driver=qcow2,\
|
|
||||||
file.filename=/var/lib/libvirt/images/sparse-qcow2.img
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
qemu-img \
|
qemu-img \
|
||||||
create \
|
create \
|
||||||
-f raw /var/lib/libvirt/images/sparse.img 1073741824K
|
-f raw \
|
||||||
|
/var/lib/libvirt/images/sparse.img \
|
||||||
|
1073741824K
|
||||||
qemu-img \
|
qemu-img \
|
||||||
convert \
|
convert \
|
||||||
--image-opts \
|
--image-opts \
|
||||||
-n \
|
-n \
|
||||||
--target-image-opts \
|
--target-image-opts \
|
||||||
--object secret,id=OtherDemoLuksConvert.img_encrypt0,\
|
--object secret,id=OtherDemoLuksConvert.img_encrypt0,file=/path/to/inputSecretFile \
|
||||||
file=/path/to/inputSecretFile driver=qcow2,\
|
driver=qcow2,file.filename=/var/lib/libvirt/images/OtherDemoLuksConvert.img,encrypt.key-secret=OtherDemoLuksConvert.img_encrypt0 \
|
||||||
file.filename=/var/lib/libvirt/images/OtherDemoLuksConvert.img,\
|
driver=raw,file.filename=/var/lib/libvirt/images/sparse.img
|
||||||
encrypt.key-secret=OtherDemoLuksConvert.img_encrypt0 driver=raw,\
|
|
||||||
file.filename=/var/lib/libvirt/images/sparse.img
|
|
||||||
|
@ -3,6 +3,6 @@ create \
|
|||||||
-f qcow2 \
|
-f qcow2 \
|
||||||
-b /dev/null \
|
-b /dev/null \
|
||||||
--object secret,id=OtherDemoLuks.img_encrypt0,file=/path/to/secretFile \
|
--object secret,id=OtherDemoLuks.img_encrypt0,file=/path/to/secretFile \
|
||||||
-o backing_fmt=raw,encrypt.format=luks,\
|
-o backing_fmt=raw,encrypt.format=luks,encrypt.key-secret=OtherDemoLuks.img_encrypt0,compat=0.10 \
|
||||||
encrypt.key-secret=OtherDemoLuks.img_encrypt0,\
|
/var/lib/libvirt/images/OtherDemoLuks.img \
|
||||||
compat=0.10 /var/lib/libvirt/images/OtherDemoLuks.img 5242880K
|
5242880K
|
||||||
|
@ -2,6 +2,6 @@ qemu-img \
|
|||||||
convert \
|
convert \
|
||||||
-f raw \
|
-f raw \
|
||||||
-O qcow2 \
|
-O qcow2 \
|
||||||
-o preallocation=metadata,\
|
-o preallocation=metadata,compat=0.10 \
|
||||||
compat=0.10 /var/lib/libvirt/images/sparse.img \
|
/var/lib/libvirt/images/sparse.img \
|
||||||
/var/lib/libvirt/images/OtherDemo.img
|
/var/lib/libvirt/images/OtherDemo.img
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
qemu-img \
|
qemu-img \
|
||||||
create \
|
create \
|
||||||
-f qcow2 \
|
-f qcow2 \
|
||||||
-o preallocation=metadata,\
|
-o preallocation=metadata,compat=0.10 \
|
||||||
compat=0.10 /var/lib/libvirt/images/OtherDemo.img 5242880K
|
/var/lib/libvirt/images/OtherDemo.img \
|
||||||
|
5242880K
|
||||||
|
@ -2,6 +2,6 @@ qemu-img \
|
|||||||
convert \
|
convert \
|
||||||
-f raw \
|
-f raw \
|
||||||
-O qcow2 \
|
-O qcow2 \
|
||||||
-o preallocation=falloc,\
|
-o preallocation=falloc,compat=0.10 \
|
||||||
compat=0.10 /var/lib/libvirt/images/sparse.img \
|
/var/lib/libvirt/images/sparse.img \
|
||||||
/var/lib/libvirt/images/OtherDemo.img
|
/var/lib/libvirt/images/OtherDemo.img
|
||||||
|
@ -2,4 +2,5 @@ qemu-img \
|
|||||||
create \
|
create \
|
||||||
-f qcow2 \
|
-f qcow2 \
|
||||||
-b /dev/null \
|
-b /dev/null \
|
||||||
-o backing_fmt=raw,compat=0.10 /var/lib/libvirt/images/OtherDemo.img
|
-o backing_fmt=raw,compat=0.10 \
|
||||||
|
/var/lib/libvirt/images/OtherDemo.img
|
||||||
|
@ -2,5 +2,6 @@ qemu-img \
|
|||||||
create \
|
create \
|
||||||
-f qcow2 \
|
-f qcow2 \
|
||||||
-b /dev/null \
|
-b /dev/null \
|
||||||
-o backing_fmt=raw,nocow=on,\
|
-o backing_fmt=raw,nocow=on,compat=0.10 \
|
||||||
compat=0.10 /var/lib/libvirt/images/OtherDemo.img 5242880K
|
/var/lib/libvirt/images/OtherDemo.img \
|
||||||
|
5242880K
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
qemu-img \
|
qemu-img \
|
||||||
create \
|
create \
|
||||||
-f qcow2 \
|
-f qcow2 \
|
||||||
-o compat=0.10 /var/lib/libvirt/images/OtherDemo.img 0K
|
-o compat=0.10 \
|
||||||
|
/var/lib/libvirt/images/OtherDemo.img \
|
||||||
|
0K
|
||||||
|
@ -104,13 +104,13 @@ testCompareXMLToArgvFiles(bool shouldFail,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (convertStep != VIR_STORAGE_VOL_ENCRYPT_CONVERT) {
|
if (convertStep != VIR_STORAGE_VOL_ENCRYPT_CONVERT) {
|
||||||
if (!(actualCmdline = virCommandToString(cmd, false)))
|
if (!(actualCmdline = virCommandToString(cmd, true)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
} else {
|
} else {
|
||||||
char *createCmdline = actualCmdline;
|
char *createCmdline = actualCmdline;
|
||||||
g_autofree char *cvtCmdline = NULL;
|
g_autofree char *cvtCmdline = NULL;
|
||||||
|
|
||||||
if (!(cvtCmdline = virCommandToString(cmd, false)))
|
if (!(cvtCmdline = virCommandToString(cmd, true)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
actualCmdline = g_strdup_printf("%s\n%s", createCmdline, cvtCmdline);
|
actualCmdline = g_strdup_printf("%s\n%s", createCmdline, cvtCmdline);
|
||||||
@ -127,7 +127,7 @@ testCompareXMLToArgvFiles(bool shouldFail,
|
|||||||
|
|
||||||
} while (convertStep != VIR_STORAGE_VOL_ENCRYPT_DONE);
|
} while (convertStep != VIR_STORAGE_VOL_ENCRYPT_DONE);
|
||||||
|
|
||||||
if (virTestCompareToFile(actualCmdline, cmdline) < 0)
|
if (virTestCompareToFileFull(actualCmdline, cmdline, false) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user