Skip to contentSkip to conversation

Improve I/O tests coverage of LUKS

PATCH Superseded Daniel P. Berrange 2 participants 9 messages Jan 24, 2017 – Feb 12, 2017

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v3 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 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           |   16 +-
 tests/qemu-iotests/120           |   25 +-
 tests/qemu-iotests/140           |   15 +-
 tests/qemu-iotests/145           |   18 +-
 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           |    2 +-
 tests/qemu-iotests/170           |    2 +-
 tests/qemu-iotests/common.filter |    3 +-
 tests/qemu-iotests/common.rc     |    3 +
 12 files changed, 847 insertions(+), 298 deletions(-)
Signature · 1 line
2.9.3
#1 lore raw

PATCH v3 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 | 2 +-
 tests/qemu-iotests/170 | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
tests/qemu-iotests/159 +1 -1
index 825f05f..7636865 100755
@@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 . ./common.filter
 . ./common.pattern
 
-_supported_fmt generic
+_supported_fmt raw qcow qcow2 qed
 _supported_proto file
 _supported_os Linux
 
tests/qemu-iotests/170 +1 -1
index 5b335db..6bd1c37 100755
@@ -37,7 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 . ./common.filter
 . ./common.pattern
 
-_supported_fmt generic
+_supported_fmt raw qcow qcow2 qed
 _supported_proto file
 _supported_os Linux
 
Signature · 1 line
2.9.3
#2 lore raw

Re: [Qemu-devel] [PATCH v3 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

---
 tests/qemu-iotests/159 | 2 +-
 tests/qemu-iotests/170 | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

https://github.com/XanClic/qemu/commit/b4a2caa4bd5ad4e3cd6dd7eb1c0067d9205280cb
introduces _unsupported_fmt. Would that be a better fit?

(Yes, I'll send a pull request today.)

Max

#3 lore raw

PATCH v3 2/5 iotests: fix remainining tests to work with LUKS

In reply to Daniel P. Berrange

The tests 033, 120, 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.

---
 tests/qemu-iotests/033     | 16 ++++++++++++----
 tests/qemu-iotests/120     | 25 ++++++++++++++++++++++---
 tests/qemu-iotests/140     | 15 ++++++++++++++-
 tests/qemu-iotests/145     | 18 +++++++++++++++++-
 tests/qemu-iotests/157     | 17 ++++++++++++++---
 tests/qemu-iotests/157.out | 16 ++++++++--------
 6 files changed, 87 insertions(+), 20 deletions(-)
tests/qemu-iotests/033 +12 -4
index 16edcf2..b690b0e 100755
@@ -50,14 +50,22 @@ do_test()
 	local align=$1
 	local iocmd=$2
 	local img=$3
+	if test "$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
-for align in 512 4k; do
+    for align in 512 4k; do
 	echo
 	echo "== preparing image =="
 	do_test $align "write -P 0xa 0x200 0x400" "$TEST_IMG" | _filter_qemu_io
@@ -91,7 +99,7 @@ for align in 512 4k; do
 	do_test $align "read -P 0xb 0x400 0xc00" "$TEST_IMG" | _filter_qemu_io
 
 	echo
-done
+    done
 done
 
 # success, all done
tests/qemu-iotests/120 +22 -3
index 4f88a67..5f80517 100755
@@ -44,17 +44,36 @@ _supported_os Linux
 
 _make_test_img 64M
 
+if test "$IMGOPTSSYNTAX" = "true"
+then
+    SYSEMU_DRIVE_ARG=id=drv,if=none,$TEST_IMG
+    SYSEMU_EXTRA_ARGS=""
+    IO_DRIVE_ARG="$TEST_IMG"
+    IO_EXTRA_ARGS="--image-opts"
+    if [ -n "$IMGKEYSECRET" ]; then
+	SECRET_ARG="secret,id=keysec0,data=$IMGKEYSECRET"
+	SYSEMU_EXTRA_ARGS="$SYSEMU_EXTRA_ARGS -object $SECRET_ARG"
+	IO_EXTRA_ARGS="$IO_EXTRA_ARGS --object $SECRET_ARG"
+    fi
+else
+    SYSEMU_DRIVE_ARG=id=drv,if=none,file="$TEST_IMG",driver=raw,file.driver=$IMGFMT
+    SYSEMU_EXTRA_ARGS=""
+    IO_DRIVE_ARG="json:{'driver': 'raw', 'file': {'driver': '$IMGFMT', 'file': {'filename': '$TEST_IMG'}}}"
+    IO_EXTRA_ARGS=""
+fi
+
+
 echo "{'execute': 'qmp_capabilities'}
       {'execute': 'human-monitor-command',
        'arguments': {'command-line': 'qemu-io drv \"write -P 42 0 64k\"'}}
       {'execute': 'quit'}" \
-    | $QEMU -qmp stdio -nographic -nodefaults \
-            -drive id=drv,if=none,file="$TEST_IMG",driver=raw,file.driver=$IMGFMT \
+    | $QEMU -qmp stdio -nographic -nodefaults $SYSEMU_EXTRA_ARGS \
+            -drive $SYSEMU_DRIVE_ARG \
     | _filter_qmp | _filter_qemu_io
 $QEMU_IO -c 'read -P 42 0 64k' "$TEST_IMG" | _filter_qemu_io
 
 $QEMU_IO_PROG -c 'read -P 42 0 64k' \
-    "json:{'driver': 'raw', 'file': {'driver': '$IMGFMT', 'file': {'filename': '$TEST_IMG'}}}" \
+    $IO_EXTRA_ARGS "$IO_DRIVE_ARG" \
     | _filter_qemu_io
 
 # success, all done
tests/qemu-iotests/140 +14 -1
index 49f9df4..afaa418 100755
@@ -51,8 +51,21 @@ _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=""
+    if [ -n "$IMGKEYSECRET" ]; then
+	SECRET_ARG="secret,id=keysec0,data=$IMGKEYSECRET"
+	SYSEMU_EXTRA_ARGS="-object $SECRET_ARG"
+    fi
+else
+    SYSEMU_DRIVE_ARG=if=none,media=cdrom,id=drv,file="$TEST_IMG",driver=raw,file.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 -1
index 1eca0e8..ab54972 100755
@@ -43,7 +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
+
+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=raw,file.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
 
 # success, all done
 echo "*** done"
tests/qemu-iotests/157 +14 -3
index 8d939cb..9ba1720 100755
@@ -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=raw,file.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
index 77a9c03..fdc807f 100644
@@ -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
Signature · 1 line
2.9.3
#4 lore raw

Re: [Qemu-devel] [PATCH v3 2/5] iotests: fix remainining tests to work with LUKS

Quoted 21 lines · Daniel P. Berrange

The tests 033, 120, 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.

---
 tests/qemu-iotests/033     | 16 ++++++++++++----
 tests/qemu-iotests/120     | 25 ++++++++++++++++++++++---
 tests/qemu-iotests/140     | 15 ++++++++++++++-
 tests/qemu-iotests/145     | 18 +++++++++++++++++-
 tests/qemu-iotests/157     | 17 ++++++++++++++---
 tests/qemu-iotests/157.out | 16 ++++++++--------
 6 files changed, 87 insertions(+), 20 deletions(-)
tests/qemu-iotests/033 +0 -0
index 16edcf2..b690b0e 100755

tests/qemu-iotests/033 do_test() · line 53

Quoted 4 lines
tests/qemu-iotests/033 +1 -0
@@ -50,14 +50,22 @@ do_test()
 	local align=$1
 	local iocmd=$2
 	local img=$3
+	if test "$IMGOPTSSYNTAX" = "true"

Explicitly using "test" is a bit weird, but OK.

Quoted 22 lines
tests/qemu-iotests/033 +10 -3
+	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
-for align in 512 4k; do
+    for align in 512 4k; do
 	echo
 	echo "== preparing image =="
 	do_test $align "write -P 0xa 0x200 0x400" "$TEST_IMG" | _filter_qemu_io

tests/qemu-iotests/033 for align in 512 4k; do · line 102

Quoted 5 lines
tests/qemu-iotests/033 +1 -1
@@ -91,7 +99,7 @@ for align in 512 4k; do
 	do_test $align "read -P 0xb 0x400 0xc00" "$TEST_IMG" | _filter_qemu_io
 
 	echo
-done
+    done

These alignment changes don't hurt, but I don't really see how they improve the layout or how they are related to this patch.

Quoted 8 lines
tests/qemu-iotests/033 +0 -0
 done
 
 # success, all done
tests/qemu-iotests/120 +0 -0
index 4f88a67..5f80517 100755

tests/qemu-iotests/120 _supported_os Linux · line 49

Quoted 6 lines
tests/qemu-iotests/120 +3 -0
@@ -44,17 +44,36 @@ _supported_os Linux
 
 _make_test_img 64M
 
+if test "$IMGOPTSSYNTAX" = "true"
+then
+    SYSEMU_DRIVE_ARG=id=drv,if=none,$TEST_IMG

This basically makes this test moot. The point is to get the following configuration:

raw format driver

       |
       v
 $IMGFMT driver
       |
       v

protocol driver

This is why the test explicitly specifies driver=raw,file.driver=$IMGFMT. With this configuration, you just get the standard configuration without the raw driver on top.

That renders the test irrelevant, meaning you can just as well disable it for LUKS.

Quoted 38 lines
tests/qemu-iotests/120 +19 -3
+    SYSEMU_EXTRA_ARGS=""
+    IO_DRIVE_ARG="$TEST_IMG"
+    IO_EXTRA_ARGS="--image-opts"
+    if [ -n "$IMGKEYSECRET" ]; then
+	SECRET_ARG="secret,id=keysec0,data=$IMGKEYSECRET"
+	SYSEMU_EXTRA_ARGS="$SYSEMU_EXTRA_ARGS -object $SECRET_ARG"
+	IO_EXTRA_ARGS="$IO_EXTRA_ARGS --object $SECRET_ARG"
+    fi
+else
+    SYSEMU_DRIVE_ARG=id=drv,if=none,file="$TEST_IMG",driver=raw,file.driver=$IMGFMT
+    SYSEMU_EXTRA_ARGS=""
+    IO_DRIVE_ARG="json:{'driver': 'raw', 'file': {'driver': '$IMGFMT', 'file': {'filename': '$TEST_IMG'}}}"
+    IO_EXTRA_ARGS=""
+fi
+
+
 echo "{'execute': 'qmp_capabilities'}
       {'execute': 'human-monitor-command',
        'arguments': {'command-line': 'qemu-io drv \"write -P 42 0 64k\"'}}
       {'execute': 'quit'}" \
-    | $QEMU -qmp stdio -nographic -nodefaults \
-            -drive id=drv,if=none,file="$TEST_IMG",driver=raw,file.driver=$IMGFMT \
+    | $QEMU -qmp stdio -nographic -nodefaults $SYSEMU_EXTRA_ARGS \
+            -drive $SYSEMU_DRIVE_ARG \
     | _filter_qmp | _filter_qemu_io
 $QEMU_IO -c 'read -P 42 0 64k' "$TEST_IMG" | _filter_qemu_io
 
 $QEMU_IO_PROG -c 'read -P 42 0 64k' \
-    "json:{'driver': 'raw', 'file': {'driver': '$IMGFMT', 'file': {'filename': '$TEST_IMG'}}}" \
+    $IO_EXTRA_ARGS "$IO_DRIVE_ARG" \
     | _filter_qemu_io
 
 # success, all done
tests/qemu-iotests/140 +0 -0
index 49f9df4..afaa418 100755

tests/qemu-iotests/140 _make_test_img 64k · line 58

Quoted 8 lines
tests/qemu-iotests/140 +5 -0
@@ -51,8 +51,21 @@ _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=""
+    if [ -n "$IMGKEYSECRET" ]; then

Sometimes using "test" and sometimes "[" is even weirder.

tests/qemu-iotests/140 _make_test_img 64k · line 60

Quoted 2 lines
tests/qemu-iotests/140 +2 -0
+	SECRET_ARG="secret,id=keysec0,data=$IMGKEYSECRET"
+	SYSEMU_EXTRA_ARGS="-object $SECRET_ARG"

Spaces would probably be better than tabs.

tests/qemu-iotests/140 _make_test_img 64k · line 63

Quoted 3 lines
tests/qemu-iotests/140 +3 -0
+    fi
+else
+    SYSEMU_DRIVE_ARG=if=none,media=cdrom,id=drv,file="$TEST_IMG",driver=raw,file.driver=$IMGFMT

Not sure where you get the driver=raw,file.driver=$IMGFMT configuration from. The original just has format=$IMGFMT (equivalent to driver=$IMFGMT).

Quoted 19 lines
tests/qemu-iotests/140 +4 -1
+    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 +1 -1
index 1eca0e8..ab54972 100755
@@ -43,7 +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
+

tests/qemu-iotests/145 _supported_proto generic · line 56

Quoted 10 lines
tests/qemu-iotests/145 +10 -0
+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=raw,file.driver=$IMGFMT

Again, should be just driver=$IMGFMT.

Quoted 26 lines
tests/qemu-iotests/145 +6 -0
+    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
 
 # success, all done
 echo "*** done"
tests/qemu-iotests/157 +0 -2
index 8d939cb..9ba1720 100755
@@ -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"

tests/qemu-iotests/157 function run_qemu() · line 74

Quoted 10 lines
tests/qemu-iotests/157 +10 -0
+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=raw,file.driver=$IMGFMT

And once more.

Max

Quoted 16 lines
tests/qemu-iotests/157 +4 -1
+    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
#5 lore raw

PATCH v3 3/5 iotests: reduce PBKDF iterations when testing LUKS

In reply to 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 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
index 8407251..f62e618 100755
@@ -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
index 240ed06..7f99f5e 100644
@@ -114,7 +114,8 @@ _filter_img_create()
         -e "s# log_size=[0-9]\\+##g" \
         -e "s/archipelago:a/TEST_DIR\//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
index 3213765..b242518 100644
@@ -108,6 +108,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
#6 lore raw

PATCH v3 4/5 iotests: add more LUKS hash combination tests

In reply to Daniel P. Berrange

Add 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
index f62e618..5faf585 100755
@@ -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
#7 lore raw

PATCH v3 5/5 iotests: chown LUKS device before qemu-io launches

In reply to 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.

---
 tests/qemu-iotests/149     |  13 +-
 tests/qemu-iotests/149.out | 344 ++++++++++++++++++++++-----------------------
 2 files changed, 178 insertions(+), 179 deletions(-)
tests/qemu-iotests/149 +6 -7
index 5faf585..bc628ce 100755
@@ -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
#8 lore raw
In reply to Daniel P. Berrange

ping ?

Quoted 28 lines · Daniel P. Berrange

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 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

Quoted 17 lines
 tests/qemu-iotests/033           |   16 +-
 tests/qemu-iotests/120           |   25 +-
 tests/qemu-iotests/140           |   15 +-
 tests/qemu-iotests/145           |   18 +-
 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           |    2 +-
 tests/qemu-iotests/170           |    2 +-
 tests/qemu-iotests/common.filter |    3 +-
 tests/qemu-iotests/common.rc     |    3 +
 12 files changed, 847 insertions(+), 298 deletions(-)
Signature · 1 line
2.9.3

Regards,
Daniel

Signature · 3 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://entangle-photo.org       -o-    http://search.cpan.org/~danberr/ :|