]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virstoragetest: Reinstate testing of images without 'backing_fmt'
authorPeter Krempa <pkrempa@redhat.com>
Wed, 8 Sep 2021 15:57:30 +0000 (17:57 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 9 Sep 2021 13:29:00 +0000 (15:29 +0200)
There are important security implications when we'd misprobe those
images. This commit reinstates the tests removed by commit 979d1ba3ae13
since 'qemu-img' refused to format them.

With the new testing approach with stored images we won't run into that
problem.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
tests/virstoragetest.c
tests/virstoragetestdata/images/qcow2 [new file with mode: 0644]
tests/virstoragetestdata/images/qcow2_qcow2-auto.qcow2 [new file with mode: 0644]
tests/virstoragetestdata/images/qcow2_qcow2-auto_qcow2-auto.qcow2 [new file with mode: 0644]
tests/virstoragetestdata/images/qcow2_qcow2-qcow2_qcow2-auto.qcow2 [new file with mode: 0644]
tests/virstoragetestdata/images/qcow2_qcow2-qcow2_raw-auto.qcow2 [new file with mode: 0644]
tests/virstoragetestdata/images/qcow2_raw-auto.qcow2 [new file with mode: 0644]
tests/virstoragetestdata/out/qcow2-qcow2_qcow2-auto [new file with mode: 0644]
tests/virstoragetestdata/out/qcow2-qcow2_qcow2-qcow2_qcow2-auto [new file with mode: 0644]
tests/virstoragetestdata/out/qcow2-qcow2_qcow2-qcow2_raw-auto [new file with mode: 0644]

index 513ffdeb41ce5d05c3e98cc7fac9b758a3833247..ec185d8660d8eb5eb9bdc4e19409d6cbba091b21 100644 (file)
@@ -464,6 +464,20 @@ mymain(void)
 
     testCleanupImages();
 
+    /* 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",
+               VIR_STORAGE_FILE_QCOW2, EXP_PASS);
+    TEST_CHAIN("qcow2-qcow2_qcow2-qcow2_raw-auto",
+               abs_srcdir "/virstoragetestdata/images/qcow2_qcow2-qcow2_raw-auto.qcow2",
+               VIR_STORAGE_FILE_QCOW2, EXP_PASS);
+    TEST_CHAIN("qcow2-qcow2_qcow2-auto_qcow2-auto",
+               abs_srcdir "/virstoragetestdata/images/qcow2_qcow2-auto_qcow2-auto.qcow2",
+               VIR_STORAGE_FILE_QCOW2, EXP_FAIL);
+    TEST_CHAIN("qcow2-qcow2_qcow2-auto",
+               abs_srcdir "/virstoragetestdata/images/qcow2_qcow2-auto.qcow2",
+               VIR_STORAGE_FILE_QCOW2, EXP_PASS);
+
     /* Qcow2 file with missing backing file but specified type */
     TEST_CHAIN("qcow2-qcow2_missing",
                abs_srcdir "/virstoragetestdata/images/qcow2_qcow2-missing.qcow2",
diff --git a/tests/virstoragetestdata/images/qcow2 b/tests/virstoragetestdata/images/qcow2
new file mode 100644 (file)
index 0000000..31a144e
Binary files /dev/null and b/tests/virstoragetestdata/images/qcow2 differ
diff --git a/tests/virstoragetestdata/images/qcow2_qcow2-auto.qcow2 b/tests/virstoragetestdata/images/qcow2_qcow2-auto.qcow2
new file mode 100644 (file)
index 0000000..4904821
Binary files /dev/null and b/tests/virstoragetestdata/images/qcow2_qcow2-auto.qcow2 differ
diff --git a/tests/virstoragetestdata/images/qcow2_qcow2-auto_qcow2-auto.qcow2 b/tests/virstoragetestdata/images/qcow2_qcow2-auto_qcow2-auto.qcow2
new file mode 100644 (file)
index 0000000..3b27b25
Binary files /dev/null and b/tests/virstoragetestdata/images/qcow2_qcow2-auto_qcow2-auto.qcow2 differ
diff --git a/tests/virstoragetestdata/images/qcow2_qcow2-qcow2_qcow2-auto.qcow2 b/tests/virstoragetestdata/images/qcow2_qcow2-qcow2_qcow2-auto.qcow2
new file mode 100644 (file)
index 0000000..8b9c3ce
Binary files /dev/null and b/tests/virstoragetestdata/images/qcow2_qcow2-qcow2_qcow2-auto.qcow2 differ
diff --git a/tests/virstoragetestdata/images/qcow2_qcow2-qcow2_raw-auto.qcow2 b/tests/virstoragetestdata/images/qcow2_qcow2-qcow2_raw-auto.qcow2
new file mode 100644 (file)
index 0000000..90b0a9a
Binary files /dev/null and b/tests/virstoragetestdata/images/qcow2_qcow2-qcow2_raw-auto.qcow2 differ
diff --git a/tests/virstoragetestdata/images/qcow2_raw-auto.qcow2 b/tests/virstoragetestdata/images/qcow2_raw-auto.qcow2
new file mode 100644 (file)
index 0000000..c942c38
Binary files /dev/null and b/tests/virstoragetestdata/images/qcow2_raw-auto.qcow2 differ
diff --git a/tests/virstoragetestdata/out/qcow2-qcow2_qcow2-auto b/tests/virstoragetestdata/out/qcow2-qcow2_qcow2-auto
new file mode 100644 (file)
index 0000000..e23c43f
--- /dev/null
@@ -0,0 +1,19 @@
+path:ABS_SRCDIR/virstoragetestdata/images/qcow2_qcow2-auto.qcow2
+backingStoreRaw: qcow2
+capacity: 1024
+encryption: 0
+relPath:<null>
+type:1
+format:14
+protocol:none
+hostname:<null>
+
+path:ABS_SRCDIR/virstoragetestdata/images/qcow2
+backingStoreRaw: <null>
+capacity: 1024
+encryption: 0
+relPath:qcow2
+type:1
+format:14
+protocol:none
+hostname:<null>
diff --git a/tests/virstoragetestdata/out/qcow2-qcow2_qcow2-qcow2_qcow2-auto b/tests/virstoragetestdata/out/qcow2-qcow2_qcow2-qcow2_qcow2-auto
new file mode 100644 (file)
index 0000000..17f53f3
--- /dev/null
@@ -0,0 +1,29 @@
+path:ABS_SRCDIR/virstoragetestdata/images/qcow2_qcow2-qcow2_qcow2-auto.qcow2
+backingStoreRaw: qcow2_qcow2-auto.qcow2
+capacity: 1024
+encryption: 0
+relPath:<null>
+type:1
+format:14
+protocol:none
+hostname:<null>
+
+path:ABS_SRCDIR/virstoragetestdata/images/qcow2_qcow2-auto.qcow2
+backingStoreRaw: qcow2
+capacity: 1024
+encryption: 0
+relPath:qcow2_qcow2-auto.qcow2
+type:1
+format:14
+protocol:none
+hostname:<null>
+
+path:ABS_SRCDIR/virstoragetestdata/images/qcow2
+backingStoreRaw: <null>
+capacity: 1024
+encryption: 0
+relPath:qcow2
+type:1
+format:14
+protocol:none
+hostname:<null>
diff --git a/tests/virstoragetestdata/out/qcow2-qcow2_qcow2-qcow2_raw-auto b/tests/virstoragetestdata/out/qcow2-qcow2_qcow2-qcow2_raw-auto
new file mode 100644 (file)
index 0000000..1be5a82
--- /dev/null
@@ -0,0 +1,29 @@
+path:ABS_SRCDIR/virstoragetestdata/images/qcow2_qcow2-qcow2_raw-auto.qcow2
+backingStoreRaw: qcow2_raw-auto.qcow2
+capacity: 1024
+encryption: 0
+relPath:<null>
+type:1
+format:14
+protocol:none
+hostname:<null>
+
+path:ABS_SRCDIR/virstoragetestdata/images/qcow2_raw-auto.qcow2
+backingStoreRaw: raw
+capacity: 1024
+encryption: 0
+relPath:qcow2_raw-auto.qcow2
+type:1
+format:14
+protocol:none
+hostname:<null>
+
+path:ABS_SRCDIR/virstoragetestdata/images/raw
+backingStoreRaw: <null>
+capacity: 0
+encryption: 0
+relPath:raw
+type:1
+format:1
+protocol:none
+hostname:<null>