Control Start Order of XEN Virtual Machines
This document is draft. Please share suggestions with EdHeron.
When creating virtual machines (VM), it can sometimes occur that some VMs require other VMs to be started already. For example, a machine that provides NFS file space needs to be running before a machine tries to use it. A method of encouraging a specific start order is desired.
To flag a VM to be started during Virtual Machine Server boot, a link must be placed in /etc/xen/auto/. Normally, this is done from /etc/xen/auto/ with a simple ln -s ../<VM-name> . While this is sufficient for many, it doesn't encourage any specific start order.
The new name for the link isn't required to be the same as the file it links to. We can use any name for the link that we prefer.
The startup script starts VMs in the order it finds them. We can control this order by changing the link name.
The VM name as listed by xm list is controlled by the settings inside the configuration file.
When creating the link in /etc/xen/auto/, add a numeric to the link name. The standard suggestions apply when naming numerically; Leave space for expansion or be prepared to rename some or all files in order to insert new entries. One technique is to use a separation character, like dash or underscore.
For example, we might desire that a VM named adm-srvr gets started before a VM named adm-ed. Under normal circumstances, adm-ed would be started first. If we create the links with a number and a dash to indicate order, like ln -s ../adm-srvr 1-adm-srvr and ln -s ../adm-ed 2-adm-ed, then the start order should become adm-srvr then adm-ed.
To add a VM later between them, we could use 1a (since letters fall after dash and underscore) like, ln -s ../someVM 1a-someVM.
Another common method is to use larger numbers than is currently needed and then to space the ordering to leave spots available for future use. Using this method we'd use ln -s ../adm-srvr 10-adm-srvr and ln -s ../adm-ed 20-adm-ed. To put a future VM between them, we'd use ln -s ../someVM 15-somevM.
This is standard method of controlling order that we've encountered many other places.
Document created by EdHeron.