The test cases would correspond to the following -drive command lines: file-backing_basic-detect.xml: -drive file=/var/lib/libvirt/images/a,format=qcow,if=none,id=drive-dummy,detect-zeroes=on -device virtio-blk-pci,scsi=off,drive=drive-dummy,id=dummy file-backing_basic-unmap-detect.xml: -drive file=/var/lib/libvirt/images/a,format=qcow,if=none,id=drive-dummy,discard=unmap,detect-zeroes=unmap -device virtio-blk-pci,scsi=off,drive=drive-dummy,id=dummy file-backing_basic-unmap-ignore.xml: -drive file=/var/lib/libvirt/images/a,format=qcow,if=none,id=drive-dummy,discard=ignore,detect-zeroes=on -device virtio-blk-pci,scsi=off,drive=drive-dummy,id=dummy file-backing_basic-unmap.xml: -drive file=/var/lib/libvirt/images/a,format=qcow,if=none,id=drive-dummy,discard=unmap -device virtio-blk-pci,scsi=off,drive=drive-dummy,id=dummy --- tests/qemublocktest.c | 5 ++ .../xml2json/file-backing_basic-detect.json | 60 ++++++++++++++++++++ .../xml2json/file-backing_basic-detect.xml | 35 ++++++++++++ .../xml2json/file-backing_basic-unmap-detect.json | 64 ++++++++++++++++++++++ .../xml2json/file-backing_basic-unmap-detect.xml | 35 ++++++++++++ .../xml2json/file-backing_basic-unmap-discard.json | 0 .../xml2json/file-backing_basic-unmap-ignore.json | 64 ++++++++++++++++++++++ .../xml2json/file-backing_basic-unmap-ignore.xml | 35 ++++++++++++ .../xml2json/file-backing_basic-unmap.json | 63 +++++++++++++++++++++ .../xml2json/file-backing_basic-unmap.xml | 35 ++++++++++++ 10 files changed, 396 insertions(+) create mode 100644 tests/qemublocktestdata/xml2json/file-backing_basic-detect.json create mode 100644 tests/qemublocktestdata/xml2json/file-backing_basic-detect.xml create mode 100644 tests/qemublocktestdata/xml2json/file-backing_basic-unmap-detect.json create mode 100644 tests/qemublocktestdata/xml2json/file-backing_basic-unmap-detect.xml create mode 100644 tests/qemublocktestdata/xml2json/file-backing_basic-unmap-discard.json create mode 100644 tests/qemublocktestdata/xml2json/file-backing_basic-unmap-ignore.json create mode 100644 tests/qemublocktestdata/xml2json/file-backing_basic-unmap-ignore.xml create mode 100644 tests/qemublocktestdata/xml2json/file-backing_basic-unmap.json create mode 100644 tests/qemublocktestdata/xml2json/file-backing_basic-unmap.xml diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index 34509be543..4a2051da57 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -465,6 +465,11 @@ mymain(void) TEST_DISK_TO_JSON("file-qcow2-backing-chain-encryption"); TEST_DISK_TO_JSON("network-qcow2-backing-chain-encryption_auth"); + TEST_DISK_TO_JSON("file-backing_basic-unmap"); + TEST_DISK_TO_JSON("file-backing_basic-unmap-detect"); + TEST_DISK_TO_JSON("file-backing_basic-unmap-ignore"); + TEST_DISK_TO_JSON("file-backing_basic-detect"); + cleanup: virHashFree(diskxmljsondata.schema); qemuTestDriverFree(&driver); diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-detect.json b/tests/qemublocktestdata/xml2json/file-backing_basic-detect.json new file mode 100644 index 0000000000..c1e4c40757 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-detect.json @@ -0,0 +1,60 @@ +{ + "node-name": "node-a-f", + "read-only": false, + "detect-zeroes": "on", + "driver": "qcow", + "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": "qed", + "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": "gluster", + "volume": "images", + "path": "c", + "server": [ + { + "type": "inet", + "host": "test.org", + "port": "24007" + } + ], + "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-detect.xml b/tests/qemublocktestdata/xml2json/file-backing_basic-detect.xml new file mode 100644 index 0000000000..99c4d58534 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-detect.xml @@ -0,0 +1,35 @@ +<disk type='file' device='disk'> + <driver name='qemu' type='qcow' detect_zeroes='unmap'/> + <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='qed'/> + <source file='/var/lib/libvirt/images/b'> + <privateData> + <nodename storage='node-b-s' format='node-b-f'/> + </privateData> + </source> + <backingStore type='network' index='2'> + <format type='vmdk'/> + <source protocol='gluster' name='images/c'> + <host name='test.org'/> + <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> diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-detect.json b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-detect.json new file mode 100644 index 0000000000..b00008dd54 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-detect.json @@ -0,0 +1,64 @@ +{ + "node-name": "node-a-f", + "read-only": false, + "discard": "unmap", + "detect-zeroes": "unmap", + "driver": "qcow", + "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, + "discard": "unmap", + "driver": "qed", + "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, + "discard": "unmap", + "driver": "vmdk", + "file": { + "driver": "gluster", + "volume": "images", + "path": "c", + "server": [ + { + "type": "inet", + "host": "test.org", + "port": "24007" + } + ], + "node-name": "node-c-s", + "read-only": true, + "discard": "unmap" + }, + "backing": "node-d-f" +} +{ + "node-name": "node-d-f", + "read-only": true, + "discard": "unmap", + "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-unmap-detect.xml b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-detect.xml new file mode 100644 index 0000000000..afccea8b61 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-detect.xml @@ -0,0 +1,35 @@ +<disk type='file' device='disk'> + <driver name='qemu' type='qcow' discard='unmap' detect_zeroes='unmap'/> + <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='qed'/> + <source file='/var/lib/libvirt/images/b'> + <privateData> + <nodename storage='node-b-s' format='node-b-f'/> + </privateData> + </source> + <backingStore type='network' index='2'> + <format type='vmdk'/> + <source protocol='gluster' name='images/c'> + <host name='test.org'/> + <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> diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-discard.json b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-discard.json new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-ignore.json b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-ignore.json new file mode 100644 index 0000000000..5419deafc0 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-ignore.json @@ -0,0 +1,64 @@ +{ + "node-name": "node-a-f", + "read-only": false, + "discard": "ignore", + "detect-zeroes": "on", + "driver": "qcow", + "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, + "discard": "ignore", + "driver": "qed", + "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, + "discard": "ignore", + "driver": "vmdk", + "file": { + "driver": "gluster", + "volume": "images", + "path": "c", + "server": [ + { + "type": "inet", + "host": "test.org", + "port": "24007" + } + ], + "node-name": "node-c-s", + "read-only": true, + "discard": "unmap" + }, + "backing": "node-d-f" +} +{ + "node-name": "node-d-f", + "read-only": true, + "discard": "ignore", + "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-unmap-ignore.xml b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-ignore.xml new file mode 100644 index 0000000000..8cd4bb90e4 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-ignore.xml @@ -0,0 +1,35 @@ +<disk type='file' device='disk'> + <driver name='qemu' type='qcow' discard='ignore' detect_zeroes='on'/> + <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='qed'/> + <source file='/var/lib/libvirt/images/b'> + <privateData> + <nodename storage='node-b-s' format='node-b-f'/> + </privateData> + </source> + <backingStore type='network' index='2'> + <format type='vmdk'/> + <source protocol='gluster' name='images/c'> + <host name='test.org'/> + <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> diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-unmap.json b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap.json new file mode 100644 index 0000000000..1efc462c06 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap.json @@ -0,0 +1,63 @@ +{ + "node-name": "node-a-f", + "read-only": false, + "discard": "unmap", + "driver": "qcow", + "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, + "discard": "unmap", + "driver": "qed", + "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, + "discard": "unmap", + "driver": "vmdk", + "file": { + "driver": "gluster", + "volume": "images", + "path": "c", + "server": [ + { + "type": "inet", + "host": "test.org", + "port": "24007" + } + ], + "node-name": "node-c-s", + "read-only": true, + "discard": "unmap" + }, + "backing": "node-d-f" +} +{ + "node-name": "node-d-f", + "read-only": true, + "discard": "unmap", + "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-unmap.xml b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap.xml new file mode 100644 index 0000000000..4c7356b178 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap.xml @@ -0,0 +1,35 @@ +<disk type='file' device='disk'> + <driver name='qemu' type='qcow' discard='unmap'/> + <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='qed'/> + <source file='/var/lib/libvirt/images/b'> + <privateData> + <nodename storage='node-b-s' format='node-b-f'/> + </privateData> + </source> + <backingStore type='network' index='2'> + <format type='vmdk'/> + <source protocol='gluster' name='images/c'> + <host name='test.org'/> + <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@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list