Add boot order for VMs

On a system with multiple VMs, there might be dependencies between VMs. For example, VM A might provide a service that VM B needs.
In such a case, it would be great to be able to specify that VM A should start before VM B, such that the service is already up when VM B starts.

Of course, for shutdown, the effect should be vice versa: VM B should shut down before VM A, such that VM B still has all needed services from VM A available while it is shutting down.

2 Likes

This could be very useful. For instance some people (like me) virtualize their pfsense router and this would be best to boot first.

You should also look at putting a delay on the VM startup.

btw, you can achieve a similar effect (for startup) with these scripts

You can chain additional invocations with && etc

2 Likes

Yep, Stux is right, can be done via the API, his scripts which are already written are probably easiest. Just set your VMs to NOT start at boot and use a post boot script to turn them on one at a time in whatever order you want. Been doing that for years with my own script.

Heck, mine goes further as some apps are dependent on certain VMs, so, I actually start all my apps in a certain order on Dragonfish too.

2 Likes

Main thing my scripts do is actually wait for ssh to come up, can also use ping etc

Hi Stux,

thank you! I know it can be done with scripts (I have actually written my own…), but still I would love to see this feature in the UI. It is commonly needed in my point of view, and would make the virtualization part of Truenas more professional.

Thank you for the link to your github! That will give me the feature “for free” now to actually check whether a vm is up before booting the next, instead of working with delays.

1 Like

Make a feature request here under feature requests and lobby for votes!

EDIT: I have a real smart post here! :rofl:

well this thread IS the feature request :joy:

2 Likes

…so, add seconds delay before booting to the menu.

How do you handle this for shutdown? There is no possibility to have a script executed right before truenas shuts down or reboots, right?

Yes, so, opposite of startup script. And yes, you can have a shutdown script.

Oh wow, cool. You are right, but somehow I never realized that this option exists…

Where is it at ? Is there a post describing how to go about it ?

Under System Settings / Advanced / Init/Shutdown Scripts. When creating a script, you can select “shutdown” under when:

4 Likes