Blame SOURCES/libvirt-tests-qemublock-Add-cases-for-creating-image-overlays-on-top-of-disks-with-slice.patch

d76c62
From 54c8ab3178409f52113c99dca660c1024573ef7e Mon Sep 17 00:00:00 2001
d76c62
Message-Id: <54c8ab3178409f52113c99dca660c1024573ef7e@dist-git>
d76c62
From: Peter Krempa <pkrempa@redhat.com>
d76c62
Date: Wed, 19 Feb 2020 15:10:23 +0100
d76c62
Subject: [PATCH] tests: qemublock: Add cases for creating image overlays on
d76c62
 top of disks with <slice>
d76c62
MIME-Version: 1.0
d76c62
Content-Type: text/plain; charset=UTF-8
d76c62
Content-Transfer-Encoding: 8bit
d76c62
d76c62
Add a set of test data to see whether the backing store strings are
d76c62
formatted reasonably. Note that we don't support direct creation of such
d76c62
images so those tests are not enabled.
d76c62
d76c62
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
d76c62
Reviewed-by: Ján Tomko <jtomko@redhat.com>
d76c62
(cherry picked from commit 9b804ef5efcd3b1e91bbf75f4e94a35630c062c5)
d76c62
d76c62
https://bugzilla.redhat.com/show_bug.cgi?id=1791788
d76c62
Message-Id: <6639bab2e1e9dbdf13471057a1cb3accd1c30549.1582120424.git.pkrempa@redhat.com>
d76c62
Reviewed-by: Ján Tomko <jtomko@redhat.com>
d76c62
---
d76c62
 tests/qemublocktest.c                             |  2 ++
d76c62
 .../imagecreate/qcow2-backing-qcow2-slice.json    | 15 +++++++++++++++
d76c62
 .../imagecreate/qcow2-backing-qcow2-slice.xml     |  1 +
d76c62
 .../imagecreate/qcow2-backing-raw-slice.json      | 15 +++++++++++++++
d76c62
 .../imagecreate/qcow2-backing-raw-slice.xml       |  1 +
d76c62
 .../qemublocktestdata/imagecreate/qcow2-slice.xml | 14 ++++++++++++++
d76c62
 tests/qemublocktestdata/imagecreate/raw-slice.xml | 14 ++++++++++++++
d76c62
 7 files changed, 62 insertions(+)
d76c62
 create mode 100644 tests/qemublocktestdata/imagecreate/qcow2-backing-qcow2-slice.json
d76c62
 create mode 120000 tests/qemublocktestdata/imagecreate/qcow2-backing-qcow2-slice.xml
d76c62
 create mode 100644 tests/qemublocktestdata/imagecreate/qcow2-backing-raw-slice.json
d76c62
 create mode 120000 tests/qemublocktestdata/imagecreate/qcow2-backing-raw-slice.xml
d76c62
 create mode 100644 tests/qemublocktestdata/imagecreate/qcow2-slice.xml
d76c62
 create mode 100644 tests/qemublocktestdata/imagecreate/raw-slice.xml
d76c62
d76c62
diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c
d76c62
index f66d894aed..29af0781fc 100644
d76c62
--- a/tests/qemublocktest.c
d76c62
+++ b/tests/qemublocktest.c
d76c62
@@ -1060,6 +1060,8 @@ mymain(void)
d76c62
     TEST_IMAGE_CREATE("qcow2-backing-raw-nbd", "raw-nbd");
d76c62
     TEST_IMAGE_CREATE("qcow2-backing-luks", "luks-noopts");
d76c62
     TEST_IMAGE_CREATE("qcow2-luks-encopts-backing", "qcow2");
d76c62
+    TEST_IMAGE_CREATE("qcow2-backing-raw-slice", "raw-slice");
d76c62
+    TEST_IMAGE_CREATE("qcow2-backing-qcow2-slice", "qcow2-slice");
d76c62
 
d76c62
     TEST_IMAGE_CREATE("network-gluster-qcow2", NULL);
d76c62
     TEST_IMAGE_CREATE("network-rbd-qcow2", NULL);
d76c62
diff --git a/tests/qemublocktestdata/imagecreate/qcow2-backing-qcow2-slice.json b/tests/qemublocktestdata/imagecreate/qcow2-backing-qcow2-slice.json
d76c62
new file mode 100644
d76c62
index 0000000000..2fa27c1933
d76c62
--- /dev/null
d76c62
+++ b/tests/qemublocktestdata/imagecreate/qcow2-backing-qcow2-slice.json
d76c62
@@ -0,0 +1,15 @@
d76c62
+protocol:
d76c62
+{
d76c62
+  "driver": "file",
d76c62
+  "filename": "/var/lib/libvirt/images/i.qcow2",
d76c62
+  "size": 4294967296
d76c62
+}
d76c62
+
d76c62
+format:
d76c62
+{
d76c62
+  "driver": "qcow2",
d76c62
+  "file": "0123456789ABCDEF0123456789ABCDE",
d76c62
+  "size": 8589934590,
d76c62
+  "backing-file": "json:{\"driver\":\"raw\",\"offset\":1234,\"size\":5768,\"file\":{\"driver\":\"file\",\"filename\":\"/var/lib/libvirt/images/i.qcow2\"}}",
d76c62
+  "backing-fmt": "qcow2"
d76c62
+}
d76c62
diff --git a/tests/qemublocktestdata/imagecreate/qcow2-backing-qcow2-slice.xml b/tests/qemublocktestdata/imagecreate/qcow2-backing-qcow2-slice.xml
d76c62
new file mode 120000
d76c62
index 0000000000..5769c2c866
d76c62
--- /dev/null
d76c62
+++ b/tests/qemublocktestdata/imagecreate/qcow2-backing-qcow2-slice.xml
d76c62
@@ -0,0 +1 @@
d76c62
+qcow2.xml
d76c62
\ No newline at end of file
d76c62
diff --git a/tests/qemublocktestdata/imagecreate/qcow2-backing-raw-slice.json b/tests/qemublocktestdata/imagecreate/qcow2-backing-raw-slice.json
d76c62
new file mode 100644
d76c62
index 0000000000..761002afd9
d76c62
--- /dev/null
d76c62
+++ b/tests/qemublocktestdata/imagecreate/qcow2-backing-raw-slice.json
d76c62
@@ -0,0 +1,15 @@
d76c62
+protocol:
d76c62
+{
d76c62
+  "driver": "file",
d76c62
+  "filename": "/var/lib/libvirt/images/i.qcow2",
d76c62
+  "size": 4294967296
d76c62
+}
d76c62
+
d76c62
+format:
d76c62
+{
d76c62
+  "driver": "qcow2",
d76c62
+  "file": "0123456789ABCDEF0123456789ABCDE",
d76c62
+  "size": 8589934590,
d76c62
+  "backing-file": "json:{\"driver\":\"raw\",\"offset\":9876,\"size\":54321,\"file\":{\"driver\":\"file\",\"filename\":\"/var/lib/libvirt/images/i.img\"}}",
d76c62
+  "backing-fmt": "raw"
d76c62
+}
d76c62
diff --git a/tests/qemublocktestdata/imagecreate/qcow2-backing-raw-slice.xml b/tests/qemublocktestdata/imagecreate/qcow2-backing-raw-slice.xml
d76c62
new file mode 120000
d76c62
index 0000000000..5769c2c866
d76c62
--- /dev/null
d76c62
+++ b/tests/qemublocktestdata/imagecreate/qcow2-backing-raw-slice.xml
d76c62
@@ -0,0 +1 @@
d76c62
+qcow2.xml
d76c62
\ No newline at end of file
d76c62
diff --git a/tests/qemublocktestdata/imagecreate/qcow2-slice.xml b/tests/qemublocktestdata/imagecreate/qcow2-slice.xml
d76c62
new file mode 100644
d76c62
index 0000000000..6c5ae3107b
d76c62
--- /dev/null
d76c62
+++ b/tests/qemublocktestdata/imagecreate/qcow2-slice.xml
d76c62
@@ -0,0 +1,14 @@
d76c62
+<disk device='disk' name='vda'>
d76c62
+  <driver type='qcow2'/>
d76c62
+  <source file='/var/lib/libvirt/images/i.qcow2'>
d76c62
+    <slices>
d76c62
+      <slice type='storage' offset='1234' size='5768'/>
d76c62
+    </slices>
d76c62
+    <privateData>
d76c62
+      <nodenames>
d76c62
+        <nodename type='storage' name='0123456789ABCDEF0123456789ABCDE'/>
d76c62
+        <nodename type='format' name='0123456789ABCDEF0123456789ABCDE'/>
d76c62
+      </nodenames>
d76c62
+    </privateData>
d76c62
+  </source>
d76c62
+</disk>
d76c62
diff --git a/tests/qemublocktestdata/imagecreate/raw-slice.xml b/tests/qemublocktestdata/imagecreate/raw-slice.xml
d76c62
new file mode 100644
d76c62
index 0000000000..adc7a175ce
d76c62
--- /dev/null
d76c62
+++ b/tests/qemublocktestdata/imagecreate/raw-slice.xml
d76c62
@@ -0,0 +1,14 @@
d76c62
+<disk device='disk' name='vda'>
d76c62
+  <driver type='raw'/>
d76c62
+  <source file='/var/lib/libvirt/images/i.img'>
d76c62
+    <slices>
d76c62
+      <slice type='storage' offset='9876' size='54321'/>
d76c62
+    </slices>
d76c62
+    <privateData>
d76c62
+      <nodenames>
d76c62
+        <nodename type='storage' name='0123456789ABCDEF0123456789ABCDE'/>
d76c62
+        <nodename type='format' name='0123456789ABCDEF0123456789ABCDE'/>
d76c62
+      </nodenames>
d76c62
+    </privateData>
d76c62
+  </source>
d76c62
+</disk>
d76c62
-- 
d76c62
2.25.0
d76c62