Skip to content

Properly handle proxmox_snap timeout parameter #10176

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelogs/fragments/10176-fix-proxmox_snap_timeout.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
minor_changes:
- proxmox - correctly handle proxmox_snap timeout parameter (//github.com/ansible-collections/community.general/pull/10176)
10 changes: 5 additions & 5 deletions plugins/modules/proxmox_snap.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def _container_mp_restore(self, vm, vmid, timeout, unbind, mountpoints, vmstatus

def start_instance(self, vm, vmid, timeout):
taskid = self.vmstatus(vm, vmid).start.post()
while timeout:
while timeout >= 0:
if self.api_task_ok(vm['node'], taskid):
return True
timeout -= 1
Expand All @@ -202,7 +202,7 @@ def start_instance(self, vm, vmid, timeout):

def shutdown_instance(self, vm, vmid, timeout):
taskid = self.vmstatus(vm, vmid).shutdown.post()
while timeout:
while timeout >= 0:
if self.api_task_ok(vm['node'], taskid):
return True
timeout -= 1
Expand Down Expand Up @@ -245,7 +245,7 @@ def snapshot_create(self, vm, vmid, timeout, snapname, description, vmstate, unb
else:
taskid = self.snapshot(vm, vmid).post(snapname=snapname, description=description, vmstate=int(vmstate))

while timeout:
while timeout >= 0:
if self.api_task_ok(vm['node'], taskid):
break
if timeout == 0:
Expand All @@ -265,7 +265,7 @@ def snapshot_remove(self, vm, vmid, timeout, snapname, force):
return True

taskid = self.snapshot(vm, vmid).delete(snapname, force=int(force))
while timeout:
while timeout >= 0:
if self.api_task_ok(vm['node'], taskid):
return True
if timeout == 0:
Expand All @@ -281,7 +281,7 @@ def snapshot_rollback(self, vm, vmid, timeout, snapname):
return True

taskid = self.snapshot(vm, vmid)(snapname).post("rollback")
while timeout:
while timeout >= 0:
if self.api_task_ok(vm['node'], taskid):
return True
if timeout == 0:
Expand Down