Since libvirt handles the luks encryption in a weird special way (raw+encryption) we should really test that case with slices as well. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- .../disk-slices.x86_64-latest.args | 38 ++++++++++++------- tests/qemuxml2argvdata/disk-slices.xml | 13 +++++++ .../disk-slices.x86_64-latest.xml | 16 +++++++- 3 files changed, 52 insertions(+), 15 deletions(-) diff --git a/tests/qemuxml2argvdata/disk-slices.x86_64-latest.args b/tests/qemuxml2argvdata/disk-slices.x86_64-latest.args index 49daa293a4..75485c17a7 100644 --- a/tests/qemuxml2argvdata/disk-slices.x86_64-latest.args +++ b/tests/qemuxml2argvdata/disk-slices.x86_64-latest.args @@ -29,25 +29,35 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -boot strict=on \ -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \ -blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/raw.img",\ -"node-name":"libvirt-3-storage","auto-read-only":true,"discard":"unmap"}' \ --blockdev '{"node-name":"libvirt-3-format","read-only":false,"driver":"raw",\ -"offset":1234,"size":321,"file":"libvirt-3-storage"}' \ --device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x2,drive=libvirt-3-format,\ +"node-name":"libvirt-4-storage","auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"node-name":"libvirt-4-format","read-only":false,"driver":"raw",\ +"offset":1234,"size":321,"file":"libvirt-4-storage"}' \ +-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x2,drive=libvirt-4-format,\ id=virtio-disk0,bootindex=1 \ -blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/raw.img",\ -"node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"}' \ --blockdev '{"driver":"raw","node-name":"libvirt-2-slice-sto","offset":9876,\ -"size":123456789,"file":"libvirt-2-storage","auto-read-only":true,\ +"node-name":"libvirt-3-storage","auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"driver":"raw","node-name":"libvirt-3-slice-sto","offset":9876,\ +"size":123456789,"file":"libvirt-3-storage","auto-read-only":true,\ "discard":"unmap"}' \ --blockdev '{"node-name":"libvirt-2-format","read-only":true,"driver":"qcow2",\ -"file":"libvirt-2-slice-sto","backing":null}' \ +-blockdev '{"node-name":"libvirt-3-format","read-only":true,"driver":"qcow2",\ +"file":"libvirt-3-slice-sto","backing":null}' \ -blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/overlay.qcow2",\ -"node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \ --blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"qcow2",\ -"file":"libvirt-1-storage","backing":"libvirt-2-format"}' \ --device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x3,drive=libvirt-1-format,\ +"node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"node-name":"libvirt-2-format","read-only":false,"driver":"qcow2",\ +"file":"libvirt-2-storage","backing":"libvirt-3-format"}' \ +-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x3,drive=libvirt-2-format,\ id=virtio-disk1 \ --device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 \ +-object secret,id=libvirt-1-format-encryption-secret0,\ +data=9eao5F8qtkGt+seB1HYivWIxbtwUu6MQtg1zpj/oDtUsPr1q8wBYM91uEHCn6j/1,\ +keyid=masterKey0,iv=AAECAwQFBgcICQoLDA0ODw==,format=base64 \ +-blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/luks.img",\ +"node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"luks",\ +"key-secret":"libvirt-1-format-encryption-secret0","offset":1234,"size":321,\ +"file":"libvirt-1-storage"}' \ +-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x4,drive=libvirt-1-format,\ +id=virtio-disk2 \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5 \ -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\ resourcecontrol=deny \ -msg timestamp=on diff --git a/tests/qemuxml2argvdata/disk-slices.xml b/tests/qemuxml2argvdata/disk-slices.xml index cff7cc7ee4..5c6f29d154 100644 --- a/tests/qemuxml2argvdata/disk-slices.xml +++ b/tests/qemuxml2argvdata/disk-slices.xml @@ -38,6 +38,19 @@ </backingStore> <target dev='vdb' bus='virtio'/> </disk> + <disk type='file' device='disk'> + <driver name='qemu' type='raw'/> + <source file='/var/lib/libvirt/images/luks.img'> + <slices> + <slice type='storage' offset='1234' size='321'/> + </slices> + <encryption format='luks'> + <secret type='passphrase' uuid='0a81f5b2-8403-7b23-c8d6-21ccc2f80d6f'/> + </encryption> + </source> + <backingStore/> + <target dev='vdc' bus='virtio'/> + </disk> <controller type='usb'/> <controller type='pci' model='pci-root'/> <memballoon model='virtio'/> diff --git a/tests/qemuxml2xmloutdata/disk-slices.x86_64-latest.xml b/tests/qemuxml2xmloutdata/disk-slices.x86_64-latest.xml index 65590df417..4f4abcda1f 100644 --- a/tests/qemuxml2xmloutdata/disk-slices.x86_64-latest.xml +++ b/tests/qemuxml2xmloutdata/disk-slices.x86_64-latest.xml @@ -43,6 +43,20 @@ <target dev='vdb' bus='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </disk> + <disk type='file' device='disk'> + <driver name='qemu' type='raw'/> + <source file='/var/lib/libvirt/images/luks.img'> + <slices> + <slice type='storage' offset='1234' size='321'/> + </slices> + <encryption format='luks'> + <secret type='passphrase' uuid='0a81f5b2-8403-7b23-c8d6-21ccc2f80d6f'/> + </encryption> + </source> + <backingStore/> + <target dev='vdc' bus='virtio'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </disk> <controller type='usb' index='0' model='piix3-uhci'> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> @@ -50,7 +64,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <memballoon model='virtio'> - <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> </memballoon> </devices> </domain> -- 2.24.1