From 73ac451f3435910433900d7d01a1cac6ccb401e6 Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Mon, 14 Mar 2016 15:46:03 +0100 Subject: block: Reject writethrough mode except at the root Writethrough mode is going to become a BlockBackend feature rather than a BDS one, so forbid it in places where we won't be able to support it when the code finally matches the envisioned design. We only allowed setting the cache mode of non-root nodes after the 2.5 release, so we're still free to make this change. The target of block jobs is now always opened in a writeback mode because it doesn't have a BlockBackend attached. This makes more sense anyway because block jobs know when to flush. If the graph is modified on job completion, the original cache mode moves to the new root, so for the guest device writethough always stays enabled if it was configured this way. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- tests/qemu-iotests/142.out | 98 +++++++++------------------------------------- 1 file changed, 19 insertions(+), 79 deletions(-) (limited to 'tests/qemu-iotests/142.out') diff --git a/tests/qemu-iotests/142.out b/tests/qemu-iotests/142.out index abe94c3..5dd5bd0 100644 --- a/tests/qemu-iotests/142.out +++ b/tests/qemu-iotests/142.out @@ -66,22 +66,13 @@ cache.writeback=off on none0 Cache mode: writeback cache.writeback=off on file - Cache mode: writeback - Cache mode: writethrough - Cache mode: writeback - Cache mode: writeback +QEMU_PROG: -drive if=none,file=TEST_DIR/t.qcow2,backing.file.filename=TEST_DIR/t.qcow2.base,node-name=image,backing.node-name=backing,backing.file.node-name=backing-file,file.node-name=file,file.cache.writeback=off: Can't set writethrough mode except for the root cache.writeback=off on backing - Cache mode: writeback - Cache mode: writeback - Cache mode: writethrough - Cache mode: writeback +QEMU_PROG: -drive if=none,file=TEST_DIR/t.qcow2,backing.file.filename=TEST_DIR/t.qcow2.base,node-name=image,backing.node-name=backing,backing.file.node-name=backing-file,file.node-name=file,backing.cache.writeback=off: Could not open backing file: Can't set writethrough mode except for the root cache.writeback=off on backing-file - Cache mode: writeback - Cache mode: writeback - Cache mode: writeback - Cache mode: writethrough +QEMU_PROG: -drive if=none,file=TEST_DIR/t.qcow2,backing.file.filename=TEST_DIR/t.qcow2.base,node-name=image,backing.node-name=backing,backing.file.node-name=backing-file,file.node-name=file,backing.file.cache.writeback=off: Could not open backing file: Can't set writethrough mode except for the root cache.no-flush=on on none0 @@ -147,25 +138,13 @@ cache.writeback=off on none0 Cache mode: writeback cache.writeback=off on file - Cache mode: writeback - Cache mode: writeback - Cache mode: writethrough - Cache mode: writeback - Cache mode: writeback +QEMU_PROG: -drive if=none,file=TEST_DIR/t.qcow2,backing.file.filename=TEST_DIR/t.qcow2.base,node-name=image,backing.node-name=backing,backing.file.node-name=backing-file,file.node-name=file,file.cache.writeback=off: Can't set writethrough mode except for the root cache.writeback=off on backing - Cache mode: writeback - Cache mode: writeback - Cache mode: writeback - Cache mode: writethrough - Cache mode: writeback +QEMU_PROG: -drive if=none,file=TEST_DIR/t.qcow2,backing.file.filename=TEST_DIR/t.qcow2.base,node-name=image,backing.node-name=backing,backing.file.node-name=backing-file,file.node-name=file,backing.cache.writeback=off: Could not open backing file: Can't set writethrough mode except for the root cache.writeback=off on backing-file - Cache mode: writeback - Cache mode: writeback - Cache mode: writeback - Cache mode: writeback - Cache mode: writethrough +QEMU_PROG: -drive if=none,file=TEST_DIR/t.qcow2,backing.file.filename=TEST_DIR/t.qcow2.base,node-name=image,backing.node-name=backing,backing.file.node-name=backing-file,file.node-name=file,backing.file.cache.writeback=off: Could not open backing file: Can't set writethrough mode except for the root cache.no-flush=on on none0 @@ -230,22 +209,13 @@ cache.writeback=off on none0 Cache mode: writeback, direct cache.writeback=off on file - Cache mode: writeback, direct - Cache mode: writethrough, direct - Cache mode: writeback, direct - Cache mode: writeback, direct +QEMU_PROG: -drive if=none,file=TEST_DIR/t.qcow2,backing.file.filename=TEST_DIR/t.qcow2.base,node-name=image,backing.node-name=backing,backing.file.node-name=backing-file,file.node-name=file,file.cache.writeback=off: Can't set writethrough mode except for the root cache.writeback=off on backing - Cache mode: writeback, direct - Cache mode: writeback, direct - Cache mode: writethrough, direct - Cache mode: writeback, direct +QEMU_PROG: -drive if=none,file=TEST_DIR/t.qcow2,backing.file.filename=TEST_DIR/t.qcow2.base,node-name=image,backing.node-name=backing,backing.file.node-name=backing-file,file.node-name=file,backing.cache.writeback=off: Could not open backing file: Can't set writethrough mode except for the root cache.writeback=off on backing-file - Cache mode: writeback, direct - Cache mode: writeback, direct - Cache mode: writeback, direct - Cache mode: writethrough, direct +QEMU_PROG: -drive if=none,file=TEST_DIR/t.qcow2,backing.file.filename=TEST_DIR/t.qcow2.base,node-name=image,backing.node-name=backing,backing.file.node-name=backing-file,file.node-name=file,backing.file.cache.writeback=off: Could not open backing file: Can't set writethrough mode except for the root cache.no-flush=on on none0 @@ -306,22 +276,13 @@ cache.writeback=off on none0 Cache mode: writeback, direct cache.writeback=off on file - Cache mode: writeback, direct - Cache mode: writethrough, direct - Cache mode: writeback, direct - Cache mode: writeback, direct +QEMU_PROG: -drive if=none,file=TEST_DIR/t.qcow2,backing.file.filename=TEST_DIR/t.qcow2.base,node-name=image,backing.node-name=backing,backing.file.node-name=backing-file,file.node-name=file,file.cache.writeback=off: Can't set writethrough mode except for the root cache.writeback=off on backing - Cache mode: writeback, direct - Cache mode: writeback, direct - Cache mode: writethrough, direct - Cache mode: writeback, direct +QEMU_PROG: -drive if=none,file=TEST_DIR/t.qcow2,backing.file.filename=TEST_DIR/t.qcow2.base,node-name=image,backing.node-name=backing,backing.file.node-name=backing-file,file.node-name=file,backing.cache.writeback=off: Could not open backing file: Can't set writethrough mode except for the root cache.writeback=off on backing-file - Cache mode: writeback, direct - Cache mode: writeback, direct - Cache mode: writeback, direct - Cache mode: writethrough, direct +QEMU_PROG: -drive if=none,file=TEST_DIR/t.qcow2,backing.file.filename=TEST_DIR/t.qcow2.base,node-name=image,backing.node-name=backing,backing.file.node-name=backing-file,file.node-name=file,backing.file.cache.writeback=off: Could not open backing file: Can't set writethrough mode except for the root cache.no-flush=on on none0 @@ -387,25 +348,13 @@ cache.writeback=off on none0 Cache mode: writeback cache.writeback=off on file - Cache mode: writeback, direct - Cache mode: writeback - Cache mode: writethrough - Cache mode: writeback - Cache mode: writeback +QEMU_PROG: -drive if=none,file=TEST_DIR/t.qcow2,backing.file.filename=TEST_DIR/t.qcow2.base,node-name=image,backing.node-name=backing,backing.file.node-name=backing-file,file.node-name=file,file.cache.writeback=off: Can't set writethrough mode except for the root cache.writeback=off on backing - Cache mode: writeback, direct - Cache mode: writeback - Cache mode: writeback - Cache mode: writethrough - Cache mode: writeback +QEMU_PROG: -drive if=none,file=TEST_DIR/t.qcow2,backing.file.filename=TEST_DIR/t.qcow2.base,node-name=image,backing.node-name=backing,backing.file.node-name=backing-file,file.node-name=file,backing.cache.writeback=off: Could not open backing file: Can't set writethrough mode except for the root cache.writeback=off on backing-file - Cache mode: writeback, direct - Cache mode: writeback - Cache mode: writeback - Cache mode: writeback - Cache mode: writethrough +QEMU_PROG: -drive if=none,file=TEST_DIR/t.qcow2,backing.file.filename=TEST_DIR/t.qcow2.base,node-name=image,backing.node-name=backing,backing.file.node-name=backing-file,file.node-name=file,backing.file.cache.writeback=off: Could not open backing file: Can't set writethrough mode except for the root cache.no-flush=on on none0 @@ -440,7 +389,7 @@ cache.no-flush=on on backing-file Cache mode: writethrough, direct, ignore flushes Cache mode: writeback, direct, ignore flushes - Cache mode: writethrough, ignore flushes + Cache mode: writeback, ignore flushes === Check that referenced BDSes don't inherit === @@ -722,22 +671,13 @@ cache.writeback=off on none0 Cache mode: writeback, direct cache.writeback=off on file - Cache mode: writeback - Cache mode: writethrough - Cache mode: writeback, direct - Cache mode: writeback, direct +QEMU_PROG: -drive if=none,file=TEST_DIR/t.qcow2,backing.file.filename=TEST_DIR/t.qcow2.base,node-name=image,backing.node-name=backing,backing.file.node-name=backing-file,file.node-name=file,file.cache.writeback=off: Can't set writethrough mode except for the root cache.writeback=off on backing - Cache mode: writeback - Cache mode: writeback - Cache mode: writethrough, direct - Cache mode: writeback, direct +QEMU_PROG: -drive if=none,file=TEST_DIR/t.qcow2,backing.file.filename=TEST_DIR/t.qcow2.base,node-name=image,backing.node-name=backing,backing.file.node-name=backing-file,file.node-name=file,backing.cache.writeback=off: Could not open backing file: Can't set writethrough mode except for the root cache.writeback=off on backing-file - Cache mode: writeback - Cache mode: writeback - Cache mode: writeback, direct - Cache mode: writethrough, direct +QEMU_PROG: -drive if=none,file=TEST_DIR/t.qcow2,backing.file.filename=TEST_DIR/t.qcow2.base,node-name=image,backing.node-name=backing,backing.file.node-name=backing-file,file.node-name=file,backing.file.cache.writeback=off: Could not open backing file: Can't set writethrough mode except for the root cache.no-flush=on on none0 -- cgit v1.1