SUSE Support

Here When You Need Us

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.

Environment

SUSE Linux Enterprise Server 10 Service Pack 2
SUSE Linux Enterprise Server 10 Service Pack 1
 

Situation

After rebooting the SLES 10 XEN main OS, how can DomU virtual machines be started automatically?

Resolution

general information:
  • 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

kernel setup

If you are booting into the Xen kernel by default, you may skip this section.
  1. 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
  2. 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
    • EXAMPLE:
      # Modified by YaST2. Last modification on Thu May 3 15:51:09 UTC 2007
      default 1
      timeout 8
      gfxmenu (hd0,0)/message

      title SUSE Linux Enterprise Server 10 SP1
      root (hd0,0)
      kernel /vmlinuz-2.6.16.46-0.7-smp root=/dev/disk/by-id/scsi-SATA_SAMSUNG_HD160JJS08HJ1OL323401-part2 vga=0x31a resume=/dev/sda3 splash=silent showopts
      initrd /initrd-2.6.16.46-0.7-smp ###Don't change this comment - YaST2 identifier: Original name: xen###

      title XEN
      root (hd0,0)
      kernel /xen.gz
      module /vmlinuz-2.6.16.46-0.7-xen root=/dev/disk/by-id/scsi-SATA_SAMSUNG_HD160JJS08HJ1OL323401-part2 vga=0x31a resume=/dev/sda3 splash=silent showopts
      module /initrd-2.6.16.46-0.7-xen

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.

initial configuration
  • 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:
link legacy configuration file
  1. Change to the /etc/xen/vm directory
    • cd /etc/xen/vm
  2. 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
  3. 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
  4. 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.

  1. Export the virtual machines configruation
    xm list -l SLES10 > sles10
  2. Backup the file sles10, you may need it in the event that something is corrupted.
  3. Open the file sles10 for editing
  4. Locate the line reading

    (on_xend_start ignore)
  5. Change it to

    (on_xend_start start)
  6. Locate the line reading

    (on_xend_stop ignore)
  7. Change it to

    (on_xend_stop shutdown)
  8. Save the file
  9. Reimport the new configuration
    xm 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.
  1. Shut down the DomU
  2. Locate the installation file, usually found in /etc/xen/vm
  3. Open the installation file for editing
  4. Add the following lines:
    on_xend_start="start"
    on_xend_stop="shutdown"
  5. Save and close the file
  6. Import the new configuration
    xm new -f

Additional Information


Key words for searchability:
xen
auto
start
autostart
reboot
 

Disclaimer

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

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

tick icon

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

tick icon

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.

tick icon

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.