VM creation with API interface got timeout

kaltsi

Active Member
Mar 22, 2013
71
11
28
http://goo.gl/maps/d9tFg
My application creates VMs step by step, But usually some VM creation gets error.
trying to acquire lock...
TASK ERROR: unable to create VM 105 - can't lock file '/var/lock/pve-manager/pve-storage-local' - got timeout
It is a very simple configuration. There is only one directory storage with ext4 filesystem.
The application sends the creation request and picks up the taskID. After that it waits for the end of the task.
And after this it sneds the next one.
I didn't find API request for analyse the locks.
How can I check the locks?
 
Hi,
My application creates VMs step by step, But usually some VM creation gets error.
trying to acquire lock...
TASK ERROR: unable to create VM 105 - can't lock file '/var/lock/pve-manager/pve-storage-local' - got timeout
It is a very simple configuration. There is only one directory storage with ext4 filesystem.
The application sends the creation request and picks up the taskID. After that it waits for the end of the task.
Probably it's multiple calls trying to access/lock the storage at the same time. How exactly do you wait for the end of the task? For long(er)-running tasks that involve disk operations, Proxmox VE will spawn workers and return the UPID of the worker as an API result. But the fact that the API call returned doesn't mean that the worker is finished. You'll need to check the worker task to see if it's finished, e.g.
Code:
/nodes/pve701/tasks/UPID:pve701:00000987:000005F6:614DC8C8:startall::root@pam:/status

And after this it sneds the next one.
I didn't find API request for analyse the locks.
How can I check the locks?
 
Sometimes the application may send the request in parallel.
Does it mean the worker can handle only one task in the same time on the same storage?

The template creation doesn't send back UPID. Could you please offer workaround?
 
Sometimes the application may send the request in parallel.
This can lead to the problems you are experiencing. For certain things, you need to wait until the worker is finished.
Does it mean the worker can handle only one task in the same time on the same storage?
Yes, if it takes longer than the next task waits for the lock (about 1-2 minutes IIRC).
The template creation doesn't send back UPID. Could you please offer workaround?
Unfortunately that's a bug/missing feature, but we are working on adding it. A workaround might be trying to get the UPID from the result of either
Code:
/nodes/<nodename>/tasks
/cluster/tasks
by searching for qmtemplate and the VM/container ID.
 
Thanks
The /nodes/<nodename>/tasks with filters is better for me.
Will the limit=1 (with vmid= and typefilter=qmtemplate ) send back only the last one task, or one of the tasks?
 
Thanks
The /nodes/<nodename>/tasks with filters is better for me.
Will the limit=1 (with vmid= and typefilter=qmtemplate ) send back only the last one task, or one of the tasks?
It should only return the last task, but I forgot to mention that you also need to specify source=all (or source=active), otherwise it will only show already finished tasks.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!