A way to skip Automatic Starting of VMs and Containers during server boot.

vcp_ai

Active Member
Jul 28, 2010
177
4
38
Valencia -Spain-
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.

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]
..........
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
 

mmenaz

Active Member
Jun 25, 2009
828
20
38
Northern east Italy
Well, usually brand server do a lot of check before starting, and take more than 1 minute just to end autotest (included raid controller firmware check etc) and start booting, so adding 3 seconds seems not that bad to me.
Just usually I test server through ssh, would love to have ALSO a global setting for that, like I would love to have one for disable backup without the need of delete it and re-create.
Best regards
 

Patschi

Member
Jul 23, 2013
51
0
6
26
Austria
pkern.at
I'm with the same mind as dietmar. Who is testing Proxmox on servers - like you - mostly have enough experience with Shell scripting or with using Google, to do it themself. Else there are thousands of Linux/Bash boards in the WorldWideWeb, to ask for help there. Or someone uses the board-search to find this thread :)
 

methil

New Member
Jul 1, 2013
8
0
1
How about a maintenance mode?
put host on maintenance mode disable all automations, cluster availabilities, etc.
 

dlasher

Active Member
Mar 23, 2011
123
11
38
I think this is a great idea, and a 3-second delay is a small price to pay for the feature.. if you don't touch the keyboard, it boots like normal.

Love it.. please include it in the next release of PMX, or perhaps a 'global' checkbox in the GUI to enable/disable this feature.
 

methil

New Member
Jul 1, 2013
8
0
1
I think this is a great idea, and a 3-second delay is a small price to pay for the feature.. if you don't touch the keyboard, it boots like normal.

Love it.. please include it in the next release of PMX, or perhaps a 'global' checkbox in the GUI to enable/disable this feature.

I don't like the boot delay option or the keyboard intervention.
My stuff is in the basement at home for my personal setup and at work we have 2 datacenter and one is remote (15 minutes car ride).
Having to run across the local datacenter or across the city for a maintenance mode is counter productive.

Best way to do this IMO is an option to put the host in maintenance mode until it is told to get back online.
A simple right click on the node of the datacenter tree should do.

That also raise the question of what to do with the running VM on the host you put in maintenance mode.
- Auto failover vm that are HA protected and force shutdown all others vm?
- No go until all vm are either offline (not paused) or migrated to another host?
 

symmcom

Renowned Member
Oct 28, 2012
1,084
36
68
Calgary, Canada
www.symmcom.com
My $0.02.
Proxmox is designed with Production Cluster in mind. Meaning HA enabled and everything setup for maximum uptime. When HA enabled, during server restart i believe the node will migrate all VMs to 2nd node and restart the machine with no VMs to auto restart. When in manual mode, an an administrator will simply migrate all VMs to 2nd node so no server goes offline and then restart the physical node, migrate all VMs back to the node. In a setup environment there really no need of dozens of VMs unless doing a stress test in which case it really does not matter if all the VMs starts or not. Its just matter of few clicks to disable all VMs auto reboot option in the GUI, so the VMs will never restart. For purely test environment this makes sense.
Adding an option to restart all VMs or not during node reboot is a waste of resource in my opinion.
 

Ramalama

Active Member
Dec 26, 2020
356
53
28
33
Super old thread.

But beeing able to enable/disable boot globally, for testing purposes where you reboot often, would be great xD
 

ktdt00

New Member
Nov 9, 2021
9
1
3
60
Maintenance mode or something like it is sorely needed! Thanks to the OP for the workaround!
 

Dunuin

Famous Member
Jun 30, 2020
6,771
1,575
149
Germany
If its just a single node it would be easy to write a script to set/unset the "start at boot" for all guests with a single line.
 

ktdt00

New Member
Nov 9, 2021
9
1
3
60
If its just a single node it would be easy to write a script to set/unset the "start at boot" for all guests with a single line.
You're right of course... But the same could be said for any of a thousand things/features that are well represented in the GUI. It would also be easy to put a button/check-box on the dashboard that ran a built-in function to do the same. Diffrent strokes... :)
 

mmenaz

Active Member
Jun 25, 2009
828
20
38
Northern east Italy
If its just a single node it would be easy to write a script to set/unset the "start at boot" for all guests with a single line.
I've a lot of VM that are "dormient" that have not autorun, or copies of the production one or a lot of other stuff that is NOT set to autorun. So a script to "mass deactivate/activate" all VM at startup is not the case, and that's why I need a "global" switch when I have to just experiment with server setups that requires reboot without having to manually switch off that parameter of 8 VM out of 20 and then remember to do the opposite without missing one.
Also the addiction of a boot process that checks if a specific key (i.e. "n" or "b" or whatever) is pressed and if so skips only for that boot the autorun could be a nice addition when you have to start a server and want to check something (i.e. is some storage working? Network?) before the VM starts.
 
  • Like
Reactions: AndreKW
May 7, 2022
1
0
1
I will cast another vote for this feature! I also have a mixture of VMs and CTs, some of which autostart to support regular production usage and others which are used for testing or experimentation and only started when needed. For server maintenance or hardware replacement/upgrades having a simple way to temporarily bypass autostarts on the next reboot would be very convenient!
 

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 your own in 60 seconds.

Buy now!