[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 10/10] iotests: qcow2's encrypt.format is now opt
From: |
Max Reitz |
Subject: |
[Qemu-devel] [PATCH v2 10/10] iotests: qcow2's encrypt.format is now optional |
Date: |
Mon, 11 Jun 2018 22:52:03 +0200 |
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 <address@hidden>
---
tests/qemu-iotests/087 | 65 +++++++++++++++++++++++---------------
tests/qemu-iotests/087.out | 26 ++++++++++++++-
2 files changed, 64 insertions(+), 27 deletions(-)
diff --git a/tests/qemu-iotests/087 b/tests/qemu-iotests/087
index 2561a14456..a267adf568 100755
--- a/tests/qemu-iotests/087
+++ b/tests/qemu-iotests/087
@@ -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 ===
diff --git a/tests/qemu-iotests/087.out b/tests/qemu-iotests/087.out
index b1318c6ed6..40b0a96ba7 100644
--- a/tests/qemu-iotests/087.out
+++ b/tests/qemu-iotests/087.out
@@ -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 ===
--
2.17.1
- Re: [Qemu-devel] [PATCH v2 04/10] qapi: Formalize qcow2 encryption probing, (continued)
- [Qemu-devel] [PATCH v2 05/10] qapi: Formalize qcow encryption probing, Max Reitz, 2018/06/11
- [Qemu-devel] [PATCH v2 06/10] qdict: Make qdict_flatten() shallow-clone-friendly, Max Reitz, 2018/06/11
- [Qemu-devel] [PATCH v2 07/10] tests: Add QDict clone-flatten test, Max Reitz, 2018/06/11
- [Qemu-devel] [PATCH v2 08/10] block: Try to create well typed json:{} filenames, Max Reitz, 2018/06/11
- [Qemu-devel] [PATCH v2 09/10] iotests: Test internal option typing, Max Reitz, 2018/06/11
- [Qemu-devel] [PATCH v2 10/10] iotests: qcow2's encrypt.format is now optional,
Max Reitz <=
- Re: [Qemu-devel] [PATCH v2 00/10] block: Try to create well typed json:{} filenames, Markus Armbruster, 2018/06/19