1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-09 01:18:00 +03:00

tests: qemublock: Test handling of all cache modes

The test cases would correspond to the following -drive command lines:

dir-fat-cache.xml:
-drive file=fat:/var/somefiles,if=none,id=drive-dummy,readonly=on,cache=directsync
-device virtio-blk-pci,scsi=off,drive=drive-dummy,id=dummy,write-cache=off

file-backing_basic-cache-directsync.xml:
-drive file=/var/lib/libvirt/images/a,format=qcow2,if=none,id=drive-dummy,cache=directsync
-device virtio-blk-pci,scsi=off,drive=drive-dummy,id=dummy,write-cache=off

file-backing_basic-cache-none.xml:
-drive file=/var/lib/libvirt/images/a,format=qcow2,if=none,id=drive-dummy,cache=none
-device virtio-blk-pci,scsi=off,drive=drive-dummy,id=dummy,write-cache=on

file-backing_basic-cache-unsafe.xml:
-drive file=/var/lib/libvirt/images/a,format=qcow2,if=none,id=drive-dummy,cache=unsafe
-device virtio-blk-pci,scsi=off,drive=drive-dummy,id=dummy,write-cache=on

file-backing_basic-cache-writeback.xml:
-drive file=/var/lib/libvirt/images/a,format=qcow2,if=none,id=drive-dummy,cache=writeback
-device virtio-blk-pci,scsi=off,drive=drive-dummy,id=dummy,write-cache=on

file-backing_basic-cache-writethrough.xml:
-drive file=/var/lib/libvirt/images/a,format=qcow2,if=none,id=drive-dummy,cache=writethrough
-device virtio-blk-pci,scsi=off,drive=drive-dummy,id=dummy,write-cache=off

network-qcow2-backing-chain-cache-unsafe.xml:
-drive file=rbd:rbdpool/rbdimg:id=testuser-rbd:auth_supported=cephx\;none:
        mon_host=host1.example.com\;host2.example.com,
        file.password-secret=node-a-s-secalias,format=qcow2,
        if=none,id=drive-dummy,cache=directsync
-device virtio-blk-pci,scsi=off,drive=drive-dummy,id=dummy,write-cache=off

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
Peter Krempa 2018-04-06 14:24:51 +02:00
parent 24db3d9993
commit ca916d7709
15 changed files with 821 additions and 0 deletions

View File

@ -471,6 +471,14 @@ mymain(void)
TEST_DISK_TO_JSON("file-backing_basic-unmap-ignore");
TEST_DISK_TO_JSON("file-backing_basic-detect");
TEST_DISK_TO_JSON("file-backing_basic-cache-none");
TEST_DISK_TO_JSON("file-backing_basic-cache-writethrough");
TEST_DISK_TO_JSON("file-backing_basic-cache-writeback");
TEST_DISK_TO_JSON("file-backing_basic-cache-directsync");
TEST_DISK_TO_JSON("file-backing_basic-cache-unsafe");
TEST_DISK_TO_JSON("network-qcow2-backing-chain-cache-unsafe");
TEST_DISK_TO_JSON("dir-fat-cache");
cleanup:
virHashFree(diskxmljsondata.schema);
qemuTestDriverFree(&driver);

View File

@ -0,0 +1,22 @@
{
"node-name": "node-f",
"read-only": true,
"cache": {
"direct": true,
"no-flush": false
},
"driver": "raw",
"file": {
"driver": "vvfat",
"dir": "/var/somefiles",
"floppy": false,
"rw": false,
"node-name": "node-s",
"cache": {
"direct": true,
"no-flush": false
},
"read-only": true,
"discard": "unmap"
}
}

View File

@ -0,0 +1,13 @@
<disk type='dir' device='disk'>
<driver name='qemu' type='fat' cache='directsync'/>
<source dir='/var/somefiles'>
<privateData>
<nodenames>
<nodename type='storage' name='node-s'/>
<nodename type='format' name='node-f'/>
</nodenames>
</privateData>
</source>
<target dev='vda'/>
<readonly/>
</disk>

View File

@ -0,0 +1,91 @@
{
"node-name": "node-a-f",
"read-only": false,
"cache": {
"direct": true,
"no-flush": false
},
"driver": "qcow2",
"file": {
"driver": "file",
"filename": "/var/lib/libvirt/images/a",
"node-name": "node-a-s",
"cache": {
"direct": true,
"no-flush": false
},
"read-only": false,
"discard": "unmap"
},
"backing": "node-b-f"
}
{
"node-name": "node-b-f",
"read-only": true,
"cache": {
"direct": true,
"no-flush": false
},
"driver": "qcow2",
"file": {
"driver": "file",
"filename": "/var/lib/libvirt/images/b",
"node-name": "node-b-s",
"cache": {
"direct": true,
"no-flush": false
},
"read-only": true,
"discard": "unmap"
},
"backing": "node-c-f"
}
{
"node-name": "node-c-f",
"read-only": true,
"cache": {
"direct": true,
"no-flush": false
},
"driver": "qcow2",
"file": {
"driver": "gluster",
"volume": "images",
"path": "c",
"server": [
{
"type": "inet",
"host": "test.org",
"port": "24007"
}
],
"node-name": "node-c-s",
"cache": {
"direct": true,
"no-flush": false
},
"read-only": true,
"discard": "unmap"
},
"backing": "node-d-f"
}
{
"node-name": "node-d-f",
"read-only": true,
"cache": {
"direct": true,
"no-flush": false
},
"driver": "raw",
"file": {
"driver": "file",
"filename": "/var/lib/libvirt/images/d",
"node-name": "node-d-s",
"cache": {
"direct": true,
"no-flush": false
},
"read-only": true,
"discard": "unmap"
}
}

View File

@ -0,0 +1,47 @@
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' cache='directsync'/>
<source file='/var/lib/libvirt/images/a'>
<privateData>
<nodenames>
<nodename type='storage' name='node-a-s'/>
<nodename type='format' name='node-a-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>
</source>
<backingStore type='network' index='2'>
<format type='qcow2'/>
<source protocol='gluster' name='images/c'>
<host name='test.org'/>
<privateData>
<nodenames>
<nodename type='storage' name='node-c-s'/>
<nodename type='format' name='node-c-f'/>
</nodenames>
</privateData>
</source>
<backingStore type='file' index='3'>
<format type='raw'/>
<source file='/var/lib/libvirt/images/d'>
<privateData>
<nodenames>
<nodename type='storage' name='node-d-s'/>
<nodename type='format' name='node-d-f'/>
</nodenames>
</privateData>
</source>
<backingStore/>
</backingStore>
</backingStore>
</backingStore>
<target dev='vda'/>
</disk>

View File

@ -0,0 +1,91 @@
{
"node-name": "node-a-f",
"read-only": false,
"cache": {
"direct": true,
"no-flush": false
},
"driver": "qcow2",
"file": {
"driver": "file",
"filename": "/var/lib/libvirt/images/a",
"node-name": "node-a-s",
"cache": {
"direct": true,
"no-flush": false
},
"read-only": false,
"discard": "unmap"
},
"backing": "node-b-f"
}
{
"node-name": "node-b-f",
"read-only": true,
"cache": {
"direct": true,
"no-flush": false
},
"driver": "qcow2",
"file": {
"driver": "file",
"filename": "/var/lib/libvirt/images/b",
"node-name": "node-b-s",
"cache": {
"direct": true,
"no-flush": false
},
"read-only": true,
"discard": "unmap"
},
"backing": "node-c-f"
}
{
"node-name": "node-c-f",
"read-only": true,
"cache": {
"direct": true,
"no-flush": false
},
"driver": "qcow2",
"file": {
"driver": "gluster",
"volume": "images",
"path": "c",
"server": [
{
"type": "inet",
"host": "test.org",
"port": "24007"
}
],
"node-name": "node-c-s",
"cache": {
"direct": true,
"no-flush": false
},
"read-only": true,
"discard": "unmap"
},
"backing": "node-d-f"
}
{
"node-name": "node-d-f",
"read-only": true,
"cache": {
"direct": true,
"no-flush": false
},
"driver": "raw",
"file": {
"driver": "file",
"filename": "/var/lib/libvirt/images/d",
"node-name": "node-d-s",
"cache": {
"direct": true,
"no-flush": false
},
"read-only": true,
"discard": "unmap"
}
}

View File

@ -0,0 +1,47 @@
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' cache='none'/>
<source file='/var/lib/libvirt/images/a'>
<privateData>
<nodenames>
<nodename type='storage' name='node-a-s'/>
<nodename type='format' name='node-a-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>
</source>
<backingStore type='network' index='2'>
<format type='qcow2'/>
<source protocol='gluster' name='images/c'>
<host name='test.org'/>
<privateData>
<nodenames>
<nodename type='storage' name='node-c-s'/>
<nodename type='format' name='node-c-f'/>
</nodenames>
</privateData>
</source>
<backingStore type='file' index='3'>
<format type='raw'/>
<source file='/var/lib/libvirt/images/d'>
<privateData>
<nodenames>
<nodename type='storage' name='node-d-s'/>
<nodename type='format' name='node-d-f'/>
</nodenames>
</privateData>
</source>
<backingStore/>
</backingStore>
</backingStore>
</backingStore>
<target dev='vda'/>
</disk>

View File

@ -0,0 +1,91 @@
{
"node-name": "node-a-f",
"read-only": false,
"cache": {
"direct": false,
"no-flush": true
},
"driver": "qcow2",
"file": {
"driver": "file",
"filename": "/var/lib/libvirt/images/a",
"node-name": "node-a-s",
"cache": {
"direct": false,
"no-flush": true
},
"read-only": false,
"discard": "unmap"
},
"backing": "node-b-f"
}
{
"node-name": "node-b-f",
"read-only": true,
"cache": {
"direct": false,
"no-flush": true
},
"driver": "qcow2",
"file": {
"driver": "file",
"filename": "/var/lib/libvirt/images/b",
"node-name": "node-b-s",
"cache": {
"direct": false,
"no-flush": true
},
"read-only": true,
"discard": "unmap"
},
"backing": "node-c-f"
}
{
"node-name": "node-c-f",
"read-only": true,
"cache": {
"direct": false,
"no-flush": true
},
"driver": "qcow2",
"file": {
"driver": "gluster",
"volume": "images",
"path": "c",
"server": [
{
"type": "inet",
"host": "test.org",
"port": "24007"
}
],
"node-name": "node-c-s",
"cache": {
"direct": false,
"no-flush": true
},
"read-only": true,
"discard": "unmap"
},
"backing": "node-d-f"
}
{
"node-name": "node-d-f",
"read-only": true,
"cache": {
"direct": false,
"no-flush": true
},
"driver": "raw",
"file": {
"driver": "file",
"filename": "/var/lib/libvirt/images/d",
"node-name": "node-d-s",
"cache": {
"direct": false,
"no-flush": true
},
"read-only": true,
"discard": "unmap"
}
}

View File

@ -0,0 +1,47 @@
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' cache='unsafe'/>
<source file='/var/lib/libvirt/images/a'>
<privateData>
<nodenames>
<nodename type='storage' name='node-a-s'/>
<nodename type='format' name='node-a-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>
</source>
<backingStore type='network' index='2'>
<format type='qcow2'/>
<source protocol='gluster' name='images/c'>
<host name='test.org'/>
<privateData>
<nodenames>
<nodename type='storage' name='node-c-s'/>
<nodename type='format' name='node-c-f'/>
</nodenames>
</privateData>
</source>
<backingStore type='file' index='3'>
<format type='raw'/>
<source file='/var/lib/libvirt/images/d'>
<privateData>
<nodenames>
<nodename type='storage' name='node-d-s'/>
<nodename type='format' name='node-d-f'/>
</nodenames>
</privateData>
</source>
<backingStore/>
</backingStore>
</backingStore>
</backingStore>
<target dev='vda'/>
</disk>

View File

@ -0,0 +1,91 @@
{
"node-name": "node-a-f",
"read-only": false,
"cache": {
"direct": false,
"no-flush": false
},
"driver": "qcow2",
"file": {
"driver": "file",
"filename": "/var/lib/libvirt/images/a",
"node-name": "node-a-s",
"cache": {
"direct": false,
"no-flush": false
},
"read-only": false,
"discard": "unmap"
},
"backing": "node-b-f"
}
{
"node-name": "node-b-f",
"read-only": true,
"cache": {
"direct": false,
"no-flush": false
},
"driver": "qcow2",
"file": {
"driver": "file",
"filename": "/var/lib/libvirt/images/b",
"node-name": "node-b-s",
"cache": {
"direct": false,
"no-flush": false
},
"read-only": true,
"discard": "unmap"
},
"backing": "node-c-f"
}
{
"node-name": "node-c-f",
"read-only": true,
"cache": {
"direct": false,
"no-flush": false
},
"driver": "qcow2",
"file": {
"driver": "gluster",
"volume": "images",
"path": "c",
"server": [
{
"type": "inet",
"host": "test.org",
"port": "24007"
}
],
"node-name": "node-c-s",
"cache": {
"direct": false,
"no-flush": false
},
"read-only": true,
"discard": "unmap"
},
"backing": "node-d-f"
}
{
"node-name": "node-d-f",
"read-only": true,
"cache": {
"direct": false,
"no-flush": false
},
"driver": "raw",
"file": {
"driver": "file",
"filename": "/var/lib/libvirt/images/d",
"node-name": "node-d-s",
"cache": {
"direct": false,
"no-flush": false
},
"read-only": true,
"discard": "unmap"
}
}

View File

@ -0,0 +1,47 @@
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' cache='writeback'/>
<source file='/var/lib/libvirt/images/a'>
<privateData>
<nodenames>
<nodename type='storage' name='node-a-s'/>
<nodename type='format' name='node-a-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>
</source>
<backingStore type='network' index='2'>
<format type='qcow2'/>
<source protocol='gluster' name='images/c'>
<host name='test.org'/>
<privateData>
<nodenames>
<nodename type='storage' name='node-c-s'/>
<nodename type='format' name='node-c-f'/>
</nodenames>
</privateData>
</source>
<backingStore type='file' index='3'>
<format type='raw'/>
<source file='/var/lib/libvirt/images/d'>
<privateData>
<nodenames>
<nodename type='storage' name='node-d-s'/>
<nodename type='format' name='node-d-f'/>
</nodenames>
</privateData>
</source>
<backingStore/>
</backingStore>
</backingStore>
</backingStore>
<target dev='vda'/>
</disk>

View File

@ -0,0 +1,91 @@
{
"node-name": "node-a-f",
"read-only": false,
"cache": {
"direct": false,
"no-flush": false
},
"driver": "qcow2",
"file": {
"driver": "file",
"filename": "/var/lib/libvirt/images/a",
"node-name": "node-a-s",
"cache": {
"direct": false,
"no-flush": false
},
"read-only": false,
"discard": "unmap"
},
"backing": "node-b-f"
}
{
"node-name": "node-b-f",
"read-only": true,
"cache": {
"direct": false,
"no-flush": false
},
"driver": "qcow2",
"file": {
"driver": "file",
"filename": "/var/lib/libvirt/images/b",
"node-name": "node-b-s",
"cache": {
"direct": false,
"no-flush": false
},
"read-only": true,
"discard": "unmap"
},
"backing": "node-c-f"
}
{
"node-name": "node-c-f",
"read-only": true,
"cache": {
"direct": false,
"no-flush": false
},
"driver": "qcow2",
"file": {
"driver": "gluster",
"volume": "images",
"path": "c",
"server": [
{
"type": "inet",
"host": "test.org",
"port": "24007"
}
],
"node-name": "node-c-s",
"cache": {
"direct": false,
"no-flush": false
},
"read-only": true,
"discard": "unmap"
},
"backing": "node-d-f"
}
{
"node-name": "node-d-f",
"read-only": true,
"cache": {
"direct": false,
"no-flush": false
},
"driver": "raw",
"file": {
"driver": "file",
"filename": "/var/lib/libvirt/images/d",
"node-name": "node-d-s",
"cache": {
"direct": false,
"no-flush": false
},
"read-only": true,
"discard": "unmap"
}
}

View File

@ -0,0 +1,47 @@
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' cache='writethrough'/>
<source file='/var/lib/libvirt/images/a'>
<privateData>
<nodenames>
<nodename type='storage' name='node-a-s'/>
<nodename type='format' name='node-a-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>
</source>
<backingStore type='network' index='2'>
<format type='qcow2'/>
<source protocol='gluster' name='images/c'>
<host name='test.org'/>
<privateData>
<nodenames>
<nodename type='storage' name='node-c-s'/>
<nodename type='format' name='node-c-f'/>
</nodenames>
</privateData>
</source>
<backingStore type='file' index='3'>
<format type='raw'/>
<source file='/var/lib/libvirt/images/d'>
<privateData>
<nodenames>
<nodename type='storage' name='node-d-s'/>
<nodename type='format' name='node-d-f'/>
</nodenames>
</privateData>
</source>
<backingStore/>
</backingStore>
</backingStore>
</backingStore>
<target dev='vda'/>
</disk>

View File

@ -0,0 +1,57 @@
{
"node-name": "node-b-f",
"read-only": false,
"cache": {
"direct": false,
"no-flush": true
},
"driver": "qcow2",
"file": {
"driver": "rbd",
"pool": "rbdpool",
"image": "rbdimg",
"server": [
{
"host": "host1.example.com",
"port": "0"
},
{
"host": "host2.example.com",
"port": "0"
}
],
"user": "testuser-rbd",
"node-name": "node-a-s",
"cache": {
"direct": false,
"no-flush": true
},
"read-only": false,
"discard": "unmap"
},
"backing": "node-b-f"
}
{
"node-name": "node-b-f",
"read-only": true,
"cache": {
"direct": false,
"no-flush": true
},
"driver": "qcow2",
"file": {
"driver": "iscsi",
"portal": "example.org:3260",
"target": "iscsitarget",
"lun": 1,
"transport": "tcp",
"node-name": "node-b-s",
"cache": {
"direct": false,
"no-flush": true
},
"read-only": true,
"discard": "unmap"
},
"backing": null
}

View File

@ -0,0 +1,31 @@
<disk type='network' device='disk'>
<driver name='qemu' type='qcow2' cache='unsafe'/>
<source protocol='rbd' name='rbdpool/rbdimg'>
<host name='host1.example.com'/>
<host name='host2.example.com'/>
<auth username='testuser-rbd'>
<secret type='ceph' usage='testuser-rbd-secret'/>
</auth>
<privateData>
<nodenames>
<nodename type='storage' name='node-a-s'/>
<nodename type='format' name='node-b-f'/>
</nodenames>
</privateData>
</source>
<backingStore type='network' index='1'>
<format type='qcow2'/>
<source protocol='iscsi' name='iscsitarget/1'>
<host name='example.org'/>
<privateData>
<nodenames>
<nodename type='storage' name='node-b-s'/>
<nodename type='format' name='node-b-f'/>
</nodenames>
</privateData>
</source>
<backingStore/>
</backingStore>
<target dev='vda' bus='virtio'/>
<alias name='virtio-disk0'/>
</disk>