community.libvirt icon indicating copy to clipboard operation
community.libvirt copied to clipboard

define might get silently ignored

Open thomwiggers opened this issue 4 years ago • 3 comments

This was a big source of confusion for me, as I'd been trying to use ansible to resize VMs.

https://github.com/ansible-collections/community.libvirt/blob/2185098fbb3851a107793909e7ff4d501d013829/plugins/modules/virt.py#L552-L554

While I expect a definition to be updated (if I use the virsh define command line this works as expected), instead this is just getting silently ignored.

thomwiggers avatar Dec 17 '20 15:12 thomwiggers

I think I have run into this for a slightly different reason, that probably should be an error. I had moved past the described "domain already exists" behaviour by managing xml templates external to libvirt to catch changes.

But today I was getting a silent changed==false for a domain define but no domain would appear in virsh list --all. On closer inspection, the error in the -vvv output was:

operation failed: domain \'x\' is already defined with uuid y-y-y-y-y

But that didn't bubble up to Ansible. I haven't verified the codepath in the libvirt module code yet but this seems pretty likely

mhio avatar Mar 07 '21 06:03 mhio

Is there an update on this? It seems as though it's currently not possible to update an existing XML description, and I'd consider that a pretty big limitation of the module.

leegarrett avatar Aug 15 '23 20:08 leegarrett

After further trial and error it appears that the define command does succeed when the uuid value is provided in the XML template, otherwise it is silently discarded. It would be great if it would fail with a helpful error message instead of silently discarding the possible change and returning ok.

leegarrett avatar Aug 15 '23 21:08 leegarrett