Closed ognjen011 closed 4 years ago
Perhaps you could provide some more info on what you changed in the XML?
Sure here is an example of Manual instance:
<devices>
<emulator>/usr/bin/kvm-spice</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/var/lib/libvirt/images/123.img'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</disk>
created by the module:
<emulator>/usr/bin/kvm</emulator>
<disk type='volume' device='disk'>
<driver name='qemu' type='qcow2'/>
<source pool='host1' volume='122-pavm.img'/>
<target dev='vdb' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</disk>
Notice the source line target and address lines that are different.
Then this is missing but this could be me not doing this correctly and i am then not able to connect an image. I guess i could provide image inside module.
<disk type='file' device='cdrom'>
<driver name='qemu' type='raw'/>
<source file='/var/lib/libvirt/images/ubuntu-18.04.1-live-server-amd64.iso'/>
<target dev='hda' bus='ide'/>
<readonly/>
<address type='drive' controller='0' bus='1' target='0' unit='1'/>
</disk>
Finally if i try to delete the instance by hand it says that i t cannot delete the storage. So there is something not right... any help would be great. Delete does work if i set instance to absent in the role.
I only see kvm and kvm-spice lines
Added xml in that previous post.
It sounds a bit like your storage pool is setup differently than what we've tested with. Are you able to create volumes? e.g. can you run commands similar to those in https://github.com/stackhpc/ansible-role-libvirt-vm/blob/master/files/virt_volume.sh#L78 to create volumes?
For the emulator, you can configure this via libvirt_vm_emulator
. If you don't set it the role will try to detect it.
For the CD ROM, we normally use preinstalled qcow2 disk images rather than installer ISOs. Adding CDROM support would probably need a code change.
Ok thanks let me look into my storage, it is set to type DIR not a pool. The other parts are less important this is for the preconfigured image anyway. I will try out libvirt_vm_emulator
Running those commands does actually create volume fine no errors, i think the problem is when you reference the image as pool and volume in xml rather than source file things break.
Got it working thanks for the help. Just made some edits to the template file.
Looks like this issue is something I just spent several days debugging.
For the record, in our case it was due to Apparmour's lack of support for storage pools. https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1677398
In our case the following commit fixed it by moving us from pools to file - as it seems @ognjen011 did.
Wish I looked here in the issue list a week ago...!
Hi i am having a problem using this module correctly, when i create a vm instance i am unable to actually get it to boot. I did check the xml and it seem to create storage in a completely different way which in might be ok but i noticed three things for me
Anyway deleting the whole instance and keeping the same storage created by the module i am able to manually create instance and boot with no problems. I am using just a basic example provided to create a vm in readme.