importing luks-encrypted lvm volume
Cole Robinson
crobinso at redhat.com
Sun Nov 6 21:17:34 UTC 2022
On 11/3/22 9:25 AM, Erik Huelsmann wrote:
> Hi,
>
> I'd like to use virt-install to create a new VM which imports an
> existing volume. This volume is luks-encrypted. When I manually attach
> the VM with the correct encryption settings, the resulting XML looks
> like this:
>
> <disk type='block' device='disk'>
> <driver name='qemu' type='raw' cache='none' io='io_uring'/>
> <source dev='/dev/p1/my-vm.pgdata' index='2'/>
> <backingStore/>
> <target dev='sdb' bus='scsi'/>
> <encryption format='luks'>
> <secret type='passphrase'
> uuid='27a023d0-5afa-11ed-9822-c3a776c2fdff'/>
> </encryption>
> <alias name='scsi0-0-0-1'/>
> <address type='drive' controller='0' bus='0' target='0' unit='1'/>
> </disk>
>
> I'm able to create all of the above XML with the exception of
>
> <encryption format='luks'>
> <secret type='passphrase'
> uuid='27a023d0-5afa-11ed-9822-c3a776c2fdff'/>
> </encryption>
>
> Is there a way to have virt-install (or virt-xml) generate this as part
> of the VM definition?
It's not pretty but the arguments to `--disk` should do it. Put them in
the same `--disk` string that configures the rest of the device
--disk
xpath0.set=./encryption/@format=luks,xpath1.set=./encryption/secret/@type=passphrase,xpath2.set=./encryption/secret/@uuid=27a023d0-5afa-11ed-9822-c3a776c2fdff
- Cole
More information about the virt-tools-list
mailing list