qcow: Tolerate backing_fmt=
commit344acbd62ffdbeb7f803644ad46a8129059f6823
authorEric Blake <eblake@redhat.com>
Mon, 6 Jul 2020 20:39:49 +0000 (6 15:39 -0500)
committerKevin Wolf <kwolf@redhat.com>
Tue, 14 Jul 2020 13:18:59 +0000 (14 15:18 +0200)
tree6af33f4e0d9b5172e5456fce3c6346d5bf375fd5
parentd51a814cf41033d2d29b050e04d85155ac941221
qcow: Tolerate backing_fmt=

qcow has no space in the metadata to store a backing format, and there
are existing qcow images backed both by raw or by other formats
(usually qcow) images, reliant on probing to tell the difference.  On
the bright side, because we probe every time, raw files are marked as
probed and we thus forbid a commit action into the backing file where
guest-controlled contents could change the result of the probe next
time around (the iotest added here proves that).

Still, allowing the user to specify the backing format during
creation, even if we can't record it, is a good thing.  This patch
blindly allows any value that resolves to a known driver, even if the
user's request is a mismatch from what probing finds; then the next
patch will further enhance things to verify that the user's request
matches what we actually probe.  With this and the next patch in
place, we will finally be ready to deprecate the creation of images
where a backing format was not explicitly specified by the user.

Note that this is only for QemuOpts usage; there is no change to the
QAPI to allow a format through -blockdev.

Add a new iotest 301 just for qcow, to demonstrate the latest
behavior, and to make it easier to show the improvements made in the
next patch.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20200706203954.341758-6-eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/qcow.c
tests/qemu-iotests/301 [new file with mode: 0755]
tests/qemu-iotests/301.out [new file with mode: 0644]
tests/qemu-iotests/group