]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuxml2argvdata/disk-slices: Add test case for 'luks' encryption
authorPeter Krempa <pkrempa@redhat.com>
Thu, 19 Mar 2020 15:26:53 +0000 (16:26 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 20 Mar 2020 08:47:16 +0000 (09:47 +0100)
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@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
tests/qemuxml2argvdata/disk-slices.x86_64-latest.args
tests/qemuxml2argvdata/disk-slices.xml
tests/qemuxml2xmloutdata/disk-slices.x86_64-latest.xml

index 49daa293a48ebab0673f45cbba3d1bcff207626a..75485c17a794cfa63efcafa5c9bedf6c82b5ca44 100644 (file)
@@ -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
index cff7cc7ee4a02382d64bd3939339734f2a8dd7ab..5c6f29d15471e7c0dcedfcd5894375f2535982f2 100644 (file)
       </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'/>
index 65590df41702772e28082397712f1bac854ae9bc..4f4abcda1f6b246b35cd80b95b345bf532b17a07 100644 (file)
       <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>