[PATCH 6/7] virstoragetest: Add test cases for QCOW2 files with a protocol name as backing file format

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 tests/virstoragetest.c                        |   8 +++++++
 .../images/qcow2-protocol-backing-file.qcow2  | Bin 0 -> 196616 bytes
 .../images/qcow2-protocol-backing-nbd.qcow2   | Bin 0 -> 196616 bytes
 .../out/qcow2-protocol-backing-file           |  21 ++++++++++++++++++
 4 files changed, 29 insertions(+)
 create mode 100644 tests/virstoragetestdata/images/qcow2-protocol-backing-file.qcow2
 create mode 100644 tests/virstoragetestdata/images/qcow2-protocol-backing-nbd.qcow2
 create mode 100644 tests/virstoragetestdata/out/qcow2-protocol-backing-file

diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c
index c28a23e332..53533d5885 100644
--- a/tests/virstoragetest.c
+++ b/tests/virstoragetest.c
@@ -478,6 +478,14 @@ mymain(void)
                abs_srcdir "/virstoragetestdata/images/qcow2_qcow2-auto.qcow2",
                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 */
     TEST_CHAIN("qcow2-qcow2_missing",
                abs_srcdir "/virstoragetestdata/images/qcow2_qcow2-missing.qcow2",
diff --git a/tests/virstoragetestdata/images/qcow2-protocol-backing-file.qcow2 b/tests/virstoragetestdata/images/qcow2-protocol-backing-file.qcow2
new file mode 100644
index 0000000000000000000000000000000000000000..b3fe320f0f521820f2c4a614fed4cea18fdca55c
GIT binary patch
literal 196616
zcmeIuJx;?g6aZi+?EyGKW=0Nygv7$c9GX-_YLh4pf-rGDj=?FASaABIib`$S`#DN%
zKR?@f-^1<QPY7WW-`LWt_!-AzAKP@(g^;WV+pO(u6We7R@5e*h-SXFP{Tav8d9^6V
z*z@H3F&_UBLQ!@7kUdrX7(U;US<`hdZU5gLY5CTdU7atoBJcBTcmL6gCbMSQcI9eS
zHFeex?fP$zX2*)g^XsB4viqB?toyDiS0~bwu*lzstSjfU=B4gWrLIp&LzG$O?b*cb
zooUkLui2lPPyEe(Del@&j0g}QK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk
z1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs
z0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZ
zfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&U
zAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C7
z2oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oShDf%Ni9Rxtqr1PBly
zK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF
z5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk
z1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs
z0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZ
zfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&U
zAV7cs0RjXF5FkK+009C72pk9`Ve=e>O$iVnK!5-N0t5&UAV7cs0RjXF5FkK+009C7
z2oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N
z0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+
z009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBly
zK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF
z5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZ;4%e%
E0pRvEvj6}9

literal 0
HcmV?d00001

diff --git a/tests/virstoragetestdata/images/qcow2-protocol-backing-nbd.qcow2 b/tests/virstoragetestdata/images/qcow2-protocol-backing-nbd.qcow2
new file mode 100644
index 0000000000000000000000000000000000000000..0ae422d8f550cc6bacf3d4d757110177ce457865
GIT binary patch
literal 196616
zcmeIv!EVzq00v+u-2?Cj<O~w6IB?hlOhV$qiF4X`EK-_8t|wMbJPOalWAGG6Tu8f)
zi35RMt1nS($Np`{U*2E6{TV`7OwV+c&!*z}^c?CCz8=d%Q5;*R)amWM?|0;{jf-hy
zd>H+{fAMW<FZy+J?7CU}_%JR1C4{C;d0(yD{1Bb5i_MVI?U?^}Mj7vNOnu!|O`YrN
zy6xiZ28+$G9aG%x+M%!Vew<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72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs
z0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZ
ofB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72%N9LFOzFO8UO$Q

literal 0
HcmV?d00001

diff --git a/tests/virstoragetestdata/out/qcow2-protocol-backing-file b/tests/virstoragetestdata/out/qcow2-protocol-backing-file
new file mode 100644
index 0000000000..b565bdba77
--- /dev/null
+++ b/tests/virstoragetestdata/out/qcow2-protocol-backing-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>
-- 
2.42.0
_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux