render / rpms / libvirt

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