From 4f7aaa1b7b25ff8cbe6a1113794c3d10bbb8bd7b Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Wed, 8 Sep 2021 17:57:30 +0200 Subject: [PATCH] virstoragetest: Reinstate testing of images without 'backing_fmt' MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Ján Tomko --- tests/virstoragetest.c | 14 +++++++++ tests/virstoragetestdata/images/qcow2 | Bin 0 -> 196616 bytes .../images/qcow2_qcow2-auto.qcow2 | Bin 0 -> 196616 bytes .../images/qcow2_qcow2-auto_qcow2-auto.qcow2 | Bin 0 -> 196616 bytes .../images/qcow2_qcow2-qcow2_qcow2-auto.qcow2 | Bin 0 -> 196616 bytes .../images/qcow2_qcow2-qcow2_raw-auto.qcow2 | Bin 0 -> 196616 bytes .../images/qcow2_raw-auto.qcow2 | Bin 0 -> 196616 bytes .../out/qcow2-qcow2_qcow2-auto | 19 ++++++++++++ .../out/qcow2-qcow2_qcow2-qcow2_qcow2-auto | 29 ++++++++++++++++++ .../out/qcow2-qcow2_qcow2-qcow2_raw-auto | 29 ++++++++++++++++++ 10 files changed, 91 insertions(+) create mode 100644 tests/virstoragetestdata/images/qcow2 create mode 100644 tests/virstoragetestdata/images/qcow2_qcow2-auto.qcow2 create mode 100644 tests/virstoragetestdata/images/qcow2_qcow2-auto_qcow2-auto.qcow2 create mode 100644 tests/virstoragetestdata/images/qcow2_qcow2-qcow2_qcow2-auto.qcow2 create mode 100644 tests/virstoragetestdata/images/qcow2_qcow2-qcow2_raw-auto.qcow2 create mode 100644 tests/virstoragetestdata/images/qcow2_raw-auto.qcow2 create mode 100644 tests/virstoragetestdata/out/qcow2-qcow2_qcow2-auto create mode 100644 tests/virstoragetestdata/out/qcow2-qcow2_qcow2-qcow2_qcow2-auto create mode 100644 tests/virstoragetestdata/out/qcow2-qcow2_qcow2-qcow2_raw-auto diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c index 513ffdeb41..ec185d8660 100644 --- a/tests/virstoragetest.c +++ b/tests/virstoragetest.c @@ -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 index 0000000000000000000000000000000000000000..31a144e4b947692c834363797fa34457edc2094c GIT binary patch literal 196616 zc-rmIu};G<5CBl8;RE;te*+(Zgv7$c92!?dYLm!u1!dy1kyvPf4qe(X^PVMJC;3iy z_i%gn8A7PTsq3HT>KIqwcYP97VV*;g@fbYUACLRg_Ym4HmtB17%DgJoa>#i*mbn>= z^jcExn{{lP(!^D_PG|qu%V9I-G)>*m$FdvKrKt|}`!==l{wAir`%7Mnuji@sGlXT`kNfyikMp`@RonO5 zZk$_@r}r`SO}UQCaxCMjUZ;!ii>lppeHwYiW&DhszxHNuP zmmmAsr&ZN%n{l{0ewg;$l-)4%lk==EckyiJS#@t!yITYR00000000000000000000 z00000000000000000000000000000000000000000000000000000000DzO+7XSbN z00000000000000000000000000000000000000000000000000000000000000000 z0000000000{CnBy00000000000000000000000000000000000000000000000000 d00000000000000000000000000002M5xLToI{FLgK2FiO)u2AuVO-(q`{_mQOy( zck=n^{^2KtFb#W?UAP(c^Y-TU}cw4MfbGJVR00000 z00000000000000000000000000000000000000000000000000000000000000000 z00000007`pO?&|W00000000000000000000000000000000000000000000000000 z00000000000000000000000000Kmn|4hsMP000000000000000000000000000000 q00000000000000000000000000000000000000000000000zGizBsS| literal 0 Hc-jL100001 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 index 0000000000000000000000000000000000000000..8b9c3cedeacf4aef8c7645314ecb68c992d4b51d GIT binary patch literal 196616 zc-rmJF;2rU6aY}Cg`J5xGZG9O0ttzQi4ldwh)5*~i7O}*=i?Zh0*QrCVCd3j?|YGd z{3ZL#-@d-M{0bq=!`kd<49DX*`ppl*pKKlH8(9{n`6<%yAZ6pOqnQjy=+i@0_Dylfx4J`O|OHhEfg zaaWf=^_wbI`PF$Io7C5F*mnG|C|*~2AMeX{*`#6T@x$2XW6=#0FMXEv#dE&V^Q3+2 zce!21(_)$0v;T(z00000000000000000000000000000000000000000000000000 z0000000000000000000000000008#G%oP9t000000000000000000000000000000 z0000000000000000000000000000000000000000000000PMZ&?*jk;0000000000 z00000000000000000000000000000000000000000000000000000000000000000 GfYCRgr#%1w literal 0 Hc-jL100001 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 index 0000000000000000000000000000000000000000..90b0a9a0594bc7e1e00dea41825fcf7996c7fc33 GIT binary patch literal 196616 zc-rmJF;2rU6aY}Cg`I%|WJZF4Lm(lsFfpRg7!j!?A#nv^;(Q!~Qy{Sr3JhJ^?0qk? z<1hJt`P1fk;DNHjQLKs1SaX0ExFc2~Q5 zcYX67LRf`QWtjh$U-3nl6(Rg)%~27SIX3CPgU8j|{Z#rILfs7c5FeVntV^-(hGF05 zr4?m*&S_|?ZLF(Y#Z9wKC-Yb9Zr2ZK9Gk9<`Ov3xTOIqib*kg-RZMLjnlzpoKWwX) zLmbj(-R;{vo*h3-d+w@!TzKTN7^ +type:1 +format:14 +protocol:none +hostname: + +path:ABS_SRCDIR/virstoragetestdata/images/qcow2 +backingStoreRaw: +capacity: 1024 +encryption: 0 +relPath:qcow2 +type:1 +format:14 +protocol:none +hostname: 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 index 0000000000..17f53f3ed0 --- /dev/null +++ b/tests/virstoragetestdata/out/qcow2-qcow2_qcow2-qcow2_qcow2-auto @@ -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: +type:1 +format:14 +protocol:none +hostname: + +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: + +path:ABS_SRCDIR/virstoragetestdata/images/qcow2 +backingStoreRaw: +capacity: 1024 +encryption: 0 +relPath:qcow2 +type:1 +format:14 +protocol:none +hostname: 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 index 0000000000..1be5a82cc9 --- /dev/null +++ b/tests/virstoragetestdata/out/qcow2-qcow2_qcow2-qcow2_raw-auto @@ -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: +type:1 +format:14 +protocol:none +hostname: + +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: + +path:ABS_SRCDIR/virstoragetestdata/images/raw +backingStoreRaw: +capacity: 0 +encryption: 0 +relPath:raw +type:1 +format:1 +protocol:none +hostname: -- 2.47.2