Formats supporting backing chain such as qed, vmdk, don't have any other
parameters than the backing store and 'qcow' has only encryption params
which will be tested extra. Add this test case so they are covered since
any further test cases will mainly care about 'qcow2' and 'raw'.

The top level disk image would generate the following '-drive' cmdline:

-drive file=/var/lib/libvirt/images/a,format=qed,if=none,id=drive-dummy
-device virtio-blk-pci,scsi=off,drive=drive-dummy,id=dummy

Signed-off-by: Peter Krempa <pkre...@redhat.com>
---
 tests/qemublocktest.c                              |  2 +
 .../xml2json/file-backing_basic-noopts.json        | 51 ++++++++++++++++++++++
 .../xml2json/file-backing_basic-noopts.xml         | 34 +++++++++++++++
 3 files changed, 87 insertions(+)
 create mode 100644 
tests/qemublocktestdata/xml2json/file-backing_basic-noopts.json
 create mode 100644 
tests/qemublocktestdata/xml2json/file-backing_basic-noopts.xml

diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c
index feb25c69e3..881d7c17ee 100644
--- a/tests/qemublocktest.c
+++ b/tests/qemublocktest.c
@@ -413,6 +413,8 @@ mymain(void)
     TEST_DISK_TO_JSON("file-vhd-noopts");
     TEST_DISK_TO_JSON("file-vpc-noopts");

+    TEST_DISK_TO_JSON("file-backing_basic-noopts");
+
  cleanup:
     virHashFree(diskxmljsondata.schema);
     qemuTestDriverFree(&driver);
diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-noopts.json 
b/tests/qemublocktestdata/xml2json/file-backing_basic-noopts.json
new file mode 100644
index 0000000000..3285a6ec67
--- /dev/null
+++ b/tests/qemublocktestdata/xml2json/file-backing_basic-noopts.json
@@ -0,0 +1,51 @@
+{
+  "node-name": "node-a-f",
+  "read-only": false,
+  "driver": "qed",
+  "file": {
+    "driver": "file",
+    "filename": "/var/lib/libvirt/images/a",
+    "node-name": "node-a-s",
+    "read-only": false,
+    "discard": "unmap"
+  },
+  "backing": "node-b-f"
+}
+{
+  "node-name": "node-b-f",
+  "read-only": true,
+  "driver": "qcow",
+  "file": {
+    "driver": "file",
+    "filename": "/var/lib/libvirt/images/b",
+    "node-name": "node-b-s",
+    "read-only": true,
+    "discard": "unmap"
+  },
+  "backing": "node-c-f"
+}
+{
+  "node-name": "node-c-f",
+  "read-only": true,
+  "driver": "vmdk",
+  "file": {
+    "driver": "file",
+    "filename": "/var/lib/libvirt/images/c",
+    "node-name": "node-c-s",
+    "read-only": true,
+    "discard": "unmap"
+  },
+  "backing": "node-d-f"
+}
+{
+  "node-name": "node-d-f",
+  "read-only": true,
+  "driver": "raw",
+  "file": {
+    "driver": "file",
+    "filename": "/var/lib/libvirt/images/d",
+    "node-name": "node-d-s",
+    "read-only": true,
+    "discard": "unmap"
+  }
+}
diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-noopts.xml 
b/tests/qemublocktestdata/xml2json/file-backing_basic-noopts.xml
new file mode 100644
index 0000000000..daa9423dcc
--- /dev/null
+++ b/tests/qemublocktestdata/xml2json/file-backing_basic-noopts.xml
@@ -0,0 +1,34 @@
+<disk type='file' device='disk'>
+  <driver name='qemu' type='qed'/>
+  <source file='/var/lib/libvirt/images/a'>
+    <privateData>
+      <nodename storage='node-a-s' format='node-a-f'/>
+    </privateData>
+  </source>
+  <backingStore type='file' index='1'>
+    <format type='qcow'/>
+    <source file='/var/lib/libvirt/images/b'>
+      <privateData>
+        <nodename storage='node-b-s' format='node-b-f'/>
+      </privateData>
+    </source>
+    <backingStore type='file' index='2'>
+      <format type='vmdk'/>
+      <source file='/var/lib/libvirt/images/c'>
+        <privateData>
+          <nodename storage='node-c-s' format='node-c-f'/>
+        </privateData>
+      </source>
+      <backingStore type='file' index='3'>
+        <format type='raw'/>
+        <source file='/var/lib/libvirt/images/d'>
+          <privateData>
+            <nodename storage='node-d-s' format='node-d-f'/>
+          </privateData>
+        </source>
+        <backingStore/>
+      </backingStore>
+    </backingStore>
+  </backingStore>
+  <target dev='vda'/>
+</disk>
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to