API : is stopall command working ?

Florent

Member
Apr 3, 2012
91
2
8
Hi all,

I am trying to make a script to shutdown a cluster, by shutting down all VM then nodes.

But it seems that "stopall" command on a node does not do anything (no trace in cluster command list).

Is it expected or not ?

All nodes are up-to-date.

Thank you.
 
dietmar, just to be sure, the command stopall cannot be send to one node by another ? I mean, can I connect to node1 and launch the command to node2 ? It seems I can't.... If I login to node1, all commands are send to this node, never to other even if I specify it.

Example if I launch "pvesh create /nodes/test2/startall" from node "test1", it answers that all VM of test2 does not exists and finish.
 
Last edited:
Yes but via API, when I connect to node1, can I do stopall on node2 using POST /nodes/node2/stopall ?
 
Yes but via API, when I connect to node1, can I do stopall on node2 using POST /nodes/node2/stopall ?

Sorry, I just reviewed the API and saw that the 'proxyto' attribute is missing. So it does not automatically forward the call to the correct node, sorry.
Those command are meant to be used by the init scripts, and I guess you should not call them directly.

Why don't you simply use the shutdown command? That command is automatically forwarded to the correct node if you use the API.

Code:
# pvesh help /nodes/lola/status -v
help [path] [--verbose]
cd [path]
ls [path]

USAGE: get /nodes/{node}/status

  Read node status



USAGE: create /nodes/{node}/status -command <string> [OPTIONS]

  Reboot or shutdown a node.

  -command   (reboot | shutdown)

             Specify the command.
 
OK :) For shutdown command : I can't because it's a 3 nodes cluster and I use Ceph, and all VMs MUST be stopped before shutting down any node. Because monitors in Ceph use quorum. If one node stays alone on the network, Ceph will be blocked and VM will not shut down.

In fact, I did a bash script, that call pvesh commands, waits for termination and then halt nodes :)
 

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!