Skip to content

Commit a3bf6c6

Browse files
committed
Fix taskid for VM creation.
1 parent 2d90460 commit a3bf6c6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

plugins/modules/proxmox_kvm.py

+5
Original file line numberDiff line numberDiff line change
@@ -902,6 +902,7 @@
902902
sample: "VM kropta with vmid = 110 is running"
903903
'''
904904

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

1134+
# FIXME: Workaround for https://forum.proxmox.com/threads/api-bug-pvesh-create-nodes-node-qemu-output-format-json-response-format-broken.111469/.
1135+
if 'errors' in taskid:
1136+
taskid = json.loads(taskid['errors'].splitlines()[-1])
1137+
11331138
if not self.wait_for_task(node, taskid):
11341139
self.module.fail_json(msg='Reached timeout while waiting for creating VM. Last line in task before timeout: %s' %
11351140
proxmox_node.tasks(taskid).log.get()[:1])

0 commit comments

Comments
 (0)