@@ -150,7 +150,6 @@ run_qemu <<EOF
"filename": "$TEST_IMG"
},
"encrypt": {
- "format": "aes",
"key-secret": "sec0"
}
}
@@ -162,34 +161,48 @@ echo
echo === Encrypted image LUKS ===
echo
-_make_test_img --object secret,id=sec0,data=123456 -o encrypt.format=luks,encrypt.key-secret=sec0 $size
-run_qemu <<EOF
-{ "execute": "qmp_capabilities" }
-{ "execute": "object-add",
- "arguments": {
- "qom-type": "secret",
- "id": "sec0",
- "props": {
- "data": "123456"
- }
- }
-}
-{ "execute": "blockdev-add",
- "arguments": {
- "driver": "$IMGFMT",
- "node-name": "disk",
- "file": {
- "driver": "file",
- "filename": "$TEST_IMG"
- },
- "encrypt": {
- "format": "luks",
- "key-secret": "sec0"
+_make_test_img \
+ --object secret,id=sec0,data=123456 \
+ -o encrypt.format=luks,encrypt.key-secret=sec0,encrypt.iter-time=10 \
+ $size
+
+# Adds the qcow2+LUKS image via blockdev-add.
+# First parameter: Optional entry for the 'encrypt' option dict
+function luks_test()
+{
+ run_qemu <<EOF
+ { "execute": "qmp_capabilities" }
+ { "execute": "object-add",
+ "arguments": {
+ "qom-type": "secret",
+ "id": "sec0",
+ "props": {
+ "data": "123456"
+ }
}
}
- }
-{ "execute": "quit" }
+ { "execute": "blockdev-add",
+ "arguments": {
+ "driver": "$IMGFMT",
+ "node-name": "disk",
+ "file": {
+ "driver": "file",
+ "filename": "$TEST_IMG"
+ },
+ "encrypt": {
+ $1
+ "key-secret": "sec0"
+ }
+ }
+ }
+ { "execute": "quit" }
EOF
+}
+
+luks_test '' # Implicit encrypt.format=auto
+luks_test '"format": "auto",' # Explicit encrypt.format=auto
+luks_test '"format": "luks",' # Explicit encrypt.format=luks
+luks_test '"format": "aes",' # Explicit encrypt.format=aes (wrong)
echo
echo === Missing driver ===
@@ -46,7 +46,7 @@ QMP_VERSION
=== Encrypted image LUKS ===
-Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 encrypt.format=luks encrypt.key-secret=sec0
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 encrypt.format=luks encrypt.key-secret=sec0 encrypt.iter-time=10
Testing:
QMP_VERSION
{"return": {}}
@@ -55,6 +55,30 @@ QMP_VERSION
{"return": {}}
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+Testing:
+QMP_VERSION
+{"return": {}}
+{"return": {}}
+{"return": {}}
+{"return": {}}
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+
+Testing:
+QMP_VERSION
+{"return": {}}
+{"return": {}}
+{"return": {}}
+{"return": {}}
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+
+Testing:
+QMP_VERSION
+{"return": {}}
+{"return": {}}
+{"error": {"class": "GenericError", "desc": "Header reported 'luks' encryption format but options specify 'aes'"}}
+{"return": {}}
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+
=== Missing driver ===
Remove the encrypt.format option from the two blockdev-add test cases for encrypted qcow2 images in 087 to explicitly test that this parameter is now optional. Additionally, show that explicitly specifying encrypt.format=auto works just as well, the same for specifying the correct format (encrypt.format=luks here), and that specifying the wrong format (encrypt.format=aes) results in an error. While touching this test case, reduce the LUKS iteration time to 10 so the test stays reasonably fast. Signed-off-by: Max Reitz <mreitz@redhat.com> --- tests/qemu-iotests/087 | 65 +++++++++++++++++++++++--------------- tests/qemu-iotests/087.out | 26 ++++++++++++++- 2 files changed, 64 insertions(+), 27 deletions(-)