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

proxmox_kvm unable to force-stop a VM quickly #6257

Closed
1 task done
elelayan opened this issue Mar 28, 2023 · 3 comments · Fixed by #6570
Closed
1 task done

proxmox_kvm unable to force-stop a VM quickly #6257

elelayan opened this issue Mar 28, 2023 · 3 comments · Fixed by #6570
Labels
bug This issue/PR relates to a bug cloud module module plugins plugin (any type)

Comments

@elelayan
Copy link

Summary

state: stopped won't stop a VM not responding to ACPI until 10 minutes, even with force: true.

It will create a shutdown task, with the (proxmox VE) timeout of 10 minutes.
The task will finally halt the VM after 10 minutes but it's too long.

pve api timeout parameter should be exposed, to have proxmox kill the VM quicker.

Maybe it could be computed as the module's timeout parameter - 1?

Issue Type

Bug Report

Component Name

proxmox_kvm

Ansible Version

$ ansible --version
ansible [core 2.12.1]
  config file = None
  configured module search path = ['/home/xxx/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/xxx/software/miniconda/envs/yyyy/lib/python3.9/site-packages/ansible
  ansible collection location = /home/xxx/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/xxx/software/miniconda/envs/yyyyy/bin/ansible
  python version = 3.9.9 | packaged by conda-forge | (main, Dec 20 2021, 02:40:17) [GCC 9.4.0]
  jinja version = 3.0.3
  libyaml = True

Community.general Version

$ ansible-galaxy collection list community.general
Collection        Version
----------------- -------
community.general 4.0.2 

Configuration

N/A

OS / Environment

No response

Steps to Reproduce

---
- hosts: all
  gather_facts: false

  tasks:
    - name: Stop template VM Will timeout
      community.general.proxmox_kvm:
        api_user: "{{ pve_user }}"
        api_token_id: "{{ pve_token_id }}"
        api_token_secret: "{{ pve_token_secret }}"
        api_host: "{{ pve_api_host }}"
        vmid: "{{ pve_template_vm_id }}"
        state: stopped
        force: true
      delegate_to: localhost

    - name: Stop template VM will succeed after 10 minutes
      community.general.proxmox_kvm:
        api_user: "{{ pve_user }}"
        api_token_id: "{{ pve_token_id }}"
        api_token_secret: "{{ pve_token_secret }}"
        api_host: "{{ pve_api_host }}"
        vmid: "{{ pve_template_vm_id }}"
        state: stopped
        force: true
        timeout: 610
      delegate_to: localhost

Expected Results

I expected to be able to specify a shorter timeout than 10 minutes for the force shutdown to apply.

Actual Results

Proxmox will halt the VM after 10 minutes, but it's too long.

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@elelayan
Copy link
Author

A timeout parameter should be added in plugins/modules/proxmox_kvm.py#L1058

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added bug This issue/PR relates to a bug cloud module module plugins plugin (any type) labels Mar 28, 2023
@UnderGreen
Copy link
Contributor

UnderGreen commented May 22, 2023

As far as I can see there is no timeout option for deleting QEMU virtual machine.

EDIT. My bad. We were talking about stopping VM, not deleting it. Then yeah, there is a timeout option.

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 cloud module module plugins plugin (any type)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants