virstoragetest: Add test cases for QCOW2 files with a protocol name as backing file format

QEMU allows and in cases where you omit the not-strictly-needed 'raw'
driver on top of raw images automatically uses the protocol name inside
of the 'backing file format' field of the qcow2 image.

Libvirt expects only format names in that field.

Add example images showing this scenario, which will be fixed later.

The qcow2 image files in this commit were formatted as:

  qemu-img create -f qcow2 -F nbd -b  nbd+tcp://example.org:6000/blah -u qcow2-protocol-backing-nbd.qcow2 10M

and

  qemu-img create -f qcow2 -F file -b raw  qcow2-protocol-backing-file.qcow2

thus using 'nbd' and 'file' as backing format respectively.

(note that '-b raw' refers to the file in the example image folder)

To satisfy the test, note that the NBD image is also rejected as we
can't probe it, thus such configuration would not work.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2023-11-23 20:42:54 +01:00
parent 7e158006b6
commit 6fe9e35610
4 changed files with 29 additions and 0 deletions

View File

@ -478,6 +478,14 @@ mymain(void)
abs_srcdir "/virstoragetestdata/images/qcow2_qcow2-auto.qcow2", abs_srcdir "/virstoragetestdata/images/qcow2_qcow2-auto.qcow2",
VIR_STORAGE_FILE_QCOW2, EXP_PASS); VIR_STORAGE_FILE_QCOW2, EXP_PASS);
/* QCOW2 with protocol recorded inside the 'backing file format field */
TEST_CHAIN("qcow2-protocol-backing-file",
abs_srcdir "/virstoragetestdata/images/qcow2-protocol-backing-file.qcow2",
VIR_STORAGE_FILE_QCOW2, EXP_PASS);
TEST_CHAIN("qcow2-protocol-backing-nbd",
abs_srcdir "/virstoragetestdata/images/qcow2-protocol-backing-nbd.qcow2",
VIR_STORAGE_FILE_QCOW2, EXP_FAIL);
/* Qcow2 file with missing backing file but specified type */ /* Qcow2 file with missing backing file but specified type */
TEST_CHAIN("qcow2-qcow2_missing", TEST_CHAIN("qcow2-qcow2_missing",
abs_srcdir "/virstoragetestdata/images/qcow2_qcow2-missing.qcow2", abs_srcdir "/virstoragetestdata/images/qcow2_qcow2-missing.qcow2",

View File

@ -0,0 +1,21 @@
path:ABS_SRCDIR/virstoragetestdata/images/qcow2-protocol-backing-file.qcow2
backingStoreRaw: raw
backingStoreRawFormat: <null>(-1)
capacity: 1024
encryption: 0
relPath:<null>
type:file
format:qcow2
protocol:none
hostname:<null>
path:ABS_SRCDIR/virstoragetestdata/images/raw
backingStoreRaw: <null>
backingStoreRawFormat: none(0)
capacity: 0
encryption: 0
relPath:raw
type:file
format:raw
protocol:none
hostname:<null>