Improve I/O tests coverage of LUKS
v5 cover Improve I/O tests coverage of LUKS
The main goal of this series is to get the I/O tests passing 100% with LUKS when run with './check -luks'. It also adds a few more combinations to the LUKS/dmcrypt interoperability test.
To make LUKS testing not quite as slow, we drop the PBKDF iteration count down to a very small value. This doesn't remove all overhead, as formatting the volume will always measure PBKDF timing over a 1 second interval.
Changed in v5:
- Rebase to kevin/block git tree instead of master
- Fix LUKS compat in new test 181
Changed in v4:
- Fix misc mistakes in syntax conversion (Max)
- Drop changes to 120 & mark it unsupported (Max)
- Use _unsupported_fmt (Max)
Changed in v3:
- Fix some typos in commit message(s) (Eric)
Changed in v2:
- Split off patch that change check.time recording since it was not a direct dependancy
- Skip new 159 & 170 tests which don't work due to qemu-img dd limitations
Daniel P. Berrange (5):
iotests: skip 159 & 170 with luks format
iotests: fix remainining tests to work with LUKS
iotests: reduce PBKDF iterations when testing LUKS
iotests: add more LUKS hash combination tests
iotests: chown LUKS device before qemu-io launches
tests/qemu-iotests/033 | 12 +- tests/qemu-iotests/120 | 1 + tests/qemu-iotests/140 | 11 +- tests/qemu-iotests/145 | 19 +- tests/qemu-iotests/149 | 26 +- tests/qemu-iotests/149.out | 1002 ++++++++++++++++++++++++++++---------- tests/qemu-iotests/157 | 17 +- tests/qemu-iotests/157.out | 16 +- tests/qemu-iotests/159 | 1 + tests/qemu-iotests/170 | 1 + tests/qemu-iotests/174 | 2 +- tests/qemu-iotests/181 | 21 +- tests/qemu-iotests/common.filter | 3 +- tests/qemu-iotests/common.qemu | 9 +- tests/qemu-iotests/common.rc | 3 + 15 files changed, 844 insertions(+), 300 deletions(-)
Signature · 1 line
2.9.3
PATCH v5 1/5 iotests: skip 159 & 170 with luks format
While the qemu-img dd command does accept --image-opts this is not sufficient to make it work with the LUKS image yet. This is because bdrv_create() still always requires the non-image-opts syntax.
Thus we must skip 159/170 with luks for now
--- tests/qemu-iotests/159 | 1 + tests/qemu-iotests/170 | 1 + 2 files changed, 2 insertions(+)
tests/qemu-iotests/159 +1 -0
@@ -40,6 +40,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt generic _supported_proto file _supported_os Linux +_unsupported_fmt luks TEST_SIZES="5 512 1024 1999 1K 64K 1M"
tests/qemu-iotests/170 +1 -0
@@ -40,6 +40,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt generic _supported_proto file _supported_os Linux +_unsupported_fmt luks echo echo "== Creating image =="
Signature · 1 line
2.9.3
Re: [Qemu-devel] [PATCH v5 1/5] iotests: skip 159 & 170 with luks format
Quoted 5 lines · Daniel P. Berrange
While the qemu-img dd command does accept --image-opts this is not sufficient to make it work with the LUKS image yet. This is because
bdrv_create()still always requires the non-image-opts syntax.
Quoted 8 lines
Thus we must skip 159/170 with luks for now
Reviewed-by Eric Blake <[email protected]>Signed-off-by Daniel P. Berrange <[email protected]>--- tests/qemu-iotests/159 | 1 + tests/qemu-iotests/170 | 1 + 2 files changed, 2 insertions(+)
PATCH v5 2/5 iotests: fix remainining tests to work with LUKS
In reply to Daniel P. BerrangeThe tests 033, 140, 145 and 157 were all broken when run with LUKS, since they did not correctly use the required image opts args syntax to specify the decryption secret. Further, the 120 test simply does not make sense to run with luks, as the scenario exercised is not relevant.
The test 181 was broken when run with LUKS because it didn't take account of fact that $TEST_IMG was already in image opts syntax. The launch_qemu helper also didn't register the secret object providing the LUKS password.
--- tests/qemu-iotests/033 | 12 ++++++++++-- tests/qemu-iotests/120 | 1 + tests/qemu-iotests/140 | 11 ++++++++++- tests/qemu-iotests/145 | 19 +++++++++++++++++-- tests/qemu-iotests/157 | 17 ++++++++++++++--- tests/qemu-iotests/157.out | 16 ++++++++-------- tests/qemu-iotests/174 | 2 +- tests/qemu-iotests/181 | 21 ++++++++++++++++----- tests/qemu-iotests/common.qemu | 9 +++++++-- 9 files changed, 84 insertions(+), 24 deletions(-)
tests/qemu-iotests/033 +10 -2
@@ -50,10 +50,18 @@ do_test() local align=$1 local iocmd=$2 local img=$3 + if [ "$IMGOPTSSYNTAX" = "true" ] + then + IO_OPEN_ARG="$img" + IO_EXTRA_ARGS="--image-opts" + else + IO_OPEN_ARG="-o driver=$IMGFMT,file.align=$align blkdebug::$img" + IO_EXTRA_ARGS="" + fi { - echo "open -o driver=$IMGFMT,file.align=$align blkdebug::$img" + echo "open $IO_OPEN_ARG" echo $iocmd - } | $QEMU_IO + } | $QEMU_IO $IO_EXTRA_ARGS } for write_zero_cmd in "write -z" "aio_write -z"; do
tests/qemu-iotests/120 +1 -0
@@ -41,6 +41,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt generic _supported_proto file _supported_os Linux +_unsupported_fmt luks _make_test_img 64M
tests/qemu-iotests/140 +10 -1
@@ -52,8 +52,17 @@ _make_test_img 64k $QEMU_IO -c 'write -P 42 0 64k' "$TEST_IMG" | _filter_qemu_io +if test "$IMGOPTSSYNTAX" = "true" +then + SYSEMU_DRIVE_ARG=if=none,media=cdrom,id=drv,$TEST_IMG + SYSEMU_EXTRA_ARGS="" +else + SYSEMU_DRIVE_ARG=if=none,media=cdrom,id=drv,file="$TEST_IMG",driver=$IMGFMT + SYSEMU_EXTRA_ARGS="" +fi + keep_stderr=y \ -_launch_qemu -drive if=none,media=cdrom,id=drv,file="$TEST_IMG",format=$IMGFMT \ +_launch_qemu $SYSEMU_EXTRA_ARGS -drive $SYSEMU_DRIVE_ARG \ 2> >(_filter_nbd) _send_qemu_cmd $QEMU_HANDLE \
tests/qemu-iotests/145 +17 -2
@@ -43,8 +43,23 @@ _supported_proto generic _supported_os Linux _make_test_img 1M -echo quit | $QEMU -nographic -hda "$TEST_IMG" -incoming 'exec:true' -snapshot -serial none -monitor stdio | - _filter_qemu | _filter_hmp + +if test "$IMGOPTSSYNTAX" = "true" +then + SYSEMU_DRIVE_ARG=if=none,$TEST_IMG + SYSEMU_EXTRA_ARGS="" + if [ -n "$IMGKEYSECRET" ]; then + SECRET_ARG="secret,id=keysec0,data=$IMGKEYSECRET" + SYSEMU_EXTRA_ARGS="-object $SECRET_ARG" + fi +else + SYSEMU_DRIVE_ARG=if=none,file="$TEST_IMG",driver=$IMGFMT + SYSEMU_EXTRA_ARGS="" +fi + +echo quit | $QEMU -nographic $SYSEMU_EXTRA_ARGS -drive $SYSEMU_DRIVE_ARG \ + -incoming 'exec:true' -snapshot -serial none -monitor stdio \ + | _filter_qemu | _filter_hmp # success, all done echo "*** done"
tests/qemu-iotests/157 +14 -3
@@ -43,7 +43,6 @@ _supported_os Linux function do_run_qemu() { - echo Testing: "$@" ( if ! test -t 0; then while read cmd; do
@@ -63,7 +62,18 @@ function run_qemu() size=128M -drive="if=none,file=$TEST_IMG,driver=$IMGFMT" +if test "$IMGOPTSSYNTAX" = "true" +then + SYSEMU_DRIVE_ARG=if=none,$TEST_IMG + SYSEMU_EXTRA_ARGS="" + if [ -n "$IMGKEYSECRET" ]; then + SECRET_ARG="secret,id=keysec0,data=$IMGKEYSECRET" + SYSEMU_EXTRA_ARGS="-object $SECRET_ARG" + fi +else + SYSEMU_DRIVE_ARG=if=none,file="$TEST_IMG",driver=$IMGFMT + SYSEMU_EXTRA_ARGS="" +fi _make_test_img $size
@@ -76,8 +86,9 @@ echo for cache in "writeback" "writethrough"; do for wce in "" ",write-cache=auto" ",write-cache=on" ",write-cache=off"; do + echo "Testing: cache='$cache' wce='$wce'" echo "info block" \ - | run_qemu -drive "$drive,cache=$cache" \ + | run_qemu $SYSEMU_EXTRA_ARGS -drive "$SYSEMU_DRIVE_ARG,cache=$cache" \ -device "virtio-blk,drive=none0$wce" \ | grep -e "Testing" -e "Cache mode" done
tests/qemu-iotests/157.out +8 -8
@@ -3,20 +3,20 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 === Setting WCE with qdev and with manually created BB === -Testing: -drive if=none,file=TEST_DIR/t.IMGFMT,driver=IMGFMT,cache=writeback -device virtio-blk,drive=none0 +Testing: cache='writeback' wce='' Cache mode: writeback -Testing: -drive if=none,file=TEST_DIR/t.IMGFMT,driver=IMGFMT,cache=writeback -device virtio-blk,drive=none0,write-cache=auto +Testing: cache='writeback' wce=',write-cache=auto' Cache mode: writeback -Testing: -drive if=none,file=TEST_DIR/t.IMGFMT,driver=IMGFMT,cache=writeback -device virtio-blk,drive=none0,write-cache=on +Testing: cache='writeback' wce=',write-cache=on' Cache mode: writeback -Testing: -drive if=none,file=TEST_DIR/t.IMGFMT,driver=IMGFMT,cache=writeback -device virtio-blk,drive=none0,write-cache=off +Testing: cache='writeback' wce=',write-cache=off' Cache mode: writethrough -Testing: -drive if=none,file=TEST_DIR/t.IMGFMT,driver=IMGFMT,cache=writethrough -device virtio-blk,drive=none0 +Testing: cache='writethrough' wce='' Cache mode: writethrough -Testing: -drive if=none,file=TEST_DIR/t.IMGFMT,driver=IMGFMT,cache=writethrough -device virtio-blk,drive=none0,write-cache=auto +Testing: cache='writethrough' wce=',write-cache=auto' Cache mode: writethrough -Testing: -drive if=none,file=TEST_DIR/t.IMGFMT,driver=IMGFMT,cache=writethrough -device virtio-blk,drive=none0,write-cache=on +Testing: cache='writethrough' wce=',write-cache=on' Cache mode: writeback -Testing: -drive if=none,file=TEST_DIR/t.IMGFMT,driver=IMGFMT,cache=writethrough -device virtio-blk,drive=none0,write-cache=off +Testing: cache='writethrough' wce=',write-cache=off' Cache mode: writethrough *** done
tests/qemu-iotests/174 +1 -1
@@ -41,7 +41,7 @@ _unsupported_fmt raw size=256K -IMGFMT=raw IMGOPTS= _make_test_img $size | _filter_imgfmt +IMGFMT=raw IMGKEYSECRET= IMGOPTS= _make_test_img $size | _filter_imgfmt echo echo "== reading wrong format should fail =="
tests/qemu-iotests/181 +16 -5
@@ -55,13 +55,24 @@ echo qemu_comm_method="monitor" -_launch_qemu \ - -drive file="${TEST_IMG}",cache=${CACHEMODE},driver=$IMGFMT,id=disk +if [ "$IMGOPTSSYNTAX" = "true" ]; then + _launch_qemu \ + -drive "${TEST_IMG}",cache=${CACHEMODE},id=disk +else + _launch_qemu \ + -drive file="${TEST_IMG}",cache=${CACHEMODE},driver=$IMGFMT,id=disk +fi src=$QEMU_HANDLE -_launch_qemu \ - -drive file="${TEST_IMG}",cache=${CACHEMODE},driver=$IMGFMT,id=disk \ - -incoming "unix:${MIG_SOCKET}" +if [ "$IMGOPTSSYNTAX" = "true" ]; then + _launch_qemu \ + -drive "${TEST_IMG}",cache=${CACHEMODE},id=disk \ + -incoming "unix:${MIG_SOCKET}" +else + _launch_qemu \ + -drive file="${TEST_IMG}",cache=${CACHEMODE},driver=$IMGFMT,id=disk \ + -incoming "unix:${MIG_SOCKET}" +fi dest=$QEMU_HANDLE echo
tests/qemu-iotests/common.qemu +7 -2
@@ -153,14 +153,19 @@ function _launch_qemu() mkfifo "${fifo_out}" mkfifo "${fifo_in}" + object_options= + if [ -n "$IMGKEYSECRET" ]; then + object_options="--object secret,id=keysec0,data=$IMGKEYSECRET" + fi + if [ -z "$keep_stderr" ]; then QEMU_NEED_PID='y'\ - ${QEMU} -nographic -serial none ${comm} "${@}" >"${fifo_out}" \ + ${QEMU} ${object_options} -nographic -serial none ${comm} "${@}" >"${fifo_out}" \ 2>&1 \ <"${fifo_in}" & elif [ "$keep_stderr" = "y" ]; then QEMU_NEED_PID='y'\ - ${QEMU} -nographic -serial none ${comm} "${@}" >"${fifo_out}" \ + ${QEMU} ${object_options} -nographic -serial none ${comm} "${@}" >"${fifo_out}" \ <"${fifo_in}" & else exit 1
Signature · 1 line
2.9.3
Re: [Qemu-devel] [PATCH v5 2/5] iotests: fix remainining tests to work with LUKS
Quoted 28 lines · Daniel P. Berrange
The tests 033, 140, 145 and 157 were all broken when run with LUKS, since they did not correctly use the required image opts args syntax to specify the decryption secret. Further, the 120 test simply does not make sense to run with luks, as the scenario exercised is not relevant.
The test 181 was broken when run with LUKS because it didn't take account of fact that $TEST_IMG was already in image opts syntax. The
launch_qemuhelper also didn't register the secret object providing the LUKS password.Signed-off-by Daniel P. Berrange <[email protected]>---
+++ b/tests/qemu-iotests/145
tests/qemu-iotests/145 +5
-2@@ -43,8 +43,23 @@ _supported_proto generic _supported_os Linux _make_test_img 1M -echo quit | $QEMU -nographic -hda "$TEST_IMG" -incoming 'exec:true' -snapshot -serial none -monitor stdio | - _filter_qemu | _filter_hmp + +if test "$IMGOPTSSYNTAX" = "true" +then + SYSEMU_DRIVE_ARG=if=none,$TEST_IMG + SYSEMU_EXTRA_ARGS=""
tests/qemu-iotests/145 _supported_proto generic · line 60
Quoted 10 lines
tests/qemu-iotests/145 +10
-0+ if [ -n "$IMGKEYSECRET" ]; then + SECRET_ARG="secret,id=keysec0,data=$IMGKEYSECRET" + SYSEMU_EXTRA_ARGS="-object $SECRET_ARG" + fi +else + SYSEMU_DRIVE_ARG=if=none,file="$TEST_IMG",driver=$IMGFMT + SYSEMU_EXTRA_ARGS="" +fi + +echo quit | $QEMU -nographic $SYSEMU_EXTRA_ARGS -drive $SYSEMU_DRIVE_ARG \
2 spaces before -drive looks a bit odd, but not a showstopper.
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Re: [Qemu-devel] [PATCH v5 2/5] iotests: fix remainining tests to work with LUKS
In reply to Daniel P. BerrangeQuoted 25 lines · Daniel P. Berrange
The tests 033, 140, 145 and 157 were all broken when run with LUKS, since they did not correctly use the required image opts args syntax to specify the decryption secret. Further, the 120 test simply does not make sense to run with luks, as the scenario exercised is not relevant.
The test 181 was broken when run with LUKS because it didn't take account of fact that $TEST_IMG was already in image opts syntax. The
launch_qemuhelper also didn't register the secret object providing the LUKS password.Signed-off-by Daniel P. Berrange <[email protected]>--- tests/qemu-iotests/033 | 12 ++++++++++-- tests/qemu-iotests/120 | 1 + tests/qemu-iotests/140 | 11 ++++++++++- tests/qemu-iotests/145 | 19 +++++++++++++++++-- tests/qemu-iotests/157 | 17 ++++++++++++++--- tests/qemu-iotests/157.out | 16 ++++++++-------- tests/qemu-iotests/174 | 2 +- tests/qemu-iotests/181 | 21 ++++++++++++++++----- tests/qemu-iotests/common.qemu | 9 +++++++-- 9 files changed, 84 insertions(+), 24 deletions(-)
[...]
tests/qemu-iotests/140 _make_test_img 64k · line 57
Quoted 11 lines
tests/qemu-iotests/140 +3
-0@@ -52,8 +52,17 @@ _make_test_img 64k $QEMU_IO -c 'write -P 42 0 64k' "$TEST_IMG" | _filter_qemu_io +if test "$IMGOPTSSYNTAX" = "true" +then + SYSEMU_DRIVE_ARG=if=none,media=cdrom,id=drv,$TEST_IMG
I would like to propose wrapping this (or at least $TEST_IMG) in quotes, but I'm aware of the fact that the whole test environment breaks if you have a TEST_DIR with whitespace in it, so I don't mind...
(But it is a bit weird to put $TEST_IMG into quotes below and then use $SYSEMU_DRIVE_ARG unquoted.)
tests/qemu-iotests/140 _make_test_img 64k · line 65
Quoted 9 lines
tests/qemu-iotests/140 +7
-1+ SYSEMU_EXTRA_ARGS="" +else + SYSEMU_DRIVE_ARG=if=none,media=cdrom,id=drv,file="$TEST_IMG",driver=$IMGFMT + SYSEMU_EXTRA_ARGS="" +fi + keep_stderr=y \ -_launch_qemu -drive if=none,media=cdrom,id=drv,file="$TEST_IMG",format=$IMGFMT \ +_launch_qemu $SYSEMU_EXTRA_ARGS -drive $SYSEMU_DRIVE_ARG \
But could you drop the $SYSEMU_EXTRA_ARGS? It doesn't seem to serve a purpose (anymore, now that you added this to _launch_qemu itself).
Quoted 11 lines
tests/qemu-iotests/140 +0
-02> >(_filter_nbd) _send_qemu_cmd $QEMU_HANDLE \tests/qemu-iotests/145 +0
-0@@ -43,8 +43,23 @@ _supported_proto generic _supported_os Linux _make_test_img 1M
tests/qemu-iotests/145 _supported_proto generic · line 53
Quoted 10 lines
tests/qemu-iotests/145 +8
-2-echo quit | $QEMU -nographic -hda "$TEST_IMG" -incoming 'exec:true' -snapshot -serial none -monitor stdio | - _filter_qemu | _filter_hmp + +if test "$IMGOPTSSYNTAX" = "true" +then + SYSEMU_DRIVE_ARG=if=none,$TEST_IMG + SYSEMU_EXTRA_ARGS="" + if [ -n "$IMGKEYSECRET" ]; then + SECRET_ARG="secret,id=keysec0,data=$IMGKEYSECRET" + SYSEMU_EXTRA_ARGS="-object $SECRET_ARG"
Please use spaces instead of tabs.
(I know there are a lot of tabs in the test files already, but according to CODING_STYLE, that is just wrong.)
Quoted 26 lines
tests/qemu-iotests/145 +9
-0+ fi +else + SYSEMU_DRIVE_ARG=if=none,file="$TEST_IMG",driver=$IMGFMT + SYSEMU_EXTRA_ARGS="" +fi + +echo quit | $QEMU -nographic $SYSEMU_EXTRA_ARGS -drive $SYSEMU_DRIVE_ARG \ + -incoming 'exec:true' -snapshot -serial none -monitor stdio \ + | _filter_qemu | _filter_hmp # success, all done echo "*** done"tests/qemu-iotests/157 +0
-1@@ -43,7 +43,6 @@ _supported_os Linux function do_run_qemu() { - echo Testing: "$@" ( if ! test -t 0; then while read cmd; do@@ -63,7 +62,18 @@ function run_qemu()
tests/qemu-iotests/157 function run_qemu() · line 71
Quoted 10 lines
tests/qemu-iotests/157 +7
-1size=128M -drive="if=none,file=$TEST_IMG,driver=$IMGFMT" +if test "$IMGOPTSSYNTAX" = "true" +then + SYSEMU_DRIVE_ARG=if=none,$TEST_IMG + SYSEMU_EXTRA_ARGS="" + if [ -n "$IMGKEYSECRET" ]; then + SECRET_ARG="secret,id=keysec0,data=$IMGKEYSECRET" + SYSEMU_EXTRA_ARGS="-object $SECRET_ARG"
s/\t/ /g
Quoted 19 lines
tests/qemu-iotests/157 +7
-1+ fi +else + SYSEMU_DRIVE_ARG=if=none,file="$TEST_IMG",driver=$IMGFMT + SYSEMU_EXTRA_ARGS="" +fi _make_test_img $size@@ -76,8 +86,9 @@ echo for cache in "writeback" "writethrough"; do for wce in "" ",write-cache=auto" ",write-cache=on" ",write-cache=off"; do + echo "Testing: cache='$cache' wce='$wce'" echo "info block" \ - | run_qemu -drive "$drive,cache=$cache" \ + | run_qemu $SYSEMU_EXTRA_ARGS -drive "$SYSEMU_DRIVE_ARG,cache=$cache" \ -device "virtio-blk,drive=none0$wce" \ | grep -e "Testing" -e "Cache mode" done
[...]
tests/qemu-iotests/181 echo · line 58
Quoted 10 lines
index e969a2a..71a3b21 100755
tests/qemu-iotests/181 +1
-2@@ -55,13 +55,24 @@ echo qemu_comm_method="monitor" -_launch_qemu \ - -drive file="${TEST_IMG}",cache=${CACHEMODE},driver=$IMGFMT,id=disk +if [ "$IMGOPTSSYNTAX" = "true" ]; the> + _launch_qemu \
More coding style nit picks: This should be indented with four spaces.
With the style fixed (and maybe Eric's comment addressed) or an explicit "CODING_STYLE has no power over me!" statement, and with SYSEMU_EXTRA_ARGS dropped above:
Quoted 22 lines
tests/qemu-iotests/181 +14
-3+ -drive "${TEST_IMG}",cache=${CACHEMODE},id=disk +else + _launch_qemu \ + -drive file="${TEST_IMG}",cache=${CACHEMODE},driver=$IMGFMT,id=disk +fi src=$QEMU_HANDLE -_launch_qemu \ - -drive file="${TEST_IMG}",cache=${CACHEMODE},driver=$IMGFMT,id=disk \ - -incoming "unix:${MIG_SOCKET}" +if [ "$IMGOPTSSYNTAX" = "true" ]; then + _launch_qemu \ + -drive "${TEST_IMG}",cache=${CACHEMODE},id=disk \ + -incoming "unix:${MIG_SOCKET}" +else + _launch_qemu \ + -drive file="${TEST_IMG}",cache=${CACHEMODE},driver=$IMGFMT,id=disk \ + -incoming "unix:${MIG_SOCKET}" +fi dest=$QEMU_HANDLE echo
Re: [Qemu-devel] [PATCH v5 2/5] iotests: fix remainining tests to work with LUKS
Quoted 15 lines · Max Reitz
Quoted 14 lines · Daniel P. Berrange
The tests 033, 140, 145 and 157 were all broken when run with LUKS, since they did not correctly use the required image opts args syntax to specify the decryption secret. Further, the 120 test simply does not make sense to run with luks, as the scenario exercised is not relevant.
The test 181 was broken when run with LUKS because it didn't take account of fact that $TEST_IMG was already in image opts syntax. The
launch_qemuhelper also didn't register the secret object providing the LUKS password.
Quoted 5 lines
tests/qemu-iotests/140 _make_test_img 64k · line 57
Quoted 3 lines
tests/qemu-iotests/140 +3
-0+if test "$IMGOPTSSYNTAX" = "true" +then + SYSEMU_DRIVE_ARG=if=none,media=cdrom,id=drv,$TEST_IMGI would like to propose wrapping this (or at least $TEST_IMG) in quotes,
Makes no difference in assignment context (other than consistency that it's an easier rule to always quote even when not necessary, than it is to remember which contexts don't need quoting).
Quoted 5 lines
but I'm aware of the fact that the whole test environment breaks if you have a
TEST_DIRwith whitespace in it, so I don't mind...(But it is a bit weird to put $TEST_IMG into quotes below and then use $SYSEMU_DRIVE_ARG unquoted.)
Assigning to SYSEMU_DRIVE_ARG without quotes works even if TEST_IMG contains spaces, but expanding SYSEMU_DRIVE_ARGS without quotes indeed breaks (whether or not you assigned with quotes).
Quoted 10 lines
tests/qemu-iotests/140 _make_test_img 64k · line 65
Quoted 10 lines
tests/qemu-iotests/140 +7
-1+ SYSEMU_EXTRA_ARGS="" +else + SYSEMU_DRIVE_ARG=if=none,media=cdrom,id=drv,file="$TEST_IMG",driver=$IMGFMT + SYSEMU_EXTRA_ARGS="" +fi + keep_stderr=y \ -_launch_qemu -drive if=none,media=cdrom,id=drv,file="$TEST_IMG",format=$IMGFMT \ +_launch_qemu $SYSEMU_EXTRA_ARGS -drive $SYSEMU_DRIVE_ARG \
Yes, you want "$SYSEMU_DRIVE_ARG" here.
Quoted 4 lines
Please use spaces instead of tabs.
(I know there are a lot of tabs in the test files already, but according to
CODING_STYLE, that is just wrong.)
.dir-locals.el may need a tweak to be taught that files in qemu-iotests should not prefer TABs.
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Re: [Qemu-devel] [PATCH v5 2/5] iotests: fix remainining tests to work with LUKS
Quoted 29 lines · Eric Blake
Quoted 15 lines · Max Reitz
Quoted 14 lines · Daniel P. Berrange
The tests 033, 140, 145 and 157 were all broken when run with LUKS, since they did not correctly use the required image opts args syntax to specify the decryption secret. Further, the 120 test simply does not make sense to run with luks, as the scenario exercised is not relevant.
The test 181 was broken when run with LUKS because it didn't take account of fact that $TEST_IMG was already in image opts syntax. The
launch_qemuhelper also didn't register the secret object providing the LUKS password.Quoted 5 lines
tests/qemu-iotests/140 _make_test_img 64k · line 57
Quoted 3 lines
tests/qemu-iotests/140 +3
-0+if test "$IMGOPTSSYNTAX" = "true" +then + SYSEMU_DRIVE_ARG=if=none,media=cdrom,id=drv,$TEST_IMGI would like to propose wrapping this (or at least $TEST_IMG) in quotes,
Makes no difference in assignment context (other than consistency that it's an easier rule to always quote even when not necessary, than it is to remember which contexts don't need quoting).
Quoted 3 lines
but I'm aware of the fact that the whole test environment breaks if you have a
TEST_DIRwith whitespace in it, so I don't mind...
Quoted 6 lines
Quoted 2 lines
(But it is a bit weird to put $TEST_IMG into quotes below and then use $SYSEMU_DRIVE_ARG unquoted.)
Assigning to
SYSEMU_DRIVE_ARGwithout quotes works even ifTEST_IMGcontains spaces, but expandingSYSEMU_DRIVE_ARGSwithout quotes indeed breaks (whether or not you assigned with quotes).
Interesting, thanks. (I only knew that foo=$bar worked.)
Max
Re: [Qemu-devel] [PATCH v5 2/5] iotests: fix remainining tests to work with LUKS
In reply to Max ReitzQuoted 45 lines · Max Reitz
Quoted 25 lines · Daniel P. Berrange
The tests 033, 140, 145 and 157 were all broken when run with LUKS, since they did not correctly use the required image opts args syntax to specify the decryption secret. Further, the 120 test simply does not make sense to run with luks, as the scenario exercised is not relevant.
The test 181 was broken when run with LUKS because it didn't take account of fact that $TEST_IMG was already in image opts syntax. The
launch_qemuhelper also didn't register the secret object providing the LUKS password.Signed-off-by Daniel P. Berrange <[email protected]>--- tests/qemu-iotests/033 | 12 ++++++++++-- tests/qemu-iotests/120 | 1 + tests/qemu-iotests/140 | 11 ++++++++++- tests/qemu-iotests/145 | 19 +++++++++++++++++-- tests/qemu-iotests/157 | 17 ++++++++++++++--- tests/qemu-iotests/157.out | 16 ++++++++-------- tests/qemu-iotests/174 | 2 +- tests/qemu-iotests/181 | 21 ++++++++++++++++----- tests/qemu-iotests/common.qemu | 9 +++++++-- 9 files changed, 84 insertions(+), 24 deletions(-)[...]
tests/qemu-iotests/140 _make_test_img 64k · line 57
Quoted 11 lines
tests/qemu-iotests/140 +3
-0@@ -52,8 +52,17 @@ _make_test_img 64k $QEMU_IO -c 'write -P 42 0 64k' "$TEST_IMG" | _filter_qemu_io +if test "$IMGOPTSSYNTAX" = "true" +then + SYSEMU_DRIVE_ARG=if=none,media=cdrom,id=drv,$TEST_IMGI would like to propose wrapping this (or at least $TEST_IMG) in quotes, but I'm aware of the fact that the whole test environment breaks if you have a
TEST_DIRwith whitespace in it, so I don't mind...
Quoted 2 lines
(But it is a bit weird to put $TEST_IMG into quotes below and then use $SYSEMU_DRIVE_ARG unquoted.)
Yep, consistency is good.
Quoted 13 lines
tests/qemu-iotests/140 _make_test_img 64k · line 65
Quoted 10 lines
tests/qemu-iotests/140 +7
-1+ SYSEMU_EXTRA_ARGS="" +else + SYSEMU_DRIVE_ARG=if=none,media=cdrom,id=drv,file="$TEST_IMG",driver=$IMGFMT + SYSEMU_EXTRA_ARGS="" +fi + keep_stderr=y \ -_launch_qemu -drive if=none,media=cdrom,id=drv,file="$TEST_IMG",format=$IMGFMT \ +_launch_qemu $SYSEMU_EXTRA_ARGS -drive $SYSEMU_DRIVE_ARG \But could you drop the $SYSEMU_EXTRA_ARGS? It doesn't seem to serve a purpose (anymore, now that you added this to
_launch_qemuitself).
Opps, yes, forgot to remove this when i last refactored.
Quoted 11 lines
Quoted 11 lines
tests/qemu-iotests/140 +0
-02> >(_filter_nbd) _send_qemu_cmd $QEMU_HANDLE \tests/qemu-iotests/145 +0
-0@@ -43,8 +43,23 @@ _supported_proto generic _supported_os Linux
Quoted 13 lines
tests/qemu-iotests/145 _supported_proto generic · line 53
Quoted 11 lines
tests/qemu-iotests/145 +8
-2_make_test_img 1M -echo quit | $QEMU -nographic -hda "$TEST_IMG" -incoming 'exec:true' -snapshot -serial none -monitor stdio | - _filter_qemu | _filter_hmp + +if test "$IMGOPTSSYNTAX" = "true" +then + SYSEMU_DRIVE_ARG=if=none,$TEST_IMG + SYSEMU_EXTRA_ARGS="" + if [ -n "$IMGKEYSECRET" ]; then + SECRET_ARG="secret,id=keysec0,data=$IMGKEYSECRET" + SYSEMU_EXTRA_ARGS="-object $SECRET_ARG"Please use spaces instead of tabs.
Will do.
Quoted 2 lines
(I know there are a lot of tabs in the test files already, but according to
CODING_STYLE, that is just wrong.)
I wish we'd clean up existing files one day....
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
PATCH v5 3/5 iotests: reduce PBKDF iterations when testing LUKS
In reply to Daniel P. BerrangeBy default the PBKDF algorithm used with LUKS is tuned based on the number of iterations to produce 1 second of running time. This makes running the I/O test with the LUKS format orders of magnitude slower than with qcow2/raw formats.
When creating LUKS images, set the iteration time to a 10ms to reduce the time overhead for LUKS, since security does not matter in I/O tests.
Previously a full 'check -luks' would take
$ time ./check -luks Passed all 22 tests
real 23m9.988s user 21m46.223s sys 0m22.841s
Now it takes
$ time ./check -luks Passed all 22 tests
real 4m39.235s user 3m29.590s sys 0m24.234s
Still slow compared to qcow2/raw, but much improved none the less.
--- tests/qemu-iotests/149 | 3 + tests/qemu-iotests/149.out | 118 +++++++++++++++++++-------------------- tests/qemu-iotests/common.filter | 3 +- tests/qemu-iotests/common.rc | 3 + 4 files changed, 67 insertions(+), 60 deletions(-)
tests/qemu-iotests/149 +3 -0
@@ -136,6 +136,7 @@ def cryptsetup_add_password(config, slot): args = ["luksAddKey", config.image_path(), "--key-slot", slot, "--key-file", "-", + "--iter-time", "10", pwfile] cryptsetup(args, password)
@@ -164,6 +165,7 @@ def cryptsetup_format(config): args.extend(["--hash", config.hash]) args.extend(["--key-slot", slot]) args.extend(["--key-file", "-"]) + args.extend(["--iter-time", "10"]) args.append(config.image_path()) cryptsetup(args, password)
@@ -230,6 +232,7 @@ def qemu_img_create(config, size_mb): opts = [ "key-secret=sec0", + "iter-time=10", "cipher-alg=%s-%d" % (config.cipher, config.keylen), "cipher-mode=%s" % config.mode, "ivgen-alg=%s" % config.ivgen,
tests/qemu-iotests/149.out +59 -59
335 lines not on this page · raw message
tests/qemu-iotests/common.filter +2 -1
@@ -126,7 +126,8 @@ _filter_img_create() -e "s# block_state_zero=\\(on\\|off\\)##g" \ -e "s# log_size=[0-9]\\+##g" \ -e "s# refcount_bits=[0-9]\\+##g" \ - -e "s# key-secret=[a-zA-Z0-9]\\+##g" + -e "s# key-secret=[a-zA-Z0-9]\\+##g" \ + -e "s# iter-time=[0-9]\\+##g" } _filter_img_info()
tests/qemu-iotests/common.rc +3 -0
@@ -107,6 +107,9 @@ _set_default_imgopts() if [ "$IMGFMT" == "qcow2" ] && ! (echo "$IMGOPTS" | grep "compat=" > /dev/null); then IMGOPTS=$(_optstr_add "$IMGOPTS" "compat=1.1") fi + if [ "$IMGFMT" == "luks" ] && ! (echo "$IMGOPTS" | grep "iter-time=" > /dev/null); then + IMGOPTS=$(_optstr_add "$IMGOPTS" "iter-time=10") + fi } _use_sample_img()
Signature · 1 line
2.9.3
Re: [Qemu-devel] [PATCH v5 3/5] iotests: reduce PBKDF iterations when testing LUKS
Quoted 31 lines · Daniel P. Berrange
By default the PBKDF algorithm used with LUKS is tuned based on the number of iterations to produce 1 second of running time. This makes running the I/O test with the LUKS format orders of magnitude slower than with qcow2/raw formats.
When creating LUKS images, set the iteration time to a 10ms to reduce the time overhead for LUKS, since security does not matter in I/O tests.
Previously a full 'check -luks' would take
$ time ./check -luks Passed all 22 testsreal 23m9.988s user 21m46.223s sys 0m22.841sNow it takes
$ time ./check -luks Passed all 22 testsreal 4m39.235s user 3m29.590s sys 0m24.234sStill slow compared to qcow2/raw, but much improved none the less.
Quoted 8 lines
Reviewed-by Eric Blake <[email protected]>Signed-off-by Daniel P. Berrange <[email protected]>--- tests/qemu-iotests/149 | 3 + tests/qemu-iotests/149.out | 118 +++++++++++++++++++-------------------- tests/qemu-iotests/common.filter | 3 +- tests/qemu-iotests/common.rc | 3 + 4 files changed, 67 insertions(+), 60 deletions(-)
PATCH v5 4/5 iotests: add more LUKS hash combination tests
In reply to Daniel P. BerrangeAdd tests for sha224, sha512, sha384 and ripemd160 hash algorithms.
--- tests/qemu-iotests/149 | 10 +- tests/qemu-iotests/149.out | 482 ++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 484 insertions(+), 8 deletions(-)
tests/qemu-iotests/149 +4 -6
@@ -457,8 +457,12 @@ configs = [ # LUKS default but diff hash + LUKSConfig("aes-256-xts-plain64-sha224", + "aes", 256, "xts", "plain64", None, "sha224"), LUKSConfig("aes-256-xts-plain64-sha256", "aes", 256, "xts", "plain64", None, "sha256"), + LUKSConfig("aes-256-xts-plain64-sha384", + "aes", 256, "xts", "plain64", None, "sha384"), LUKSConfig("aes-256-xts-plain64-sha512", "aes", 256, "xts", "plain64", None, "sha512"), LUKSConfig("aes-256-xts-plain64-ripemd160",
@@ -504,12 +508,6 @@ blacklist = [ # GCrypt doesn't support Twofish with 192 bit key "twofish-192-xts-plain64-sha1", - - # We don't have sha512 hash wired up yet - "aes-256-xts-plain64-sha512", - - # We don't have ripemd160 hash wired up yet - "aes-256-xts-plain64-ripemd160", ] whitelist = []
tests/qemu-iotests/149.out +480 -2
494 lines not on this page · raw message
Signature · 1 line
2.9.3
Re: [Qemu-devel] [PATCH v5 4/5] iotests: add more LUKS hash combination tests
Quoted 9 lines · Daniel P. Berrange
Add tests for sha224, sha512, sha384 and ripemd160 hash algorithms.
Reviewed-by Eric Blake <[email protected]>Signed-off-by Daniel P. Berrange <[email protected]>--- tests/qemu-iotests/149 | 10 +- tests/qemu-iotests/149.out | 482 ++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 484 insertions(+), 8 deletions(-)
PATCH v5 5/5 iotests: chown LUKS device before qemu-io launches
In reply to Daniel P. BerrangeOn some distros, whenever you close a block device file descriptor there is a udev rule that resets the file permissions. This can race with the test script when we run qemu-io multiple times against the same block device. Occasionally the second qemu-io invocation will find udev has reset the permissions causing failure.
--- tests/qemu-iotests/149 | 13 +- tests/qemu-iotests/149.out | 344 ++++++++++++++++++++++----------------------- 2 files changed, 178 insertions(+), 179 deletions(-)
tests/qemu-iotests/149 +6 -7
@@ -23,6 +23,7 @@ import subprocess import os import os.path +import time import base64
@@ -186,7 +187,7 @@ def chown(config): msg = proc.communicate()[0] if proc.returncode != 0: - raise Exception("Cannot change owner on %s" % path) + raise Exception(msg) def cryptsetup_open(config):
@@ -271,6 +272,8 @@ def qemu_io_image_args(config, dev=False): def qemu_io_write_pattern(config, pattern, offset_mb, size_mb, dev=False): """Write a pattern of data to a LUKS image or device""" + if dev: + chown(config) args = ["-c", "write -P 0x%x %dM %dM" % (pattern, offset_mb, size_mb)] args.extend(qemu_io_image_args(config, dev)) iotests.log("qemu-io " + " ".join(args), filters=[iotests.filter_test_dir])
@@ -281,6 +284,8 @@ def qemu_io_write_pattern(config, pattern, offset_mb, size_mb, dev=False): def qemu_io_read_pattern(config, pattern, offset_mb, size_mb, dev=False): """Read a pattern of data to a LUKS image or device""" + if dev: + chown(config) args = ["-c", "read -P 0x%x %dM %dM" % (pattern, offset_mb, size_mb)] args.extend(qemu_io_image_args(config, dev)) iotests.log("qemu-io " + " ".join(args), filters=[iotests.filter_test_dir])
@@ -331,9 +336,6 @@ def test_once(config, qemu_img=False): cryptsetup_open(config) try: - iotests.log("# Set dev owner") - chown(config) - iotests.log("# Write test pattern 0xa7") qemu_io_write_pattern(config, 0xa7, lowOffsetMB, 10, dev=True) iotests.log("# Write test pattern 0x13")
@@ -365,9 +367,6 @@ def test_once(config, qemu_img=False): cryptsetup_open(config) try: - iotests.log("# Set dev owner") - chown(config) - iotests.log("# Read test pattern 0x91") qemu_io_read_pattern(config, 0x91, lowOffsetMB, 10, dev=True) iotests.log("# Read test pattern 0x5e")
tests/qemu-iotests/149.out +172 -172
1,376 lines not on this page · raw message
Signature · 1 line
2.9.3
Re: [Qemu-devel] [PATCH v5 5/5] iotests: chown LUKS device before qemu-io launches
Quoted 19 lines · Daniel P. Berrange
On some distros, whenever you close a block device file descriptor there is a udev rule that resets the file permissions. This can race with the test script when we run qemu-io multiple times against the same block device. Occasionally the second qemu-io invocation will find udev has reset the permissions causing failure.
Reviewed-by Eric Blake <[email protected]>Signed-off-by Daniel P. Berrange <[email protected]>--- tests/qemu-iotests/149 | 13 +- tests/qemu-iotests/149.out | 344 ++++++++++++++++++++++----------------------- 2 files changed, 178 insertions(+), 179 deletions(-)tests/qemu-iotests/149 +0
-0
tests/qemu-iotests/149 line 26
Quoted 4 lines
tests/qemu-iotests/149 +1
-0@@ -23,6 +23,7 @@ import subprocess import os import os.path +import time
Why?
Rest looks good.
Max
Re: [Qemu-devel] [PATCH v5 5/5] iotests: chown LUKS device before qemu-io launches
Quoted 15 lines · Max Reitz
Quoted 14 lines · Daniel P. Berrange
On some distros, whenever you close a block device file descriptor there is a udev rule that resets the file permissions. This can race with the test script when we run qemu-io multiple times against the same block device. Occasionally the second qemu-io invocation will find udev has reset the permissions causing failure.
Reviewed-by Eric Blake <[email protected]>Signed-off-by Daniel P. Berrange <[email protected]>--- tests/qemu-iotests/149 | 13 +- tests/qemu-iotests/149.out | 344 ++++++++++++++++++++++----------------------- 2 files changed, 178 insertions(+), 179 deletions(-)
Quoted 11 lines
tests/qemu-iotests/149 line 26
Quoted 9 lines
tests/qemu-iotests/149 +1
-0@@ -23,6 +23,7 @@ import subprocess import os import os.path +import timeWhy?
That's left over cruft from debugging this test. I'll kill it.
Quoted 1 line
Rest looks good.
Does that count for "reviewed-by" if i kill the import ?
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Re: [Qemu-devel] [PATCH v5 5/5] iotests: chown LUKS device before qemu-io launches
Quoted 28 lines · Daniel P. Berrange
Quoted 15 lines · Max Reitz
Quoted 14 lines · Daniel P. Berrange
On some distros, whenever you close a block device file descriptor there is a udev rule that resets the file permissions. This can race with the test script when we run qemu-io multiple times against the same block device. Occasionally the second qemu-io invocation will find udev has reset the permissions causing failure.
Reviewed-by Eric Blake <[email protected]>Signed-off-by Daniel P. Berrange <[email protected]>--- tests/qemu-iotests/149 | 13 +- tests/qemu-iotests/149.out | 344 ++++++++++++++++++++++----------------------- 2 files changed, 178 insertions(+), 179 deletions(-)Quoted 11 lines
tests/qemu-iotests/149 line 26
Quoted 9 lines
tests/qemu-iotests/149 +1
-0@@ -23,6 +23,7 @@ import subprocess import os import os.path +import timeWhy?
Quoted 5 lines
That's left over cruft from debugging this test. I'll kill it.
Quoted 1 line
Rest looks good.
Does that count for "reviewed-by" if i kill the import ?
Yes, it does. :-)
Max