From: Peter Krempa <pkrempa@redhat.com>
Add an image example which specifies a 'backing_file' without
'backing_format' and the backing file has 'data_file'. This was obtained
by running a hacked qemu-img with bypassed requirement to specify backing
file format:
$ qemu-img create -f qcow2 -b datafile.qcow2 -u qcow2_datafile-auto.qcow2 1024
In the test directory.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
tests/virstoragetest.c | 7 +++-
.../images/qcow2_datafile-auto.qcow2 | Bin 0 -> 196616 bytes
.../qcow2datafile-qcow2_qcow2-datafile-auto | 31 ++++++++++++++++++
3 files changed, 37 insertions(+), 1 deletion(-)
create mode 100644 tests/virstoragetestdata/images/qcow2_datafile-auto.qcow2
create mode 100644 tests/virstoragetestdata/out/qcow2datafile-qcow2_qcow2-datafile-auto
diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c
index e568bd3141..1514991c20 100644
--- a/tests/virstoragetest.c
+++ b/tests/virstoragetest.c
@@ -488,13 +488,18 @@ mymain(void)
/* qcow2 + datafile
* 1) qcow2 image with data file
- * 2) qcow2 -> qcow2 backing image with data file */
+ * 2) qcow2 -> qcow2 backing image with data file
+ * 3) qcow2 (with no backing file format specified) -> qcow2 backing image with data file
+ */
TEST_CHAIN("qcow2-datafile",
abs_srcdir "/virstoragetestdata/images/datafile.qcow2",
VIR_STORAGE_FILE_QCOW2, EXP_PASS);
TEST_CHAIN("qcow2datafile-qcow2_qcow2-datafile",
abs_srcdir "/virstoragetestdata/images/qcow2datafile-datafile.qcow2",
VIR_STORAGE_FILE_QCOW2, EXP_PASS);
+ TEST_CHAIN("qcow2datafile-qcow2_qcow2-datafile-auto",
+ abs_srcdir "/virstoragetestdata/images/qcow2_datafile-auto.qcow2",
+ VIR_STORAGE_FILE_QCOW2, EXP_PASS);
/* broken qcow2 with a 'data_file' which is an empty string */
TEST_CHAIN("qcow2-datafile-broken",
diff --git a/tests/virstoragetestdata/images/qcow2_datafile-auto.qcow2 b/tests/virstoragetestdata/images/qcow2_datafile-auto.qcow2
new file mode 100644
index 0000000000000000000000000000000000000000..e8a6c2710b5841236b8360d260b751f60349e2fa
GIT binary patch
literal 196616
zcmeIuyH3L}7zWTkX=lVE<Ovx15J*TYOw4JUib!n|Qdgx+JT?*wN-qOT%HDG<`TE(G
z{qp$q6A_a*%7^+cBJNM)>8Xjxj-7MrJUY!?HyqMkVsDf0*NE&ZVp;d;P|WLeSsIru
z+P>d)>AySj>LXQsQ?83;naW~SudC4uCX05{_0@J;w@r}_-FP};I-K7ut7Y*#E2<{-
zb+sM2Ad7YRc_{j7wP<%u8jBv~F|X66?5+mS@~kiS#h*7{mPQSqGyKiN`=Z^?Mxy`#
z00000000000000000000000000000000000000000000000000000000000000000
z0000000000z%9sc;gJ9U000000000000000000000000000000000000000000000
z0000000000000000000000000000000F27c1poj50000000000000000000000000
u00000000000000000000000000000000000000000000000000BH|Zt@-@W(
literal 0
HcmV?d00001
diff --git a/tests/virstoragetestdata/out/qcow2datafile-qcow2_qcow2-datafile-auto b/tests/virstoragetestdata/out/qcow2datafile-qcow2_qcow2-datafile-auto
new file mode 100644
index 0000000000..421e0c8d5a
--- /dev/null
+++ b/tests/virstoragetestdata/out/qcow2datafile-qcow2_qcow2-datafile-auto
@@ -0,0 +1,31 @@
+path:ABS_SRCDIR/virstoragetestdata/images/qcow2_datafile-auto.qcow2
+backingStoreRaw: datafile.qcow2
+backingStoreRawFormat: <null>(-1)
+dataFileRaw: <null>
+capacity: 1024
+encryption: 0
+relPath:<null>
+type:file
+format:qcow2
+protocol:none
+hostname:<null>
+
+path:ABS_SRCDIR/virstoragetestdata/images/datafile.qcow2
+backingStoreRaw: <null>
+backingStoreRawFormat: none(0)
+dataFileRaw: raw
+capacity: 1024
+encryption: 0
+relPath:datafile.qcow2
+type:file
+format:qcow2
+protocol:none
+hostname:<null>
+
+ dataFileStoreSource for 'ABS_SRCDIR/virstoragetestdata/images/datafile.qcow2':
+ path: ABS_SRCDIR/virstoragetestdata/images/raw
+ capacity: 0
+ encryption: 0
+ type:file
+ format:raw
+
--
2.55.0
© 2016 - 2026 Red Hat, Inc.