render / rpms / libvirt

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