-
Notifications
You must be signed in to change notification settings - Fork 1
3.6 Groups, ordering and systemd
In your template/vmconfig, GROUP var specify a group, this allow you to manage a group of vms.
You can list all your groups:
VMMgr_Launcher group list all
You can list group member:
VMMgr_Launcher group list mygroup
Start a group:
VMMgr_Launcher group start mygroup
Stop a group:
VMMgr_Launcher group stop mygroup
You can manage a group of vm using systemd, for this, a target unit named with the group is created, and all vm members are placed to /etc/systemd/system/mygroup.target.wants/ in ordre to start all your group using systemd:
to enable (create a target unit and enable each vm) a group:
VMMgr_Launcher enable mygroup
to disable a group:
VMMgr_Launcher disable mygroup
One a group is enabled, target unit is used for start the group except if you use 'order' features, use:
VMMgr_Launcher start mygroup order
Note: ORDER options don't work with systemd units
In order to be able to start a group of vm in a specific order, you can use in your vmconfig de ORDER var:
ORDER=1000
1000 is the default, so all vm without ORDER var, or ORDER=1000 will be started at the same time. If you want a vm start before another, for example a vm with mariadb start before a vm with apache web server, you can set ORDER at a lesser value for the mariadb server than apache server.
In order to manage delay between vm starts, you can set STARTWAIT:
STARTWAIT=30 # wait 30sec before start the next server
Note: all vm with the same ORDER are launched at the same time, only next vm with next ORDER will be delayed.
STARTWAIT=yes
This is a special case, it will use systemctl -H "myvm-hostname" is-system-running to test if VM is fully running before start the next vm. It try max 10 times before stop group start process. You will have to setup sshd server on you VM, and install a ssh key.
Using systemd you can have in your template/vmconfig some var:
BEFORE= # units launched before this one
AFTER= # units launched after this one
CONFLICT= # unit is in conflict with
You can enable/disable each vm without using group with:
VMMgr_Launcher enable myvm
VMMgr_Launcher disable myvm