[SOLVED] -ish -- Shutdown all nodes via API

RickoT

Member
Jun 30, 2020
12
2
8
45
Greetings!

I am setting up NUT (Network UPS Tools) to shutdown my PVE servers in the event of a power outage. Right now I am using the API to shutdown each node individually, but I would prefer to tell the whole cluster to shut down all nodes all at once so VM's get shut down in the proper order regardless of which node they are on. is that possible? I did not see anything in the API document under cluster regarding this

here is the CURL command I am using for this :
curl -X POST -H 'Authorization: PVEAPIToken=<<TOKENDETAILS>> '\
"https://<<HOST>>/api2/json/nodes/$PVENode/status" --insecure --data "command=shutdown" &> /dev/null

Any help would be appreciated!

Thanks!
 
Hi,

AFAIK this is not possible. You're supposed to run the command for every node, exactly how you are doing it currently.

so VM's get shut down in the proper order regardless of which node they are on
This is unfortunaly not possible - the boot-order is only enforced locally, not cluster-wide. This is documented behavior.
So this wouldn't work anyway as you plan, if I understood you correctly.
 
Thanks for the reply, that's what I thought from reading the documentation, I just wanted to make sure I was understanding correctly and not missing something

Thanks for the confirmation!
 
  • Like
Reactions: cheiss