How to get the status of Proxmox API?

kotakomputer

Renowned Member
May 14, 2012
464
17
83
Jakarta, Indonesia
www.komputerindo.com
I run this PHP code for $vmid = 101
Code:
$result = $pve2->post("/nodes/$svr_hostname/$svr_virt/$vmid/status/start");
The result is:
Code:
UPID:dsi-094117:000471B3:058A929A:5207DFD9:qmstart:101:root@pam:

I need to get the same result provided by Proxmox Web UI:
- When VMID 101 is not started then Proxmox Web UI says: OK
- When VMID 101 was already started then Proxmox Web UI says: ERROR: VM 101 already running

Any idea? Or should I check the node status before perform $pve2->post ?
What does the "000471B3:058A929A:5207DFD9" mean?
 
What does the "000471B3:058A929A:5207DFD9" mean?

Some commands can take a long time to finish, so the are started as background task. The
returned string 'UPID:dsi-094117:000471B3:058A929A:5207DFD9:qmstart:101:root@pam:'
is an unique identifier for that task, and can be used to query further info.

# pvesh get nodes/<NODE>/tasks/<UPID>/status
# pvesh get nodes/<NODE>/tasks/<UPID>/log