]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virstoragetest: Add case for qcow2 image with empty string as 'data_file'
authorPeter Krempa <pkrempa@redhat.com>
Thu, 9 Jan 2025 14:18:58 +0000 (15:18 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 20 Jan 2025 12:25:51 +0000 (13:25 +0100)
Add an example image formatted by:

 qemu-img create -f qcow2 -o data_file=nbd+unix:///datafile?socket=/tmp/nbd,data_file_raw=true /tmp/nbddatastore.qcow2 10M -u

serving as an example when qemu records an empty string as the
'data_file' field.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
tests/virstoragetest.c
tests/virstoragetestdata/images/datafile-emptystr.qcow2 [new file with mode: 0644]

index 4ec837eefb3f87f503658d9933b85e08be755921..78dc6446379674332da85a19c42cd66257d812c4 100644 (file)
@@ -494,6 +494,11 @@ mymain(void)
                abs_srcdir "/virstoragetestdata/images/qcow2datafile-datafile.qcow2",
                VIR_STORAGE_FILE_QCOW2, EXP_PASS);
 
+    /* broken qcow2 with a 'data_file' which is an empty string */
+    TEST_CHAIN("qcow2-datafile-broken",
+               abs_srcdir "/virstoragetestdata/images/datafile-emptystr.qcow2",
+               VIR_STORAGE_FILE_QCOW2, EXP_FAIL);
+
     /* Test various combinations of qcow2 images with missing 'backing_format' */
     TEST_CHAIN("qcow2-qcow2_qcow2-qcow2_qcow2-auto",
                abs_srcdir "/virstoragetestdata/images/qcow2_qcow2-qcow2_qcow2-auto.qcow2",
diff --git a/tests/virstoragetestdata/images/datafile-emptystr.qcow2 b/tests/virstoragetestdata/images/datafile-emptystr.qcow2
new file mode 100644 (file)
index 0000000..18fae87
Binary files /dev/null and b/tests/virstoragetestdata/images/datafile-emptystr.qcow2 differ