1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-22 17:34:18 +03:00

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 <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
Peter Krempa 2018-03-16 17:56:16 +01:00
parent 23a7f94893
commit 2c71edcf90
7 changed files with 360 additions and 0 deletions

View File

@ -461,6 +461,9 @@ mymain(void)
TEST_DISK_TO_JSON("file-raw-aio_native"); TEST_DISK_TO_JSON("file-raw-aio_native");
TEST_DISK_TO_JSON("file-backing_basic-aio_threads"); TEST_DISK_TO_JSON("file-backing_basic-aio_threads");
TEST_DISK_TO_JSON("file-raw-luks"); 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: cleanup:
virHashFree(diskxmljsondata.schema); virHashFree(diskxmljsondata.schema);

View File

@ -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
}

View File

@ -0,0 +1,31 @@
<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>
<nodenames>
<nodename type='storage' name='node-a-s'/>
<nodename type='format' name='node-b-f'/>
</nodenames>
</privateData>
</source>
<backingStore type='file' index='1'>
<format type='qcow2'/>
<source file='/var/lib/libvirt/images/b'>
<privateData>
<nodenames>
<nodename type='storage' name='node-b-s'/>
<nodename type='format' name='node-b-f'/>
</nodenames>
</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>

View File

@ -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
}

View File

@ -0,0 +1,113 @@
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/var/lib/libvirt/images/rhel7.3.1507297895'>
<privateData>
<nodenames>
<nodename type='storage' name='#block004'/>
<nodename type='format' name='#block126'/>
</nodenames>
</privateData>
</source>
<backingStore type='file' index='1'>
<format type='qcow2'/>
<source file='/var/lib/libvirt/images/rhel7.3.1484071872'>
<privateData>
<nodenames>
<nodename type='storage' name='#block256'/>
<nodename type='format' name='#block313'/>
</nodenames>
</privateData>
</source>
<backingStore type='file' index='2'>
<format type='qcow2'/>
<source file='/var/lib/libvirt/images/rhel7.3.1483615252'>
<privateData>
<nodenames>
<nodename type='storage' name='#block418'/>
<nodename type='format' name='#block556'/>
</nodenames>
</privateData>
</source>
<backingStore type='file' index='3'>
<format type='qcow2'/>
<source file='/var/lib/libvirt/images/rhel7.3.1483605924'>
<privateData>
<nodenames>
<nodename type='storage' name='#block624'/>
<nodename type='format' name='#block767'/>
</nodenames>
</privateData>
</source>
<backingStore type='file' index='4'>
<format type='qcow2'/>
<source file='/var/lib/libvirt/images/rhel7.3.1483605920'>
<privateData>
<nodenames>
<nodename type='storage' name='#block869'/>
<nodename type='format' name='#block937'/>
</nodenames>
</privateData>
</source>
<backingStore type='file' index='5'>
<format type='qcow2'/>
<source file='/var/lib/libvirt/images/rhel7.3.1483546244'>
<privateData>
<nodenames>
<nodename type='storage' name='#block1047'/>
<nodename type='format' name='#block1157'/>
</nodenames>
</privateData>
</source>
<backingStore type='file' index='6'>
<format type='qcow2'/>
<source file='/var/lib/libvirt/images/rhel7.3.1483545901'>
<privateData>
<nodenames>
<nodename type='storage' name='#block1279'/>
<nodename type='format' name='#block1392'/>
</nodenames>
</privateData>
</source>
<backingStore type='file' index='7'>
<format type='qcow2'/>
<source file='/var/lib/libvirt/images/rhel7.3.1483545313'>
<privateData>
<nodenames>
<nodename type='storage' name='#block1444'/>
<nodename type='format' name='#block1523'/>
</nodenames>
</privateData>
</source>
<backingStore type='file' index='8'>
<format type='qcow2'/>
<source file='/var/lib/libvirt/images/rhel7.3.1483536402'>
<privateData>
<nodenames>
<nodename type='storage' name='#block1602'/>
<nodename type='format' name='#block1742'/>
</nodenames>
</privateData>
</source>
<backingStore type='file' index='9'>
<format type='qcow2'/>
<source file='/var/lib/libvirt/images/rhel7.3.qcow2'>
<privateData>
<nodenames>
<nodename type='storage' name='#block1864'/>
<nodename type='format' name='#block1909'/>
</nodenames>
</privateData>
</source>
<backingStore/>
</backingStore>
</backingStore>
</backingStore>
</backingStore>
</backingStore>
</backingStore>
</backingStore>
</backingStore>
</backingStore>
<target dev='vda' bus='virtio'/>
<alias name='virtio-disk0'/>
</disk>

View File

@ -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"
}
}

View File

@ -0,0 +1,24 @@
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/var/lib/libvirt/images/rhel7.3.1507297895'>
<privateData>
<nodenames>
<nodename type='storage' name='#block004'/>
<nodename type='format' name='#block126'/>
</nodenames>
</privateData>
</source>
<backingStore type='file' index='1'>
<format type='qcow2'/>
<source file='/var/lib/libvirt/images/rhel7.3.1484071872'>
<privateData>
<nodenames>
<nodename type='storage' name='#block256'/>
<nodename type='format' name='#block313'/>
</nodenames>
</privateData>
</source>
</backingStore>
<target dev='vda' bus='virtio'/>
<alias name='virtio-disk0'/>
</disk>