mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-30 04:00:21 -07:00
[PR #10176/41f8e0ba backport][stable-10] Properly handle proxmox_snap timeout parameter (#10220)
Some checks failed
EOL CI / EOL Sanity (Ⓐ2.15) (push) Has been cancelled
EOL CI / EOL Units (Ⓐ2.15+py2.7) (push) Has been cancelled
EOL CI / EOL Units (Ⓐ2.15+py3.10) (push) Has been cancelled
EOL CI / EOL Units (Ⓐ2.15+py3.5) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.15+alpine3+py:azp/posix/1/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.15+alpine3+py:azp/posix/2/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.15+alpine3+py:azp/posix/3/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.15+fedora37+py:azp/posix/1/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.15+fedora37+py:azp/posix/2/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.15+fedora37+py:azp/posix/3/) (push) Has been cancelled
nox / Run extra sanity tests (push) Has been cancelled
Some checks failed
EOL CI / EOL Sanity (Ⓐ2.15) (push) Has been cancelled
EOL CI / EOL Units (Ⓐ2.15+py2.7) (push) Has been cancelled
EOL CI / EOL Units (Ⓐ2.15+py3.10) (push) Has been cancelled
EOL CI / EOL Units (Ⓐ2.15+py3.5) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.15+alpine3+py:azp/posix/1/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.15+alpine3+py:azp/posix/2/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.15+alpine3+py:azp/posix/3/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.15+fedora37+py:azp/posix/1/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.15+fedora37+py:azp/posix/2/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.15+fedora37+py:azp/posix/3/) (push) Has been cancelled
nox / Run extra sanity tests (push) Has been cancelled
Properly handle proxmox_snap timeout parameter (#10176)
* fix: issue #10175
There is some code to handle timeout, but due to an erroneous while
test, it was never called. Use timeout >= 0 instead of timeout, so the
timeout code can be called, and properly handle timeout.
* add changelog
* Adjust changelog fragment.
---------
(cherry picked from commit 41f8e0bad6
)
Co-authored-by: GuillaumeV-cemea <101114641+GuillaumeV-cemea@users.noreply.github.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
8bffd757ce
commit
4a642c247c
2 changed files with 8 additions and 5 deletions
3
changelogs/fragments/10176-fix-proxmox_snap_timeout.yml
Normal file
3
changelogs/fragments/10176-fix-proxmox_snap_timeout.yml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
minor_changes:
|
||||||
|
- proxmox_snap - correctly handle proxmox_snap timeout parameter (https://github.com/ansible-collections/community.proxmox/issues/73, https://github.com/ansible-collections/community.proxmox/issues/95, https://github.com/ansible-collections/community.general/pull/10176).
|
|
@ -190,7 +190,7 @@ class ProxmoxSnapAnsible(ProxmoxAnsible):
|
||||||
|
|
||||||
def start_instance(self, vm, vmid, timeout):
|
def start_instance(self, vm, vmid, timeout):
|
||||||
taskid = self.vmstatus(vm, vmid).start.post()
|
taskid = self.vmstatus(vm, vmid).start.post()
|
||||||
while timeout:
|
while timeout >= 0:
|
||||||
if self.api_task_ok(vm['node'], taskid):
|
if self.api_task_ok(vm['node'], taskid):
|
||||||
return True
|
return True
|
||||||
timeout -= 1
|
timeout -= 1
|
||||||
|
@ -202,7 +202,7 @@ class ProxmoxSnapAnsible(ProxmoxAnsible):
|
||||||
|
|
||||||
def shutdown_instance(self, vm, vmid, timeout):
|
def shutdown_instance(self, vm, vmid, timeout):
|
||||||
taskid = self.vmstatus(vm, vmid).shutdown.post()
|
taskid = self.vmstatus(vm, vmid).shutdown.post()
|
||||||
while timeout:
|
while timeout >= 0:
|
||||||
if self.api_task_ok(vm['node'], taskid):
|
if self.api_task_ok(vm['node'], taskid):
|
||||||
return True
|
return True
|
||||||
timeout -= 1
|
timeout -= 1
|
||||||
|
@ -245,7 +245,7 @@ class ProxmoxSnapAnsible(ProxmoxAnsible):
|
||||||
else:
|
else:
|
||||||
taskid = self.snapshot(vm, vmid).post(snapname=snapname, description=description, vmstate=int(vmstate))
|
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):
|
if self.api_task_ok(vm['node'], taskid):
|
||||||
break
|
break
|
||||||
if timeout == 0:
|
if timeout == 0:
|
||||||
|
@ -265,7 +265,7 @@ class ProxmoxSnapAnsible(ProxmoxAnsible):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
taskid = self.snapshot(vm, vmid).delete(snapname, force=int(force))
|
taskid = self.snapshot(vm, vmid).delete(snapname, force=int(force))
|
||||||
while timeout:
|
while timeout >= 0:
|
||||||
if self.api_task_ok(vm['node'], taskid):
|
if self.api_task_ok(vm['node'], taskid):
|
||||||
return True
|
return True
|
||||||
if timeout == 0:
|
if timeout == 0:
|
||||||
|
@ -281,7 +281,7 @@ class ProxmoxSnapAnsible(ProxmoxAnsible):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
taskid = self.snapshot(vm, vmid)(snapname).post("rollback")
|
taskid = self.snapshot(vm, vmid)(snapname).post("rollback")
|
||||||
while timeout:
|
while timeout >= 0:
|
||||||
if self.api_task_ok(vm['node'], taskid):
|
if self.api_task_ok(vm['node'], taskid):
|
||||||
return True
|
return True
|
||||||
if timeout == 0:
|
if timeout == 0:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue