stackhpc / ansible-role-libvirt-vm

This role configures and creates VMs on a KVM hypervisor.
128 stars 67 forks source link

Failed to use this roles with lvm #61

Open roumano opened 3 years ago

roumano commented 3 years ago

I've failed to use this roles with lvm (at least on debian 10)

Error

if data to created VM is :

  volumes:
    - name: 'ns2'
      type: 'volume'
      capacity: '10GB'
      pool: 'lvm_pool'
      format: 'raw'

The role is crashing with this error

    "msg": "internal error: qemu unexpectedly closed the monitor: 2020-09-11T12:51:05.508705Z qemu-system-x86_64: -drive file=/dev/lvm_pool/ns3,format=raw,if=none,id=drive-virtio-disk0: Could not open '/dev/lvm_pool/ns3': Permission denied"

Debugging

It's now can boot

Change need

To permit these two line change (done on virsh edit) via ansible and your role :

from : when: item.type | default(libvirt_volume_default_type) == 'volume' to : when: item.type | default(libvirt_volume_default_type) == 'volume' or ( item.type | default(libvirt_volume_default_type) == 'block' and item.pool is defined )