]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
tests: qemublock: Add cases for creating image overlays on top of disks with <slice>
authorPeter Krempa <pkrempa@redhat.com>
Wed, 12 Feb 2020 16:26:18 +0000 (17:26 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 14 Feb 2020 15:32:21 +0000 (16:32 +0100)
Add a set of test data to see whether the backing store strings are
formatted reasonably. Note that we don't support direct creation of such
images so those tests are not enabled.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
tests/qemublocktest.c
tests/qemublocktestdata/imagecreate/qcow2-backing-qcow2-slice.json [new file with mode: 0644]
tests/qemublocktestdata/imagecreate/qcow2-backing-qcow2-slice.xml [new symlink]
tests/qemublocktestdata/imagecreate/qcow2-backing-raw-slice.json [new file with mode: 0644]
tests/qemublocktestdata/imagecreate/qcow2-backing-raw-slice.xml [new symlink]
tests/qemublocktestdata/imagecreate/qcow2-slice.xml [new file with mode: 0644]
tests/qemublocktestdata/imagecreate/raw-slice.xml [new file with mode: 0644]

index ada83a0fde65ad950037c9588e800070f2a7853c..5a564b71df276cbe10f038115d81228e9bc91fba 100644 (file)
@@ -1064,6 +1064,8 @@ mymain(void)
     TEST_IMAGE_CREATE("qcow2-backing-raw-nbd", "raw-nbd");
     TEST_IMAGE_CREATE("qcow2-backing-luks", "luks-noopts");
     TEST_IMAGE_CREATE("qcow2-luks-encopts-backing", "qcow2");
+    TEST_IMAGE_CREATE("qcow2-backing-raw-slice", "raw-slice");
+    TEST_IMAGE_CREATE("qcow2-backing-qcow2-slice", "qcow2-slice");
 
     TEST_IMAGE_CREATE("network-gluster-qcow2", NULL);
     TEST_IMAGE_CREATE("network-rbd-qcow2", NULL);
diff --git a/tests/qemublocktestdata/imagecreate/qcow2-backing-qcow2-slice.json b/tests/qemublocktestdata/imagecreate/qcow2-backing-qcow2-slice.json
new file mode 100644 (file)
index 0000000..2fa27c1
--- /dev/null
@@ -0,0 +1,15 @@
+protocol:
+{
+  "driver": "file",
+  "filename": "/var/lib/libvirt/images/i.qcow2",
+  "size": 4294967296
+}
+
+format:
+{
+  "driver": "qcow2",
+  "file": "0123456789ABCDEF0123456789ABCDE",
+  "size": 8589934590,
+  "backing-file": "json:{\"driver\":\"raw\",\"offset\":1234,\"size\":5768,\"file\":{\"driver\":\"file\",\"filename\":\"/var/lib/libvirt/images/i.qcow2\"}}",
+  "backing-fmt": "qcow2"
+}
diff --git a/tests/qemublocktestdata/imagecreate/qcow2-backing-qcow2-slice.xml b/tests/qemublocktestdata/imagecreate/qcow2-backing-qcow2-slice.xml
new file mode 120000 (symlink)
index 0000000..5769c2c
--- /dev/null
@@ -0,0 +1 @@
+qcow2.xml
\ No newline at end of file
diff --git a/tests/qemublocktestdata/imagecreate/qcow2-backing-raw-slice.json b/tests/qemublocktestdata/imagecreate/qcow2-backing-raw-slice.json
new file mode 100644 (file)
index 0000000..761002a
--- /dev/null
@@ -0,0 +1,15 @@
+protocol:
+{
+  "driver": "file",
+  "filename": "/var/lib/libvirt/images/i.qcow2",
+  "size": 4294967296
+}
+
+format:
+{
+  "driver": "qcow2",
+  "file": "0123456789ABCDEF0123456789ABCDE",
+  "size": 8589934590,
+  "backing-file": "json:{\"driver\":\"raw\",\"offset\":9876,\"size\":54321,\"file\":{\"driver\":\"file\",\"filename\":\"/var/lib/libvirt/images/i.img\"}}",
+  "backing-fmt": "raw"
+}
diff --git a/tests/qemublocktestdata/imagecreate/qcow2-backing-raw-slice.xml b/tests/qemublocktestdata/imagecreate/qcow2-backing-raw-slice.xml
new file mode 120000 (symlink)
index 0000000..5769c2c
--- /dev/null
@@ -0,0 +1 @@
+qcow2.xml
\ No newline at end of file
diff --git a/tests/qemublocktestdata/imagecreate/qcow2-slice.xml b/tests/qemublocktestdata/imagecreate/qcow2-slice.xml
new file mode 100644 (file)
index 0000000..6c5ae31
--- /dev/null
@@ -0,0 +1,14 @@
+<disk device='disk' name='vda'>
+  <driver type='qcow2'/>
+  <source file='/var/lib/libvirt/images/i.qcow2'>
+    <slices>
+      <slice type='storage' offset='1234' size='5768'/>
+    </slices>
+    <privateData>
+      <nodenames>
+        <nodename type='storage' name='0123456789ABCDEF0123456789ABCDE'/>
+        <nodename type='format' name='0123456789ABCDEF0123456789ABCDE'/>
+      </nodenames>
+    </privateData>
+  </source>
+</disk>
diff --git a/tests/qemublocktestdata/imagecreate/raw-slice.xml b/tests/qemublocktestdata/imagecreate/raw-slice.xml
new file mode 100644 (file)
index 0000000..adc7a17
--- /dev/null
@@ -0,0 +1,14 @@
+<disk device='disk' name='vda'>
+  <driver type='raw'/>
+  <source file='/var/lib/libvirt/images/i.img'>
+    <slices>
+      <slice type='storage' offset='9876' size='54321'/>
+    </slices>
+    <privateData>
+      <nodenames>
+        <nodename type='storage' name='0123456789ABCDEF0123456789ABCDE'/>
+        <nodename type='format' name='0123456789ABCDEF0123456789ABCDE'/>
+      </nodenames>
+    </privateData>
+  </source>
+</disk>