[RFC PATCH 27/30] tests: qemublock: basic qcow2 tests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add tests for backing chain handling, including a very long chain which
is fully specified in the XML and an unterminated chain.

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

file-qcow2-backing-chain-encryption.xml:
-drive file=/var/lib/libvirt/images/a,encrypt.format=luks,
    encrypt.key-secret=node-b-f-encalias,format=qcow2,if=none,id=drive-dummy
-device virtio-blk-pci,scsi=off,drive=drive-dummy,id=dummy

file-qcow2-backing-chain-noopts.xml:
-drive file=/var/lib/libvirt/images/rhel7.3.1507297895,format=qcow2,if=none,id=drive-dummy
-device virtio-blk-pci,scsi=off,drive=drive-dummy,id=dummy

file-qcow2-backing-chain-unterminated.xml:
-drive file=/var/lib/libvirt/images/rhel7.3.1507297895,format=qcow2,if=none,id=drive-dummy
-device virtio-blk-pci,scsi=off,drive=drive-dummy,id=dummy

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 tests/qemublocktest.c                              |   3 +
 .../file-qcow2-backing-chain-encryption.json       |  34 ++++++
 .../file-qcow2-backing-chain-encryption.xml        |  25 ++++
 .../xml2json/file-qcow2-backing-chain-noopts.json  | 130 +++++++++++++++++++++
 .../xml2json/file-qcow2-backing-chain-noopts.xml   |  83 +++++++++++++
 .../file-qcow2-backing-chain-unterminated.json     |  25 ++++
 .../file-qcow2-backing-chain-unterminated.xml      |  18 +++
 7 files changed, 318 insertions(+)
 create mode 100644 tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-encryption.json
 create mode 100644 tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-encryption.xml
 create mode 100644 tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-noopts.json
 create mode 100644 tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-noopts.xml
 create mode 100644 tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-unterminated.json
 create mode 100644 tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-unterminated.xml

diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c
index 55d028e9fb..44d76bebbb 100644
--- a/tests/qemublocktest.c
+++ b/tests/qemublocktest.c
@@ -460,6 +460,9 @@ mymain(void)
     TEST_DISK_TO_JSON("file-raw-aio_native");
     TEST_DISK_TO_JSON("file-backing_basic-aio_threads");
     TEST_DISK_TO_JSON("file-raw-luks");
+    TEST_DISK_TO_JSON("file-qcow2-backing-chain-noopts");
+    TEST_DISK_TO_JSON("file-qcow2-backing-chain-unterminated");
+    TEST_DISK_TO_JSON("file-qcow2-backing-chain-encryption");

  cleanup:
     virHashFree(diskxmljsondata.schema);
diff --git a/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-encryption.json b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-encryption.json
new file mode 100644
index 0000000000..94e2ecd1e2
--- /dev/null
+++ b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-encryption.json
@@ -0,0 +1,34 @@
+{
+  "node-name": "node-b-f",
+  "read-only": false,
+  "driver": "qcow2",
+  "encrypt": {
+    "format": "luks",
+    "key-secret": "node-b-f-encalias"
+  },
+  "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": "qcow2",
+  "encrypt": {
+    "format": "aes",
+    "key-secret": "node-b-f-encalias"
+  },
+  "file": {
+    "driver": "file",
+    "filename": "/var/lib/libvirt/images/b",
+    "node-name": "node-b-s",
+    "read-only": true,
+    "discard": "unmap"
+  },
+  "backing": null
+}
diff --git a/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-encryption.xml b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-encryption.xml
new file mode 100644
index 0000000000..4e49be9bef
--- /dev/null
+++ b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-encryption.xml
@@ -0,0 +1,25 @@
+<disk type='file' device='disk'>
+  <driver name='qemu' type='qcow2'/>
+  <source file='/var/lib/libvirt/images/a'>
+    <encryption format='luks'>
+      <secret type='passphrase' uuid='0a81f5b2-8403-7b23-c8d6-21ccc2f80d6f'/>
+    </encryption>
+    <privateData>
+      <nodename storage='node-a-s' format='node-b-f'/>
+    </privateData>
+  </source>
+  <backingStore type='file' index='1'>
+    <format type='qcow2'/>
+    <source file='/var/lib/libvirt/images/b'>
+      <privateData>
+        <nodename storage='node-b-s' format='node-b-f'/>
+      </privateData>
+      <encryption format='qcow'>
+        <secret type='passphrase' uuid='0a81f5b2-8403-7b23-c8d6-21ccc2f80d6f'/>
+      </encryption>
+    </source>
+    <backingStore/>
+  </backingStore>
+  <target dev='vda' bus='virtio'/>
+  <alias name='virtio-disk0'/>
+</disk>
diff --git a/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-noopts.json b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-noopts.json
new file mode 100644
index 0000000000..3e7c08f080
--- /dev/null
+++ b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-noopts.json
@@ -0,0 +1,130 @@
+{
+  "node-name": "#block126",
+  "read-only": false,
+  "driver": "qcow2",
+  "file": {
+    "driver": "file",
+    "filename": "/var/lib/libvirt/images/rhel7.3.1507297895",
+    "node-name": "#block004",
+    "read-only": false,
+    "discard": "unmap"
+  },
+  "backing": "#block313"
+}
+{
+  "node-name": "#block313",
+  "read-only": true,
+  "driver": "qcow2",
+  "file": {
+    "driver": "file",
+    "filename": "/var/lib/libvirt/images/rhel7.3.1484071872",
+    "node-name": "#block256",
+    "read-only": true,
+    "discard": "unmap"
+  },
+  "backing": "#block556"
+}
+{
+  "node-name": "#block556",
+  "read-only": true,
+  "driver": "qcow2",
+  "file": {
+    "driver": "file",
+    "filename": "/var/lib/libvirt/images/rhel7.3.1483615252",
+    "node-name": "#block418",
+    "read-only": true,
+    "discard": "unmap"
+  },
+  "backing": "#block767"
+}
+{
+  "node-name": "#block767",
+  "read-only": true,
+  "driver": "qcow2",
+  "file": {
+    "driver": "file",
+    "filename": "/var/lib/libvirt/images/rhel7.3.1483605924",
+    "node-name": "#block624",
+    "read-only": true,
+    "discard": "unmap"
+  },
+  "backing": "#block937"
+}
+{
+  "node-name": "#block937",
+  "read-only": true,
+  "driver": "qcow2",
+  "file": {
+    "driver": "file",
+    "filename": "/var/lib/libvirt/images/rhel7.3.1483605920",
+    "node-name": "#block869",
+    "read-only": true,
+    "discard": "unmap"
+  },
+  "backing": "#block1157"
+}
+{
+  "node-name": "#block1157",
+  "read-only": true,
+  "driver": "qcow2",
+  "file": {
+    "driver": "file",
+    "filename": "/var/lib/libvirt/images/rhel7.3.1483546244",
+    "node-name": "#block1047",
+    "read-only": true,
+    "discard": "unmap"
+  },
+  "backing": "#block1392"
+}
+{
+  "node-name": "#block1392",
+  "read-only": true,
+  "driver": "qcow2",
+  "file": {
+    "driver": "file",
+    "filename": "/var/lib/libvirt/images/rhel7.3.1483545901",
+    "node-name": "#block1279",
+    "read-only": true,
+    "discard": "unmap"
+  },
+  "backing": "#block1523"
+}
+{
+  "node-name": "#block1523",
+  "read-only": true,
+  "driver": "qcow2",
+  "file": {
+    "driver": "file",
+    "filename": "/var/lib/libvirt/images/rhel7.3.1483545313",
+    "node-name": "#block1444",
+    "read-only": true,
+    "discard": "unmap"
+  },
+  "backing": "#block1742"
+}
+{
+  "node-name": "#block1742",
+  "read-only": true,
+  "driver": "qcow2",
+  "file": {
+    "driver": "file",
+    "filename": "/var/lib/libvirt/images/rhel7.3.1483536402",
+    "node-name": "#block1602",
+    "read-only": true,
+    "discard": "unmap"
+  },
+  "backing": "#block1909"
+}
+{
+  "node-name": "#block1909",
+  "read-only": true,
+  "driver": "qcow2",
+  "file": {
+    "driver": "file",
+    "filename": "/var/lib/libvirt/images/rhel7.3.qcow2",
+    "node-name": "#block1864",
+    "read-only": true,
+    "discard": "unmap"
+  },
+  "backing": null
+}
diff --git a/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-noopts.xml b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-noopts.xml
new file mode 100644
index 0000000000..d69d51ebfb
--- /dev/null
+++ b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-noopts.xml
@@ -0,0 +1,83 @@
+<disk type='file' device='disk'>
+  <driver name='qemu' type='qcow2'/>
+  <source file='/var/lib/libvirt/images/rhel7.3.1507297895'>
+    <privateData>
+      <nodename storage='#block004' format='#block126'/>
+    </privateData>
+  </source>
+  <backingStore type='file' index='1'>
+    <format type='qcow2'/>
+    <source file='/var/lib/libvirt/images/rhel7.3.1484071872'>
+      <privateData>
+        <nodename storage='#block256' format='#block313'/>
+      </privateData>
+    </source>
+    <backingStore type='file' index='2'>
+      <format type='qcow2'/>
+      <source file='/var/lib/libvirt/images/rhel7.3.1483615252'>
+        <privateData>
+          <nodename storage='#block418' format='#block556'/>
+        </privateData>
+      </source>
+      <backingStore type='file' index='3'>
+        <format type='qcow2'/>
+        <source file='/var/lib/libvirt/images/rhel7.3.1483605924'>
+          <privateData>
+            <nodename storage='#block624' format='#block767'/>
+          </privateData>
+        </source>
+        <backingStore type='file' index='4'>
+          <format type='qcow2'/>
+          <source file='/var/lib/libvirt/images/rhel7.3.1483605920'>
+            <privateData>
+              <nodename storage='#block869' format='#block937'/>
+            </privateData>
+          </source>
+          <backingStore type='file' index='5'>
+            <format type='qcow2'/>
+            <source file='/var/lib/libvirt/images/rhel7.3.1483546244'>
+              <privateData>
+                <nodename storage='#block1047' format='#block1157'/>
+              </privateData>
+            </source>
+            <backingStore type='file' index='6'>
+              <format type='qcow2'/>
+              <source file='/var/lib/libvirt/images/rhel7.3.1483545901'>
+                <privateData>
+                  <nodename storage='#block1279' format='#block1392'/>
+                </privateData>
+              </source>
+              <backingStore type='file' index='7'>
+                <format type='qcow2'/>
+                <source file='/var/lib/libvirt/images/rhel7.3.1483545313'>
+                  <privateData>
+                    <nodename storage='#block1444' format='#block1523'/>
+                  </privateData>
+                </source>
+                <backingStore type='file' index='8'>
+                  <format type='qcow2'/>
+                  <source file='/var/lib/libvirt/images/rhel7.3.1483536402'>
+                    <privateData>
+                      <nodename storage='#block1602' format='#block1742'/>
+                    </privateData>
+                  </source>
+                  <backingStore type='file' index='9'>
+                    <format type='qcow2'/>
+                    <source file='/var/lib/libvirt/images/rhel7.3.qcow2'>
+                      <privateData>
+                        <nodename storage='#block1864' format='#block1909'/>
+                      </privateData>
+                    </source>
+                    <backingStore/>
+                  </backingStore>
+                </backingStore>
+              </backingStore>
+            </backingStore>
+          </backingStore>
+        </backingStore>
+      </backingStore>
+    </backingStore>
+  </backingStore>
+  <target dev='vda' bus='virtio'/>
+  <alias name='virtio-disk0'/>
+</disk>
diff --git a/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-unterminated.json b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-unterminated.json
new file mode 100644
index 0000000000..8fcdc48bb0
--- /dev/null
+++ b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-unterminated.json
@@ -0,0 +1,25 @@
+{
+  "node-name": "#block126",
+  "read-only": false,
+  "driver": "qcow2",
+  "file": {
+    "driver": "file",
+    "filename": "/var/lib/libvirt/images/rhel7.3.1507297895",
+    "node-name": "#block004",
+    "read-only": false,
+    "discard": "unmap"
+  },
+  "backing": "#block313"
+}
+{
+  "node-name": "#block313",
+  "read-only": true,
+  "driver": "qcow2",
+  "file": {
+    "driver": "file",
+    "filename": "/var/lib/libvirt/images/rhel7.3.1484071872",
+    "node-name": "#block256",
+    "read-only": true,
+    "discard": "unmap"
+  }
+}
diff --git a/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-unterminated.xml b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-unterminated.xml
new file mode 100644
index 0000000000..29ed9665df
--- /dev/null
+++ b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-unterminated.xml
@@ -0,0 +1,18 @@
+<disk type='file' device='disk'>
+  <driver name='qemu' type='qcow2'/>
+  <source file='/var/lib/libvirt/images/rhel7.3.1507297895'>
+    <privateData>
+      <nodename storage='#block004' format='#block126'/>
+    </privateData>
+  </source>
+  <backingStore type='file' index='1'>
+    <format type='qcow2'/>
+    <source file='/var/lib/libvirt/images/rhel7.3.1484071872'>
+      <privateData>
+        <nodename storage='#block256' format='#block313'/>
+      </privateData>
+    </source>
+  </backingStore>
+  <target dev='vda' bus='virtio'/>
+  <alias name='virtio-disk0'/>
+</disk>
-- 
2.14.3

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



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux