How to auto start XEN VMs after reboot of DOM 0
This document (3466408) is provided subject to the disclaimer at the end of this document.
SUSE Linux Enterprise Server 10 Service Pack 1
- Any DomU that has been "saved" using the xm save command will automatically be started at boot time when the xendomains service is on and requires no extra configuration.
- The method described in this TID are not recommended DomU's that is started as part of a high availability cluster or are managed by other programs such as ZenWorks Orchistrator
- Any DomU that was running before a graceful reboot, will start automatically and requires no extra configuration.
- Method 1 is for unmanaged domains or domains that use legacy /etc/xen/vm files
- Method 2 is the preferred method and is the most robust
- Method 3 uses the legacy /etc/xen/vm files and is not recommended unless ALL configuration changes are made using the legacy fil
If you are booting into the Xen kernel by default, you may skip this section.
- Make sure that the appropriate kernel is running.
- uname -r(The correct kernel should look something similar to 2.6.16-0.7- xen)
- If the version shown does not include"xen" go to step 2; otherwise go to step 3
- Edit the /boot/grub/menu.lst to boot off of the correct kernel (the XEN kernel)
- Change the "default #" line (where # represents a number starting with zero or higher) to point to the correct stanza representing the xen kernel
# Modified by YaST2. Last modification on Thu May 3 15:51:09 UTC 2007
title SUSE Linux Enterprise Server 10 SP1
kernel /vmlinuz-184.108.40.206-0.7-smp root=/dev/disk/by-id/scsi-SATA_SAMSUNG_HD160JJS08HJ1OL323401-part2 vga=0x31a resume=/dev/sda3 splash=silent showopts
initrd /initrd-220.127.116.11-0.7-smp ###Don't change this comment - YaST2 identifier: Original name: xen###
module /vmlinuz-18.104.22.168-0.7-xen root=/dev/disk/by-id/scsi-SATA_SAMSUNG_HD160JJS08HJ1OL323401-part2 vga=0x31a resume=/dev/sda3 splash=silent showopts
method 1: auto start DomU using legacy configuration files
The xendomains init script will over write any configuration changes made by the"xm”, YaST or "virt-manager”. This method is not the preferred method, as it creates an unmanaged domain (that is, the domain is not managed with xend). The init script uses the xm create command to create the domain as a brand-new configuration. Method 2 and Method create a managed domain, which is preferred.
- chkconfig --list | grep -i xen (xend and xendomains should be on)
- If the services are not turned to "on" for runlevels 3 and 5 then type:
- chkconfig xend on; chkconfig xendomains on
- Make sure the service is currenly running by typing:
- rcxend status; rcxendomains status
- If the services are not running, they can be turned on by the following:
- Change to the /etc/xen/vm directory
- cd /etc/xen/vm
- This directory will contain multiple files. For instance, if two virtual machines were installed with the names of vm1 and vm2, then the following files would be in the directory:
- v m1, vm1.xml, vm2, vm2.xml
- For the virtual machines that are to be auto-started after system reboot of Dom 0 (the main OS, or the host OS), create a soft link to the non-xml files to the /etc/xen/auto directory. Under SLES 10 SP2 the /etc/xen/auto directory does not exist. In order to use this method, you will need to create the directory (mkdir -p /etc/xen/auto)
- cd /etc/xen/auto/
- l n -s /etc/xen/vm/vm1 vm1
- In the case above (because only vm1 was copied, and not vm2), only vm1 will auto start after a system reboot of Dom 0.
method 2: use xend to auto-start DomU's using the information taken from xend (managed domains)
This method uses the "xm” commands and is the only safe method to auto-start a DomU when the "xm”, YaST or"virt-manager” has been used to alter the guest configuration after the initial installation of the virtual machine. Since the the management database will be used to start the DomU, the "xendomains" init script can be safely turned off.
Replace SLES10 in the steps with the name of the virtual machine that you are configuring to start automatically.
Export the virtual machines configruationxm list -l SLES10 > sles10
- Backup the file sles10, you may need it in the event that something is corrupted.
- Open the file sles10 for editing
Locate the line reading(on_xend_start ignore)
Change it to(on_xend_start start)
Locate the line reading(on_xend_stop ignore)
Change it to(on_xend_stop shutdown)
- Save the file
Reimport the new configurationxm new -F sles10
method 3: use legacy configuation file and import it into the xen management database
This method involves changing the installation file used to create the DomU. This method is NOT recommended when "xm”, "YaST” or "virt-manager” has not been used to modify the DomU. This method is only recommended when DomU configuration changes have only been made through the installation file. Since the the management database will be used to start the DomU, the "xendomains" init script can be safely turned off.
- Shut down the DomU
- Locate the installation file, usually found in /etc/xen/vm
- Open the installation file for editing
Add the following lines:on_xend_start="start"on_xend_stop="shutdown"
Save and close the file
Import the new configurationxm new -f
Key words for searchability:
This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.
- Document ID:3466408
- Creation Date: 31-Dec-2007
- Modified Date:19-Mar-2021
- SUSE Linux Enterprise Server
For questions or concerns with the SUSE Knowledgebase please contact: firstname.lastname@example.org