Automatic node evacuation

Alessandro 123

Well-Known Member
May 22, 2016
653
24
58
41
Let's assume a cluster with shared storage
If i have to reboot a node, PVE automatically migrate all running VMs when issuing the reboot/shutdown command, like xenserver does, or i have to wait the timeout from cluster manager?
 
i know that option, but having the automatic evacuation is nice, so that in case of shutdown or reboot you don't have to wait 60s
It should be trivial to implement, as reboot/poweroff script via systemd

As proof of concept, with a one-liner taken from https://forum.proxmox.com/threads/bulk-migrate-via-command-line.25775/:

Code:
[Unit]
Description=Evacuate node on shutdown/reboot

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/true
ExecStop=/bin/sh -c 'for vm in $(qm list | awk "{print $1}" | grep -Eo "[0-9]{1,3}"); do qm migrate $vm node2 --online; done'

[Install]
WantedBy=multi-user.target