Issue 'qm shutdown' from one node to another

Jim Surles

Member
May 29, 2018
6
0
6
51
Hello,

I have a situation where I need to shutdown 3 VMs. They exist across three nodes in a cluster, meaning each VM that I want to shutdown exists on a different node.

For the sake of clarity, I'll give sample names:

Nodes: pve1, pve2, pve3
VMs: vm1 (vmid 101), vm2 (vnid 102), vm3 (vmid 103)

I can log into pve1, and issue the following command without issue:

qm shutdown 101

What I'd like to do is that while logged into pve1, also issue the same for the others:

qm shutdown 102
qm shutdown 103

But those fail with the likes of:

"unable to find configuration file for VM 102 - no such machine"

It looks like you can specify --node with vzdump, but I don't see anything similar with qm. I know that whenever I'm logged into the GUI on pve1, I can shutdown all the machines on all nodes.. so there must be a way to manage them all from the single command line on just one node.

Can someone please point me in the correct direction?
 
You can create a shutdown request using the API, or the 'pvesh' tool:

# pvesh create /nodes/{nodename}/qemu/{vmid}/status/shutdown