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

virt module is not able to undefine a domain with defined nvram file #43915

Closed
cueball23 opened this issue Aug 10, 2018 · 5 comments
Closed

virt module is not able to undefine a domain with defined nvram file #43915

cueball23 opened this issue Aug 10, 2018 · 5 comments
Labels
affects_2.6 This issue/PR affects Ansible v2.6 bot_closed bug This issue/PR relates to a bug. cloud collection:community.libvirt collection Related to Ansible Collections work module This issue/PR relates to a module. needs_collection_redirect https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md support:community This issue/PR relates to code supported by the Ansible community. traceback This issue/PR includes a traceback. virt Virt community (incl. QEMU, KVM, libvirt, ovirt, RHV and Proxmox)

Comments

@cueball23
Copy link

SUMMARY

Virt module is not able to undefine a domain with defined nvram file.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

virt

ANSIBLE VERSION
ansible 2.6.2
python version = 2.7.12
CONFIGURATION
OS / ENVIRONMENT
STEPS TO REPRODUCE
- name: undefine vm with nvram
  virt:
    name: example-vm-nvram
    command: undefine
EXPECTED RESULTS

domain "example-vm-nvram" is undefined

ACTUAL RESULTS
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: libvirt.libvirtError: Requested operation is not valid: cannot delete inactive domain with nvram
fatal: [localhost]: FAILED! => {"changed": false, "failed_when_result": true, "msg": "Requested operation is not valid: cannot delete inactive domain with nvram"}

The libvirt function undefine is not able to remove a domain with nvram, by using undefineFlags it is possible to control the deletion of the nvram file. See:
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainUndefine
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainUndefineFlags

With the following command the undefine action is possible.

virsh undefine example-vm-nvram --nvram
@ansibot
Copy link
Contributor

ansibot commented Aug 10, 2018

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot ansibot added affects_2.6 This issue/PR affects Ansible v2.6 bug This issue/PR relates to a bug. cloud module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. support:community This issue/PR relates to code supported by the Ansible community. traceback This issue/PR includes a traceback. labels Aug 10, 2018
@bcoca bcoca removed the needs_triage Needs a first human triage before being processed. label Aug 13, 2018
@ansibot
Copy link
Contributor

ansibot commented Nov 25, 2018

@dagwieers dagwieers added the virt Virt community (incl. QEMU, KVM, libvirt, ovirt, RHV and Proxmox) label Feb 11, 2019
@ansibot
Copy link
Contributor

ansibot commented Feb 19, 2019

@arrfab
Copy link
Contributor

arrfab commented Jul 27, 2019

I confirm this bug as we encounter it in the CentOS QA environment : aarch64 VMs have nvram defined, and the ansible virt module doesn't have a way to pass options.
For the time being, we had to fall back to "shell" module :

- name: == KVM == undefining UEFI VMs with nvram
  shell: "virsh undefine --nvram {{ inventory_hostname }}"
  when: '"aarch64" in inventory_hostname'
  delegate_to: "{{ kvm_host }}"

@ansibot ansibot added collection Related to Ansible Collections work collection:community.libvirt needs_collection_redirect https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md labels Apr 29, 2020
@ansibot
Copy link
Contributor

ansibot commented Aug 16, 2020

Thank you very much for your interest in Ansible. Ansible has migrated much of the content into separate repositories to allow for more rapid, independent development. We are closing this issue/PR because this content has been moved to one or more collection repositories.

For further information, please see:
https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.6 This issue/PR affects Ansible v2.6 bot_closed bug This issue/PR relates to a bug. cloud collection:community.libvirt collection Related to Ansible Collections work module This issue/PR relates to a module. needs_collection_redirect https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md support:community This issue/PR relates to code supported by the Ansible community. traceback This issue/PR includes a traceback. virt Virt community (incl. QEMU, KVM, libvirt, ovirt, RHV and Proxmox)
Projects
None yet
Development

No branches or pull requests

5 participants