Shutdown Policy: Per VM to Overwrite Default?

MRosu

Renowned Member
Mar 27, 2016
29
3
68
38
Is it possible to have a per-VM shutdown policy that can overwrite the default one?

I want most VMs to migrate, but there are some VMs that are already highly available within the software and I would prefer they shut down along with the node.

I wasn't able to find this option anywhere, but I wanted to double check here to make sure I didn't miss anything.
 
I also would very much like to see the ability to set the cluster shutdown_policy to 'migrate' and certain VM's to 'shutdown' or 'conditional'.

Or just add an extra migrate/conditional policy that doesn't halt the node shutdown/reboot until the vm without a migration target/resolution is manually resolved. Just freeze/shutdown those vm's and get the reboot done. On shutdown I would still halt the process, because most likely the node will be down longer and admin might want to move to another node in cluster (should have been done before the shut, but still)...

That way you kan have 'restricted' vm's or those on local-lvm shutdown/freeze and those on ceph or drbd-lvm migrate away...

Update: I noticed that setting the ha state to 'ignored' almost does what I want; it only does not restart the vm if you shut it down from within the vm. So for now we'll do this:
Code:
...
    pvesh create /cluster/ha/resources --sid $id --group node-$node-restricted
    sleep 3
    pvesh set /cluster/ha/resources/$id --state ignored
...
Note: the sleep is necessary to give the cluster time to handle the start and the migrate of the vm to the designated node; we are creating all vm's on the first node and have the ha group handle the migration to it's preferred location:
Code:
pvesh get /cluster/ha/groups --output-format json | jq -r ".[]"
...
{
  "digest": ...,
  "group": "node-b-restricted",
  "nodes": "hvc-01-b:100",
  "restricted": 1,
  "type": "group"
}
{
  "digest": ...,
  "group": "node-a-restricted",
  "nodes": "hvc-01-a:100",
  "restricted": 1,
  "type": "group"
}
...
 
Last edited:
Is it possible to have a per-VM shutdown policy that can overwrite the default one?

I want most VMs to migrate, but there are some VMs that are already highly available within the software and I would prefer they shut down along with the node.

I wasn't able to find this option anywhere, but I wanted to double check here to make sure I didn't miss anything.
Then remove the VMs from the HA, as they have their redundancy in the application.
All VMs for which no HA is activated are shut down.
This is how I use it in my cluster.
 

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!