PVE API: Power/ACPI Actions (Start/Shutdown/Reboot/Stop) PVE Error/OK unclear, GUI vs API, etc.

linux

Member
Dec 14, 2020
96
36
23
Australia
Hi there,

Just comparing the attached realities of what is reflected for an OK action and then a not-OK action, there are a few things I'm curious about:
  1. Rather than just firing and hoping that if the request went through OK, that it is actually OK, we need to know the error/status.
  2. Comparing how the GUI and CLI reflect both an OK and not-OK outcome for an action, it seems some are improperly classed?
  3. Additionally, when using CLI it seems that an OK firing is silent EXCEPT UPID LINE, however when error there is no such prefix?
  4. There appears to be a rogue blank new line sent with one of the potential returns for one of the actions; is it all worth a review?
Therefore, please can you clarify how we should be interacting with PVE API in these regards, and whether the above/attached is all normal?

@fiona - tagging you as this feels like your kind of jam. :)

Thanks,
Linux
 

Attachments

  • Screenshot 2023-12-05 at 4.22.20 pm.png
    Screenshot 2023-12-05 at 4.22.20 pm.png
    125.9 KB · Views: 14
  • Screenshot 2023-12-05 at 4.22.31 pm.png
    Screenshot 2023-12-05 at 4.22.31 pm.png
    254.3 KB · Views: 14
Last edited:
I'm working in PHP, not Bash? Using a class to fire API calls. JSON replies.

Status makes sense and we use this already, but this is about determining whether a call failed to execute properly, even if syntactically OK.

That's where it seems the UPID is returned regardless, but via JSON if we json_encode() to a debug log the return, it just shows the UPID?

What is the expected structure? $pvecall['data']['errors'] or similar? Else we get the regular UPID line only logged.
 
for API calls that return a UPID like the VM start task, you need to check the status of the task later.
Ah hah, though what are your thoughts on my screenshots showing that even the GUI cannot discern some actions' success/error state?

For other API calls you can see if it was successful from the HTTP status code.
Thanks, this is the normal process for us. These power actions seem different, and there are enough discrepancies to query it further!
 
Ah hah, though what are your thoughts on my screenshots showing that even the GUI cannot discern some actions' success/error state?
IIRC, it's not that the GUI can't discern, but the backend doesn't actually fail for stopping an already stopped VM. See: https://bugzilla.proxmox.com/show_bug.cgi?id=3927

Thanks, this is the normal process for us. These power actions seem different, and there are enough discrepancies to query it further!
The power actions spawn a task and return the UPID of the task. You need to query the task itself for those. The relevant endpoint is /nodes/{node}/tasks/{upid}/status
 

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!