Unable to create libvirt compute resource VM instances - Foreman 3.2.1 w/ Katello 4.4.1, AlmaLinux 8.6

Hello from 2023!

I can reproduce this problem with a LVM-backed libvirtd storage pool and creating a VM from the Foreman webUI.

I have done some digging today and it seems to be a change to newer qemu version (I’m testing with CentOS Stream 9) no longer accepting disk type of ‘file’ pointing to a block device:

And indeed Foreman managed to create the VM in libvirtd but is unable to start it because qemu-kvm errors out with error similar to:

'file' driver requires '/dev/VG/FQDN-disk1' to be a regular file

If we change the file driver to block we can start the VM:

# diff orig.xml new.xml
26c26
<     <disk type='file' device='disk'>
---
>     <disk type='block' device='disk'>
28c28
<       <source file='/dev/VolGroup01/fqdn-disk1'/>
---
>       <source dev='/dev/VolGroup01/fqdn-disk1'/>
# virsh start fqdn
Domain 'fqdn' started

Now question: is there a way to teach Foreman to either use the right disk “type” automagically or add an option for users to choose the disk type?

Looking forward to hear from you guys.