There are times, mainly on tests servers, that you do not want to automatic start VMs and containers at the last part of boot.
Instead of disable automatic start on every machine, a global solution, was wanted.
Looking at the way PVE starts, got to /etc/rc2.d/S20pve-manager script (link to /etc/init.d/pve-manager) that was the responsible for starting VMs.
The following code inserted on the start section of pve-manager script , makes what I wanted.
It lets you, at the end of boot sequence, to press key s to SKIP starting VMs and containers. If you do not press this key, in 3 seconds boot continues as before, so not interfering with usual boot requirements.
Can this 'feature' or similar be implemented in next releases ?
Note: A better way to detect key s press would be desirable. I only know basics about shell programming.
This way fails if you get a 'stuck key' pressed on the keyboard . It never ends in that case.
Regards
Instead of disable automatic start on every machine, a global solution, was wanted.
Looking at the way PVE starts, got to /etc/rc2.d/S20pve-manager script (link to /etc/init.d/pve-manager) that was the responsible for starting VMs.
The following code inserted on the start section of pve-manager script , makes what I wanted.
It lets you, at the end of boot sequence, to press key s to SKIP starting VMs and containers. If you do not press this key, in 3 seconds boot continues as before, so not interfering with usual boot requirements.
Code:
.............
[FONT=lucida console]case "$1" in
start)
echo "Pres s to skip automatic starting of VMs and containers" ######Start of code inserted
stty -icanon min 0 time 30
read ENTRADA
stty sane
if [ -n "$ENTRADA" ] && [ $ENTRADA = "s" ] ; then
echo "SKIPPING ......"
exit 0
fi #######End of code inserted
echo "Starting VMs and Containers"
pvesh --nooutput create /nodes/localhost/startall
;;[/FONT]
..........
Note: A better way to detect key s press would be desirable. I only know basics about shell programming.
This way fails if you get a 'stuck key' pressed on the keyboard . It never ends in that case.
Regards