From 2c71edcf90b343b821245dbd50eba9a801e3b0a0 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Fri, 16 Mar 2018 17:56:16 +0100 Subject: [PATCH] tests: qemublock: basic qcow2 tests 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 Reviewed-by: John Ferlan --- tests/qemublocktest.c | 3 + .../file-qcow2-backing-chain-encryption.json | 34 +++++ .../file-qcow2-backing-chain-encryption.xml | 31 +++++ .../file-qcow2-backing-chain-noopts.json | 130 ++++++++++++++++++ .../file-qcow2-backing-chain-noopts.xml | 113 +++++++++++++++ ...file-qcow2-backing-chain-unterminated.json | 25 ++++ .../file-qcow2-backing-chain-unterminated.xml | 24 ++++ 7 files changed, 360 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 b44f8c32a3..8c19b8ef49 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -461,6 +461,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..a1292284bf --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-encryption.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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..12db679f37 --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-noopts.xml @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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..7520cfe86a --- /dev/null +++ b/tests/qemublocktestdata/xml2json/file-qcow2-backing-chain-unterminated.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + +