mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 11:51:26 -07:00
Revert "[stable-7] Revert new features to be able to do 7.2.1 release (#7042)"
This reverts commit 7cf834fb3c
.
This commit is contained in:
parent
61314898ca
commit
e6f65634fe
7 changed files with 434 additions and 157 deletions
|
@ -1111,11 +1111,11 @@ class ProxmoxKvmAnsible(ProxmoxAnsible):
|
|||
return False
|
||||
return True
|
||||
|
||||
def restart_vm(self, vm, **status):
|
||||
def restart_vm(self, vm, force, **status):
|
||||
vmid = vm['vmid']
|
||||
try:
|
||||
proxmox_node = self.proxmox_api.nodes(vm['node'])
|
||||
taskid = proxmox_node.qemu(vmid).status.reboot.post()
|
||||
taskid = proxmox_node.qemu(vmid).status.reset.post() if force else proxmox_node.qemu(vmid).status.reboot.post()
|
||||
if not self.wait_for_task(vm['node'], taskid):
|
||||
self.module.fail_json(msg='Reached timeout while waiting for rebooting VM. Last line in task before timeout: %s' %
|
||||
proxmox_node.tasks(taskid).log.get()[:1])
|
||||
|
@ -1493,7 +1493,7 @@ def main():
|
|||
if vm['status'] == 'stopped':
|
||||
module.exit_json(changed=False, vmid=vmid, msg="VM %s is not running" % vmid, **status)
|
||||
|
||||
if proxmox.restart_vm(vm):
|
||||
if proxmox.restart_vm(vm, force=module.params['force']):
|
||||
module.exit_json(changed=True, vmid=vmid, msg="VM %s is restarted" % vmid, **status)
|
||||
|
||||
elif state == 'absent':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue