]> git.ipfire.org Git - thirdparty/libvirt.git/commit
virStorageFileGetMetadataRecurse: Allow format probing under special circumstances
authorPeter Krempa <pkrempa@redhat.com>
Mon, 17 Feb 2020 09:08:25 +0000 (10:08 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 25 Feb 2020 20:14:27 +0000 (21:14 +0100)
commitae9e6c2a2b75d958995c661f7bb64ed4353a6404
tree2f3494a14b88db9accfae51dba380d97a3caad4b
parent3c6e6f55a5ded357c39b92629cd523e51f6ca8f9
virStorageFileGetMetadataRecurse: Allow format probing under special circumstances

Allow format probing to work around lazy clients which did not specify
their format in the overlay. Format probing will be allowed only, if we
are able to probe the image, the probing result was successful and the
probed image does not have any backing or data file.

This relaxes the restrictions which were imposed in commit 3615e8b39bad
in cases when we know that the image probing will not result in security
issues or data corruption.

We perform the image format detection and in the case that we were able
to probe the format and the format does not specify a backing store (or
doesn't support backing store) we can use this format.

With pre-blockdev configurations this will restore the previous
behaviour for the images mentioned above as qemu would probe the format
anyways. It also improves error reporting compared to the old state as
we now report that the backing chain will be broken in case when there
is a backing file.

In blockdev configurations this ensures that libvirt will not cause data
corruption by ending the chain prematurely without notifying the user,
but still allows the old semantics when the users forgot to specify the
format.

Users thus don't have to re-invent when image format detection is safe
to do.

The price for this is that libvirt will need to keep the image format
detector still current and working or replace it by invocation of
qemu-img.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
src/util/virstoragefile.c