summaryrefslogtreecommitdiffstats
path: root/tests/qemu-iotests
diff options
context:
space:
mode:
authorKevin Wolf2014-06-04 15:09:35 +0200
committerKevin Wolf2014-06-26 13:51:01 +0200
commit8ee79e707a005c9274df7ce34265bb7d008b8cef (patch)
treef8402fad14af55bef4457d8a5888db05d1d11fec /tests/qemu-iotests
parentblock: Remove second bdrv_open() recursion (diff)
downloadqemu-8ee79e707a005c9274df7ce34265bb7d008b8cef.tar.gz
qemu-8ee79e707a005c9274df7ce34265bb7d008b8cef.tar.xz
qemu-8ee79e707a005c9274df7ce34265bb7d008b8cef.zip
block: Catch backing files assigned to non-COW drivers
Since we parse backing.* options to add a backing file from the command line when the driver didn't assign one, it has been possible to have a backing file for e.g. raw images (it just was never accessed). This is obvious nonsense and should be rejected. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'tests/qemu-iotests')
-rwxr-xr-xtests/qemu-iotests/0515
-rw-r--r--tests/qemu-iotests/051.out9
2 files changed, 14 insertions, 0 deletions
diff --git a/tests/qemu-iotests/051 b/tests/qemu-iotests/051
index 30a712f847..a41334e022 100755
--- a/tests/qemu-iotests/051
+++ b/tests/qemu-iotests/051
@@ -100,6 +100,11 @@ echo
echo "info block" | run_qemu -drive file="$TEST_IMG",driver=qcow2,backing.file.filename="$TEST_IMG.orig" -nodefaults
+# Drivers that don't support backing files
+run_qemu -drive file="$TEST_IMG",driver=raw,backing.file.filename="$TEST_IMG.orig"
+run_qemu -drive file="$TEST_IMG",file.backing.driver=file,file.backing.filename="$TEST_IMG.orig"
+run_qemu -drive file="$TEST_IMG",file.backing.driver=qcow2,file.backing.file.filename="$TEST_IMG.orig"
+
echo
echo === Enable and disable lazy refcounting on the command line, plus some invalid values ===
echo
diff --git a/tests/qemu-iotests/051.out b/tests/qemu-iotests/051.out
index 94c7107250..d7b0f503af 100644
--- a/tests/qemu-iotests/051.out
+++ b/tests/qemu-iotests/051.out
@@ -53,6 +53,15 @@ ide0-hd0: TEST_DIR/t.qcow2 (qcow2)
Backing file: TEST_DIR/t.qcow2.orig (chain depth: 1)
(qemu) qququiquit
+Testing: -drive file=TEST_DIR/t.qcow2,driver=raw,backing.file.filename=TEST_DIR/t.qcow2.orig
+QEMU_PROG: -drive file=TEST_DIR/t.qcow2,driver=raw,backing.file.filename=TEST_DIR/t.qcow2.orig: could not open disk image TEST_DIR/t.qcow2: Driver doesn't support backing files
+
+Testing: -drive file=TEST_DIR/t.qcow2,file.backing.driver=file,file.backing.filename=TEST_DIR/t.qcow2.orig
+QEMU_PROG: -drive file=TEST_DIR/t.qcow2,file.backing.driver=file,file.backing.filename=TEST_DIR/t.qcow2.orig: could not open disk image TEST_DIR/t.qcow2: Driver doesn't support backing files
+
+Testing: -drive file=TEST_DIR/t.qcow2,file.backing.driver=qcow2,file.backing.file.filename=TEST_DIR/t.qcow2.orig
+QEMU_PROG: -drive file=TEST_DIR/t.qcow2,file.backing.driver=qcow2,file.backing.file.filename=TEST_DIR/t.qcow2.orig: could not open disk image TEST_DIR/t.qcow2: Driver doesn't support backing files
+
=== Enable and disable lazy refcounting on the command line, plus some invalid values ===