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

community.general.proxmox_kvm Destroy Detached Disk #8828

Open
1 of 2 tasks
polachz opened this issue Sep 3, 2024 · 2 comments
Open
1 of 2 tasks

community.general.proxmox_kvm Destroy Detached Disk #8828

polachz opened this issue Sep 3, 2024 · 2 comments
Labels
bug This issue/PR relates to a bug module module plugins plugin (any type)

Comments

@polachz
Copy link

polachz commented Sep 3, 2024

Summary

When use community.general.proxmox_kvm module to destroy the VM, all VM disks are destroyed, even if disk is detached from VM. This behavior can't be changed by any parameter.

When VM is destroyed by Proxmox GUI, special checkbox:

  • Destroy unreferenced disks owned by guest

Must be checked to destroy detached disk

Issue Type

Bug Report

Component Name

proxmox_kvm

Ansible Version

ansible [core 2.16.9]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/boss/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.12/site-packages/ansible
  ansible collection location = /home/boss/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.12.4 (main, Jun  7 2024, 00:00:00) [GCC 14.1.1 20240607 (Red Hat 14.1.1-5)] (/usr/bin/python3)
  jinja version = 3.1.4
  libyaml = True

Community.general Version

Collection        Version
----------------- -------
community.general 7.4.0  

Configuration

$ ansible-config dump --only-changed

OS / Environment

Fedora 40

Steps to Reproduce

- name: "Detaching VM Drive"
  community.general.proxmox_disk:
    api_host: "{{ pve_api_host }}"
    api_user: "{{ pve_api_user }}"
    api_password: "{{ pve_password | default(omit) }}"
    api_token_id: "{{ pve_api_token_id | default(omit) }}"
    api_token_secret: "{{ pve_api_token_secret | default(omit) }}"

    vmid: 100

    media: 'disk'
    disk: scsi1
    state: 'detached'
  delegate_to: localhost

- name: "Destroy Proxmox VM"
community.general.proxmox_kvm:
    api_host: "{{ pve_api_host }}"
    api_user: "{{ pve_api_user }}"
    api_password: "{{ pve_password | default(omit) }}"
    api_token_id: "{{ pve_api_token_id | default(omit) }}"
    api_token_secret: "{{ pve_api_token_secret | default(omit) }}"

    vmid:  100
    state: absent
  delegate_to: localhost

Expected Results

I expected thatdetached VM disk stay preserved on the Proxmox storage as it happened when VM is removed by GUI.

Alternatively i excpect parameter to specify if detached disk will be destroyed or not.

See sumary filed

Actual Results

VM Disk is destroyed and can't be re-attached to re-created VM

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@polachz polachz changed the title community.general.proxmox_kvm destroy detached disks community.general.proxmox_kvm Destroy Detached Disk Sep 3, 2024
@ansibullbot
Copy link
Collaborator

Files identified in the description:

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

click here for bot help

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added bug This issue/PR relates to a bug module module plugins plugin (any type) labels Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug module module plugins plugin (any type)
Projects
None yet
Development

No branches or pull requests

2 participants