Test the output against the schema and also against what we expect. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- tests/qemublocktest.c | 170 ++++++++++++++++++ .../imagecreate/luks-encopts.json | 19 ++ .../imagecreate/luks-encopts.xml | 16 ++ .../imagecreate/luks-noopts.json | 14 ++ .../imagecreate/luks-noopts.xml | 14 ++ .../imagecreate/network-gluster-qcow2.json | 28 +++ .../imagecreate/network-gluster-qcow2.xml | 13 ++ .../imagecreate/network-rbd-qcow2.json | 26 +++ .../imagecreate/network-rbd-qcow2.xml | 13 ++ .../imagecreate/network-sheepdog-qcow2.json | 20 +++ .../imagecreate/network-sheepdog-qcow2.xml | 12 ++ .../imagecreate/network-ssh-qcow2.json | 19 ++ .../imagecreate/network-ssh-qcow2.xml | 12 ++ .../imagecreate/qcow2-backing-luks.json | 15 ++ .../imagecreate/qcow2-backing-luks.xml | 1 + .../imagecreate/qcow2-backing-raw-nbd.json | 15 ++ .../imagecreate/qcow2-backing-raw-nbd.xml | 1 + .../imagecreate/qcow2-backing-raw.json | 15 ++ .../imagecreate/qcow2-backing-raw.xml | 1 + .../qcow2-luks-encopts-backing.json | 24 +++ .../qcow2-luks-encopts-backing.xml | 1 + .../imagecreate/qcow2-luks-encopts.json | 22 +++ .../imagecreate/qcow2-luks-encopts.xml | 16 ++ .../imagecreate/qcow2-luks-noopts.json | 17 ++ .../imagecreate/qcow2-luks-noopts.xml | 14 ++ .../qemublocktestdata/imagecreate/qcow2.json | 13 ++ tests/qemublocktestdata/imagecreate/qcow2.xml | 11 ++ .../imagecreate/raw-nbd.json | 4 + .../qemublocktestdata/imagecreate/raw-nbd.xml | 12 ++ tests/qemublocktestdata/imagecreate/raw.json | 9 + tests/qemublocktestdata/imagecreate/raw.xml | 11 ++ 31 files changed, 578 insertions(+) create mode 100644 tests/qemublocktestdata/imagecreate/luks-encopts.json create mode 100644 tests/qemublocktestdata/imagecreate/luks-encopts.xml create mode 100644 tests/qemublocktestdata/imagecreate/luks-noopts.json create mode 100644 tests/qemublocktestdata/imagecreate/luks-noopts.xml create mode 100644 tests/qemublocktestdata/imagecreate/network-gluster-qcow2.json create mode 100644 tests/qemublocktestdata/imagecreate/network-gluster-qcow2.xml create mode 100644 tests/qemublocktestdata/imagecreate/network-rbd-qcow2.json create mode 100644 tests/qemublocktestdata/imagecreate/network-rbd-qcow2.xml create mode 100644 tests/qemublocktestdata/imagecreate/network-sheepdog-qcow2.json create mode 100644 tests/qemublocktestdata/imagecreate/network-sheepdog-qcow2.xml create mode 100644 tests/qemublocktestdata/imagecreate/network-ssh-qcow2.json create mode 100644 tests/qemublocktestdata/imagecreate/network-ssh-qcow2.xml create mode 100644 tests/qemublocktestdata/imagecreate/qcow2-backing-luks.json create mode 120000 tests/qemublocktestdata/imagecreate/qcow2-backing-luks.xml create mode 100644 tests/qemublocktestdata/imagecreate/qcow2-backing-raw-nbd.json create mode 120000 tests/qemublocktestdata/imagecreate/qcow2-backing-raw-nbd.xml create mode 100644 tests/qemublocktestdata/imagecreate/qcow2-backing-raw.json create mode 120000 tests/qemublocktestdata/imagecreate/qcow2-backing-raw.xml create mode 100644 tests/qemublocktestdata/imagecreate/qcow2-luks-encopts-backing.json create mode 120000 tests/qemublocktestdata/imagecreate/qcow2-luks-encopts-backing.xml create mode 100644 tests/qemublocktestdata/imagecreate/qcow2-luks-encopts.json create mode 100644 tests/qemublocktestdata/imagecreate/qcow2-luks-encopts.xml create mode 100644 tests/qemublocktestdata/imagecreate/qcow2-luks-noopts.json create mode 100644 tests/qemublocktestdata/imagecreate/qcow2-luks-noopts.xml create mode 100644 tests/qemublocktestdata/imagecreate/qcow2.json create mode 100644 tests/qemublocktestdata/imagecreate/qcow2.xml create mode 100644 tests/qemublocktestdata/imagecreate/raw-nbd.json create mode 100644 tests/qemublocktestdata/imagecreate/raw-nbd.xml create mode 100644 tests/qemublocktestdata/imagecreate/raw.json create mode 100644 tests/qemublocktestdata/imagecreate/raw.xml diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index 5c381d1e3b..cd5047a545 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -342,6 +342,138 @@ testQemuDiskXMLToPropsValidateFile(const void *opaque) } +struct testQemuImageCreateData { + const char *name; + const char *backingname; + virHashTablePtr schema; + virJSONValuePtr schemaroot; + virQEMUDriverPtr driver; + virQEMUCapsPtr qemuCaps; +}; + +static const char *testQemuImageCreatePath = abs_srcdir "/qemublocktestdata/imagecreate/"; + +static virStorageSourcePtr +testQemuImageCreateLoadDiskXML(const char *name, + virDomainXMLOptionPtr xmlopt) + +{ + virDomainSnapshotDiskDefPtr diskdef = NULL; + VIR_AUTOPTR(xmlDoc) doc = NULL; + VIR_AUTOPTR(xmlXPathContext) ctxt = NULL; + xmlNodePtr node; + VIR_AUTOFREE(char *) xmlpath = NULL; + virStorageSourcePtr ret = NULL; + + if (virAsprintf(&xmlpath, "%s%s.xml", + testQemuImageCreatePath, name) < 0) + return NULL; + + if (!(doc = virXMLParseFileCtxt(xmlpath, &ctxt))) + return NULL; + + if (!(node = virXPathNode("//disk", ctxt))) { + VIR_TEST_VERBOSE("failed to find <source> element\n"); + return NULL; + } + + if (VIR_ALLOC(diskdef) < 0) + return NULL; + + if (virDomainSnapshotDiskDefParseXML(node, ctxt, diskdef, + VIR_DOMAIN_DEF_PARSE_STATUS, + xmlopt) == 0) + VIR_STEAL_PTR(ret, diskdef->src); + + virDomainSnapshotDiskDefFree(diskdef); + return ret; +} + + +static int +testQemuImageCreate(const void *opaque) +{ + struct testQemuImageCreateData *data = (void *) opaque; + VIR_AUTOPTR(virJSONValue) protocolprops = NULL; + VIR_AUTOPTR(virJSONValue) formatprops = NULL; + VIR_AUTOUNREF(virStorageSourcePtr) src = NULL; + VIR_AUTOCLEAN(virBuffer) debug = VIR_BUFFER_INITIALIZER; + VIR_AUTOCLEAN(virBuffer) actualbuf = VIR_BUFFER_INITIALIZER; + VIR_AUTOFREE(char *) jsonprotocol = NULL; + VIR_AUTOFREE(char *) jsonformat = NULL; + VIR_AUTOFREE(char *) actual = NULL; + VIR_AUTOFREE(char *) jsonpath = NULL; + + if (!(src = testQemuImageCreateLoadDiskXML(data->name, data->driver->xmlopt))) + return -1; + + if (data->backingname && + !(src->backingStore = testQemuImageCreateLoadDiskXML(data->backingname, + data->driver->xmlopt))) + return -1; + + if (testQemuDiskXMLToJSONFakeSecrets(src) < 0) + return -1; + + /* fake some sizes */ + src->capacity = 1337; + src->physical = 42; + + if (qemuDomainValidateStorageSource(src, data->qemuCaps) < 0) + return -1; + + if (qemuBlockStorageSourceCreateGetStorageProps(src, &protocolprops) < 0) + return -1; + + if (qemuBlockStorageSourceCreateGetFormatProps(src, src->backingStore, &formatprops) < 0) + return -1; + + if (formatprops) { + if (!(jsonformat = virJSONValueToString(formatprops, true))) + return -1; + + if (testQEMUSchemaValidate(formatprops, data->schemaroot, data->schema, + &debug) < 0) { + VIR_AUTOFREE(char *) debugmsg = virBufferContentAndReset(&debug); + VIR_TEST_VERBOSE("blockdev-create format json does not conform to QAPI schema"); + VIR_TEST_DEBUG("json:\n%s\ndoes not match schema. Debug output:\n %s", + jsonformat, NULLSTR(debugmsg)); + return -1; + } + virBufferFreeAndReset(&debug); + } + + if (protocolprops) { + if (!(jsonprotocol = virJSONValueToString(protocolprops, true))) + return -1; + + if (testQEMUSchemaValidate(protocolprops, data->schemaroot, data->schema, + &debug) < 0) { + VIR_AUTOFREE(char *) debugmsg = virBufferContentAndReset(&debug); + VIR_TEST_VERBOSE("blockdev-create protocol json does not conform to QAPI schema"); + VIR_TEST_DEBUG("json:\n%s\ndoes not match schema. Debug output:\n %s", + jsonprotocol, NULLSTR(debugmsg)); + return -1; + } + virBufferFreeAndReset(&debug); + } + + virBufferStrcat(&actualbuf, "protocol:\n", NULLSTR(jsonprotocol), + "\nformat:\n", NULLSTR(jsonformat), NULL); + virBufferTrim(&actualbuf, "\n", -1); + virBufferAddLit(&actualbuf, "\n"); + + if (virAsprintf(&jsonpath, "%s%s.json", + testQemuImageCreatePath, data->name) < 0) + return -1; + + if (!(actual = virBufferContentAndReset(&actualbuf))) + return -1; + + return virTestCompareToFile(actual, jsonpath); +} + + static int testQemuDiskXMLToPropsValidateFileSrcOnly(const void *opaque) { @@ -383,6 +515,7 @@ mymain(void) virQEMUDriver driver; struct testBackingXMLjsonXMLdata xmljsonxmldata; struct testQemuDiskXMLToJSONData diskxmljsondata; + struct testQemuImageCreateData imagecreatedata; char *capslatest_x86_64 = NULL; virQEMUCapsPtr caps_x86_64 = NULL; @@ -390,6 +523,7 @@ mymain(void) return EXIT_FAILURE; diskxmljsondata.driver = &driver; + imagecreatedata.driver = &driver; if (!(capslatest_x86_64 = testQemuGetLatestCapsForArch("x86_64", "xml"))) return EXIT_FAILURE; @@ -401,6 +535,7 @@ mymain(void) return EXIT_FAILURE; diskxmljsondata.qemuCaps = caps_x86_64; + imagecreatedata.qemuCaps = caps_x86_64; virTestCounterReset("qemu storage source xml->json->xml "); @@ -548,6 +683,41 @@ mymain(void) TEST_DISK_TO_JSON("block-raw-noopts"); TEST_DISK_TO_JSON("block-raw-reservations"); +# define TEST_IMAGE_CREATE(testname, testbacking) \ + do { \ + imagecreatedata.name = testname; \ + imagecreatedata.backingname = testbacking; \ + if (virTestRun("image create xml to props " testname, testQemuImageCreate, \ + &imagecreatedata) < 0) \ + ret = -1; \ + } while (0) + imagecreatedata.schema = diskxmljsondata.schema; + if (virQEMUQAPISchemaPathGet("blockdev-create/arg-type/options", + imagecreatedata.schema, + &imagecreatedata.schemaroot) < 0 || + !imagecreatedata.schemaroot) { + VIR_TEST_VERBOSE("failed to find schema entry for blockdev-create\n"); + ret = -1; + goto cleanup; + } + + TEST_IMAGE_CREATE("raw", NULL); + TEST_IMAGE_CREATE("raw-nbd", NULL); + TEST_IMAGE_CREATE("luks-noopts", NULL); + TEST_IMAGE_CREATE("luks-encopts", NULL); + TEST_IMAGE_CREATE("qcow2", NULL); + TEST_IMAGE_CREATE("qcow2-luks-noopts", NULL); + TEST_IMAGE_CREATE("qcow2-luks-encopts", NULL); + TEST_IMAGE_CREATE("qcow2-backing-raw", "raw"); + TEST_IMAGE_CREATE("qcow2-backing-raw-nbd", "raw-nbd"); + TEST_IMAGE_CREATE("qcow2-backing-luks", "luks-noopts"); + TEST_IMAGE_CREATE("qcow2-luks-encopts-backing", "qcow2"); + + TEST_IMAGE_CREATE("network-gluster-qcow2", NULL); + TEST_IMAGE_CREATE("network-rbd-qcow2", NULL); + TEST_IMAGE_CREATE("network-ssh-qcow2", NULL); + TEST_IMAGE_CREATE("network-sheepdog-qcow2", NULL); + cleanup: virHashFree(diskxmljsondata.schema); qemuTestDriverFree(&driver); diff --git a/tests/qemublocktestdata/imagecreate/luks-encopts.json b/tests/qemublocktestdata/imagecreate/luks-encopts.json new file mode 100644 index 0000000000..f065ad89a7 --- /dev/null +++ b/tests/qemublocktestdata/imagecreate/luks-encopts.json @@ -0,0 +1,19 @@ +protocol: +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/i.img", + "size": 42 +} + +format: +{ + "key-secret": "0123456789ABCDEF0123456789ABCDE-encalias", + "cipher-alg": "serpent-256", + "cipher-mode": "cbc", + "hash-alg": "sha256", + "ivgen-alg": "plain64", + "ivgen-hash-alg": "sha256", + "driver": "luks", + "file": "0123456789ABCDEF0123456789ABCDE", + "size": 1337 +} diff --git a/tests/qemublocktestdata/imagecreate/luks-encopts.xml b/tests/qemublocktestdata/imagecreate/luks-encopts.xml new file mode 100644 index 0000000000..bb0ee54adc --- /dev/null +++ b/tests/qemublocktestdata/imagecreate/luks-encopts.xml @@ -0,0 +1,16 @@ +<disk device='disk' name='vda'> + <driver type='raw'/> + <source file='/var/lib/libvirt/images/i.img'> + <privateData> + <nodenames> + <nodename type='storage' name='0123456789ABCDEF0123456789ABCDE'/> + <nodename type='format' name='0123456789ABCDEF0123456789ABCDE'/> + </nodenames> + </privateData> + <encryption format='luks'> + <secret type='passphrase' uuid='f52a81b2-424e-490c-823d-6bd4235bc572'/> + <cipher name='serpent' size='256' mode='cbc' hash='sha256'/> + <ivgen name='plain64' hash='sha256'/> + </encryption> + </source> +</disk> diff --git a/tests/qemublocktestdata/imagecreate/luks-noopts.json b/tests/qemublocktestdata/imagecreate/luks-noopts.json new file mode 100644 index 0000000000..1ea1948119 --- /dev/null +++ b/tests/qemublocktestdata/imagecreate/luks-noopts.json @@ -0,0 +1,14 @@ +protocol: +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/i.img", + "size": 42 +} + +format: +{ + "key-secret": "0123456789ABCDEF0123456789ABCDE-encalias", + "driver": "luks", + "file": "0123456789ABCDEF0123456789ABCDE", + "size": 1337 +} diff --git a/tests/qemublocktestdata/imagecreate/luks-noopts.xml b/tests/qemublocktestdata/imagecreate/luks-noopts.xml new file mode 100644 index 0000000000..ac224b02de --- /dev/null +++ b/tests/qemublocktestdata/imagecreate/luks-noopts.xml @@ -0,0 +1,14 @@ +<disk device='disk' name='vda'> + <driver type='raw'/> + <source file='/var/lib/libvirt/images/i.img'> + <privateData> + <nodenames> + <nodename type='storage' name='0123456789ABCDEF0123456789ABCDE'/> + <nodename type='format' name='0123456789ABCDEF0123456789ABCDE'/> + </nodenames> + </privateData> + <encryption format='luks'> + <secret type='passphrase' uuid='f52a81b2-424e-490c-823d-6bd4235bc572'/> + </encryption> + </source> +</disk> diff --git a/tests/qemublocktestdata/imagecreate/network-gluster-qcow2.json b/tests/qemublocktestdata/imagecreate/network-gluster-qcow2.json new file mode 100644 index 0000000000..aee7bfd401 --- /dev/null +++ b/tests/qemublocktestdata/imagecreate/network-gluster-qcow2.json @@ -0,0 +1,28 @@ +protocol: +{ + "driver": "gluster", + "location": { + "volume": "asdf", + "path": "i.qcow2", + "server": [ + { + "type": "inet", + "host": "example.com", + "port": "1234" + }, + { + "type": "inet", + "host": "alternate.example.com", + "port": "3214" + } + ] + }, + "size": 42 +} + +format: +{ + "driver": "qcow2", + "file": "0123456789ABCDEF0123456789ABCDE", + "size": 1337 +} diff --git a/tests/qemublocktestdata/imagecreate/network-gluster-qcow2.xml b/tests/qemublocktestdata/imagecreate/network-gluster-qcow2.xml new file mode 100644 index 0000000000..f3dbf24180 --- /dev/null +++ b/tests/qemublocktestdata/imagecreate/network-gluster-qcow2.xml @@ -0,0 +1,13 @@ +<disk device='disk' name='vda' type='network'> + <driver type='qcow2'/> + <source protocol='gluster' name='asdf/i.qcow2'> + <host name='example.com' port='1234'/> + <host name='alternate.example.com' port='3214'/> + <privateData> + <nodenames> + <nodename type='storage' name='0123456789ABCDEF0123456789ABCDE'/> + <nodename type='format' name='0123456789ABCDEF0123456789ABCDE'/> + </nodenames> + </privateData> + </source> +</disk> diff --git a/tests/qemublocktestdata/imagecreate/network-rbd-qcow2.json b/tests/qemublocktestdata/imagecreate/network-rbd-qcow2.json new file mode 100644 index 0000000000..56d9c0f1ed --- /dev/null +++ b/tests/qemublocktestdata/imagecreate/network-rbd-qcow2.json @@ -0,0 +1,26 @@ +protocol: +{ + "driver": "rbd", + "location": { + "pool": "asdf", + "image": "i.qcow2", + "server": [ + { + "host": "example.com", + "port": "1234" + }, + { + "host": "alternate.example.com", + "port": "4321" + } + ] + }, + "size": 42 +} + +format: +{ + "driver": "qcow2", + "file": "0123456789ABCDEF0123456789ABCDE", + "size": 1337 +} diff --git a/tests/qemublocktestdata/imagecreate/network-rbd-qcow2.xml b/tests/qemublocktestdata/imagecreate/network-rbd-qcow2.xml new file mode 100644 index 0000000000..0f6c1ddb98 --- /dev/null +++ b/tests/qemublocktestdata/imagecreate/network-rbd-qcow2.xml @@ -0,0 +1,13 @@ +<disk device='disk' name='vda' type='network'> + <driver type='qcow2'/> + <source protocol='rbd' name='asdf/i.qcow2'> + <host name='example.com' port='1234'/> + <host name='alternate.example.com' port='4321'/> + <privateData> + <nodenames> + <nodename type='storage' name='0123456789ABCDEF0123456789ABCDE'/> + <nodename type='format' name='0123456789ABCDEF0123456789ABCDE'/> + </nodenames> + </privateData> + </source> +</disk> diff --git a/tests/qemublocktestdata/imagecreate/network-sheepdog-qcow2.json b/tests/qemublocktestdata/imagecreate/network-sheepdog-qcow2.json new file mode 100644 index 0000000000..b7272625a2 --- /dev/null +++ b/tests/qemublocktestdata/imagecreate/network-sheepdog-qcow2.json @@ -0,0 +1,20 @@ +protocol: +{ + "driver": "sheepdog", + "location": { + "server": { + "type": "inet", + "host": "example.com", + "port": "1234" + }, + "vdi": "asdf/i.qcow2" + }, + "size": 42 +} + +format: +{ + "driver": "qcow2", + "file": "0123456789ABCDEF0123456789ABCDE", + "size": 1337 +} diff --git a/tests/qemublocktestdata/imagecreate/network-sheepdog-qcow2.xml b/tests/qemublocktestdata/imagecreate/network-sheepdog-qcow2.xml new file mode 100644 index 0000000000..1145daafdd --- /dev/null +++ b/tests/qemublocktestdata/imagecreate/network-sheepdog-qcow2.xml @@ -0,0 +1,12 @@ +<disk device='disk' name='vda' type='network'> + <driver type='qcow2'/> + <source protocol='sheepdog' name='asdf/i.qcow2'> + <host name='example.com' port='1234'/> + <privateData> + <nodenames> + <nodename type='storage' name='0123456789ABCDEF0123456789ABCDE'/> + <nodename type='format' name='0123456789ABCDEF0123456789ABCDE'/> + </nodenames> + </privateData> + </source> +</disk> diff --git a/tests/qemublocktestdata/imagecreate/network-ssh-qcow2.json b/tests/qemublocktestdata/imagecreate/network-ssh-qcow2.json new file mode 100644 index 0000000000..31416ed4fc --- /dev/null +++ b/tests/qemublocktestdata/imagecreate/network-ssh-qcow2.json @@ -0,0 +1,19 @@ +protocol: +{ + "driver": "ssh", + "location": { + "path": "asdf/i.qcow2", + "server": { + "host": "example.com", + "port": "1234" + } + }, + "size": 42 +} + +format: +{ + "driver": "qcow2", + "file": "0123456789ABCDEF0123456789ABCDE", + "size": 1337 +} diff --git a/tests/qemublocktestdata/imagecreate/network-ssh-qcow2.xml b/tests/qemublocktestdata/imagecreate/network-ssh-qcow2.xml new file mode 100644 index 0000000000..4c44f81c81 --- /dev/null +++ b/tests/qemublocktestdata/imagecreate/network-ssh-qcow2.xml @@ -0,0 +1,12 @@ +<disk device='disk' name='vda' type='network'> + <driver type='qcow2'/> + <source protocol='ssh' name='asdf/i.qcow2'> + <host name='example.com' port='1234'/> + <privateData> + <nodenames> + <nodename type='storage' name='0123456789ABCDEF0123456789ABCDE'/> + <nodename type='format' name='0123456789ABCDEF0123456789ABCDE'/> + </nodenames> + </privateData> + </source> +</disk> diff --git a/tests/qemublocktestdata/imagecreate/qcow2-backing-luks.json b/tests/qemublocktestdata/imagecreate/qcow2-backing-luks.json new file mode 100644 index 0000000000..63ba35dc79 --- /dev/null +++ b/tests/qemublocktestdata/imagecreate/qcow2-backing-luks.json @@ -0,0 +1,15 @@ +protocol: +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/i.qcow2", + "size": 42 +} + +format: +{ + "driver": "qcow2", + "file": "0123456789ABCDEF0123456789ABCDE", + "size": 1337, + "backing-file": "/var/lib/libvirt/images/i.img", + "backing-fmt": "luks" +} diff --git a/tests/qemublocktestdata/imagecreate/qcow2-backing-luks.xml b/tests/qemublocktestdata/imagecreate/qcow2-backing-luks.xml new file mode 120000 index 0000000000..5769c2c866 --- /dev/null +++ b/tests/qemublocktestdata/imagecreate/qcow2-backing-luks.xml @@ -0,0 +1 @@ +qcow2.xml \ No newline at end of file diff --git a/tests/qemublocktestdata/imagecreate/qcow2-backing-raw-nbd.json b/tests/qemublocktestdata/imagecreate/qcow2-backing-raw-nbd.json new file mode 100644 index 0000000000..34ce74a548 --- /dev/null +++ b/tests/qemublocktestdata/imagecreate/qcow2-backing-raw-nbd.json @@ -0,0 +1,15 @@ +protocol: +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/i.qcow2", + "size": 42 +} + +format: +{ + "driver": "qcow2", + "file": "0123456789ABCDEF0123456789ABCDE", + "size": 1337, + "backing-file": "json:{\"driver\":\"nbd\",\"server\":{\"type\":\"inet\",\"host\":\"example.com\",\"port\":\"1234\"}}", + "backing-fmt": "raw" +} diff --git a/tests/qemublocktestdata/imagecreate/qcow2-backing-raw-nbd.xml b/tests/qemublocktestdata/imagecreate/qcow2-backing-raw-nbd.xml new file mode 120000 index 0000000000..5769c2c866 --- /dev/null +++ b/tests/qemublocktestdata/imagecreate/qcow2-backing-raw-nbd.xml @@ -0,0 +1 @@ +qcow2.xml \ No newline at end of file diff --git a/tests/qemublocktestdata/imagecreate/qcow2-backing-raw.json b/tests/qemublocktestdata/imagecreate/qcow2-backing-raw.json new file mode 100644 index 0000000000..8176c8dadd --- /dev/null +++ b/tests/qemublocktestdata/imagecreate/qcow2-backing-raw.json @@ -0,0 +1,15 @@ +protocol: +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/i.qcow2", + "size": 42 +} + +format: +{ + "driver": "qcow2", + "file": "0123456789ABCDEF0123456789ABCDE", + "size": 1337, + "backing-file": "/var/lib/libvirt/images/i.img", + "backing-fmt": "raw" +} diff --git a/tests/qemublocktestdata/imagecreate/qcow2-backing-raw.xml b/tests/qemublocktestdata/imagecreate/qcow2-backing-raw.xml new file mode 120000 index 0000000000..5769c2c866 --- /dev/null +++ b/tests/qemublocktestdata/imagecreate/qcow2-backing-raw.xml @@ -0,0 +1 @@ +qcow2.xml \ No newline at end of file diff --git a/tests/qemublocktestdata/imagecreate/qcow2-luks-encopts-backing.json b/tests/qemublocktestdata/imagecreate/qcow2-luks-encopts-backing.json new file mode 100644 index 0000000000..a57617dfac --- /dev/null +++ b/tests/qemublocktestdata/imagecreate/qcow2-luks-encopts-backing.json @@ -0,0 +1,24 @@ +protocol: +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/i.qcow2", + "size": 42 +} + +format: +{ + "driver": "qcow2", + "file": "0123456789ABCDEF0123456789ABCDE", + "size": 1337, + "backing-file": "/var/lib/libvirt/images/i.qcow2", + "backing-fmt": "qcow2", + "encrypt": { + "key-secret": "0123456789ABCDEF0123456789ABCDE-encalias", + "cipher-alg": "serpent-256", + "cipher-mode": "cbc", + "hash-alg": "sha256", + "ivgen-alg": "plain64", + "ivgen-hash-alg": "sha256", + "format": "luks" + } +} diff --git a/tests/qemublocktestdata/imagecreate/qcow2-luks-encopts-backing.xml b/tests/qemublocktestdata/imagecreate/qcow2-luks-encopts-backing.xml new file mode 120000 index 0000000000..6ea018cec2 --- /dev/null +++ b/tests/qemublocktestdata/imagecreate/qcow2-luks-encopts-backing.xml @@ -0,0 +1 @@ +qcow2-luks-encopts.xml \ No newline at end of file diff --git a/tests/qemublocktestdata/imagecreate/qcow2-luks-encopts.json b/tests/qemublocktestdata/imagecreate/qcow2-luks-encopts.json new file mode 100644 index 0000000000..8796726fcb --- /dev/null +++ b/tests/qemublocktestdata/imagecreate/qcow2-luks-encopts.json @@ -0,0 +1,22 @@ +protocol: +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/i.qcow2", + "size": 42 +} + +format: +{ + "driver": "qcow2", + "file": "0123456789ABCDEF0123456789ABCDE", + "size": 1337, + "encrypt": { + "key-secret": "0123456789ABCDEF0123456789ABCDE-encalias", + "cipher-alg": "serpent-256", + "cipher-mode": "cbc", + "hash-alg": "sha256", + "ivgen-alg": "plain64", + "ivgen-hash-alg": "sha256", + "format": "luks" + } +} diff --git a/tests/qemublocktestdata/imagecreate/qcow2-luks-encopts.xml b/tests/qemublocktestdata/imagecreate/qcow2-luks-encopts.xml new file mode 100644 index 0000000000..d6616bd164 --- /dev/null +++ b/tests/qemublocktestdata/imagecreate/qcow2-luks-encopts.xml @@ -0,0 +1,16 @@ +<disk device='disk' name='vda'> + <driver type='qcow2'/> + <source file='/var/lib/libvirt/images/i.qcow2'> + <privateData> + <nodenames> + <nodename type='storage' name='0123456789ABCDEF0123456789ABCDE'/> + <nodename type='format' name='0123456789ABCDEF0123456789ABCDE'/> + </nodenames> + </privateData> + <encryption format='luks'> + <secret type='passphrase' uuid='f52a81b2-424e-490c-823d-6bd4235bc572'/> + <cipher name='serpent' size='256' mode='cbc' hash='sha256'/> + <ivgen name='plain64' hash='sha256'/> + </encryption> + </source> +</disk> diff --git a/tests/qemublocktestdata/imagecreate/qcow2-luks-noopts.json b/tests/qemublocktestdata/imagecreate/qcow2-luks-noopts.json new file mode 100644 index 0000000000..f9caaee6bb --- /dev/null +++ b/tests/qemublocktestdata/imagecreate/qcow2-luks-noopts.json @@ -0,0 +1,17 @@ +protocol: +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/i.qcow2", + "size": 42 +} + +format: +{ + "driver": "qcow2", + "file": "0123456789ABCDEF0123456789ABCDE", + "size": 1337, + "encrypt": { + "key-secret": "0123456789ABCDEF0123456789ABCDE-encalias", + "format": "luks" + } +} diff --git a/tests/qemublocktestdata/imagecreate/qcow2-luks-noopts.xml b/tests/qemublocktestdata/imagecreate/qcow2-luks-noopts.xml new file mode 100644 index 0000000000..e2d1c42424 --- /dev/null +++ b/tests/qemublocktestdata/imagecreate/qcow2-luks-noopts.xml @@ -0,0 +1,14 @@ +<disk device='disk' name='vda'> + <driver type='qcow2'/> + <source file='/var/lib/libvirt/images/i.qcow2'> + <privateData> + <nodenames> + <nodename type='storage' name='0123456789ABCDEF0123456789ABCDE'/> + <nodename type='format' name='0123456789ABCDEF0123456789ABCDE'/> + </nodenames> + </privateData> + <encryption format='luks'> + <secret type='passphrase' uuid='f52a81b2-424e-490c-823d-6bd4235bc572'/> + </encryption> + </source> +</disk> diff --git a/tests/qemublocktestdata/imagecreate/qcow2.json b/tests/qemublocktestdata/imagecreate/qcow2.json new file mode 100644 index 0000000000..7142cf67b6 --- /dev/null +++ b/tests/qemublocktestdata/imagecreate/qcow2.json @@ -0,0 +1,13 @@ +protocol: +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/i.qcow2", + "size": 42 +} + +format: +{ + "driver": "qcow2", + "file": "0123456789ABCDEF0123456789ABCDE", + "size": 1337 +} diff --git a/tests/qemublocktestdata/imagecreate/qcow2.xml b/tests/qemublocktestdata/imagecreate/qcow2.xml new file mode 100644 index 0000000000..f3c235f82f --- /dev/null +++ b/tests/qemublocktestdata/imagecreate/qcow2.xml @@ -0,0 +1,11 @@ +<disk device='disk' name='vda'> + <driver type='qcow2'/> + <source file='/var/lib/libvirt/images/i.qcow2'> + <privateData> + <nodenames> + <nodename type='storage' name='0123456789ABCDEF0123456789ABCDE'/> + <nodename type='format' name='0123456789ABCDEF0123456789ABCDE'/> + </nodenames> + </privateData> + </source> +</disk> diff --git a/tests/qemublocktestdata/imagecreate/raw-nbd.json b/tests/qemublocktestdata/imagecreate/raw-nbd.json new file mode 100644 index 0000000000..d1e089e3e3 --- /dev/null +++ b/tests/qemublocktestdata/imagecreate/raw-nbd.json @@ -0,0 +1,4 @@ +protocol: +<null> +format: +<null> diff --git a/tests/qemublocktestdata/imagecreate/raw-nbd.xml b/tests/qemublocktestdata/imagecreate/raw-nbd.xml new file mode 100644 index 0000000000..256bf23797 --- /dev/null +++ b/tests/qemublocktestdata/imagecreate/raw-nbd.xml @@ -0,0 +1,12 @@ +<disk device='disk' name='vda' type='network'> + <driver type='raw'/> + <source protocol='nbd'> + <host name='example.com' port='1234'/> + <privateData> + <nodenames> + <nodename type='storage' name='0123456789ABCDEF0123456789ABCDE'/> + <nodename type='format' name='0123456789ABCDEF0123456789ABCDE'/> + </nodenames> + </privateData> + </source> +</disk> diff --git a/tests/qemublocktestdata/imagecreate/raw.json b/tests/qemublocktestdata/imagecreate/raw.json new file mode 100644 index 0000000000..06abb25ab9 --- /dev/null +++ b/tests/qemublocktestdata/imagecreate/raw.json @@ -0,0 +1,9 @@ +protocol: +{ + "driver": "file", + "filename": "/var/lib/libvirt/images/i.img", + "size": 42 +} + +format: +<null> diff --git a/tests/qemublocktestdata/imagecreate/raw.xml b/tests/qemublocktestdata/imagecreate/raw.xml new file mode 100644 index 0000000000..3a91600bd8 --- /dev/null +++ b/tests/qemublocktestdata/imagecreate/raw.xml @@ -0,0 +1,11 @@ +<disk device='disk' name='vda'> + <driver type='raw'/> + <source file='/var/lib/libvirt/images/i.img'> + <privateData> + <nodenames> + <nodename type='storage' name='0123456789ABCDEF0123456789ABCDE'/> + <nodename type='format' name='0123456789ABCDEF0123456789ABCDE'/> + </nodenames> + </privateData> + </source> +</disk> -- 2.21.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list