Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

define might get silently ignored #53

Open
thomwiggers opened this issue Dec 17, 2020 · 3 comments
Open

define might get silently ignored #53

thomwiggers opened this issue Dec 17, 2020 · 3 comments

Comments

@thomwiggers
Copy link

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

except libvirtError as e:
if e.get_error_code() != 9: # 9 means 'domain already exists' error
module.fail_json(msg='libvirtError: %s' % e.message)

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.

@mhio
Copy link

mhio commented Mar 7, 2021

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

@leegarrett
Copy link

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
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants