Skip to content

Commit

Permalink
Fix taskid for VM creation.
Browse files Browse the repository at this point in the history
  • Loading branch information
reitermarkus committed Sep 28, 2024
1 parent 2d90460 commit a3bf6c6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions plugins/modules/proxmox_kvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,7 @@
sample: "VM kropta with vmid = 110 is running"
'''

import json
import re
import time
from ansible.module_utils.six.moves.urllib.parse import quote
Expand Down Expand Up @@ -1130,6 +1131,10 @@ def create_vm(self, vmid, newid, node, name, memory, cpu, cores, sockets, update
else:
taskid = proxmox_node.qemu.create(vmid=vmid, name=name, memory=memory, cpu=cpu, cores=cores, sockets=sockets, **kwargs)

# FIXME: Workaround for https://forum.proxmox.com/threads/api-bug-pvesh-create-nodes-node-qemu-output-format-json-response-format-broken.111469/.
if 'errors' in taskid:
taskid = json.loads(taskid['errors'].splitlines()[-1])

if not self.wait_for_task(node, taskid):
self.module.fail_json(msg='Reached timeout while waiting for creating VM. Last line in task before timeout: %s' %
proxmox_node.tasks(taskid).log.get()[:1])
Expand Down

0 comments on commit a3bf6c6

Please sign in to comment.