您的位置:首页 > 其它

How to auto start XEN VMs after reboot of DOM 0

2011-11-27 16:45 399 查看
This document (3466408) is provided subject to the disclaimer at the end of this document.

Environment

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

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 setupIf 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

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

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 configruation
xm 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 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.

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 configuration
xm new -f

Additional Information

Key words for searchability:
xen
auto
start
autostart
reboot

Document

Document ID:3466408
Creation Date:12-31-2007
Modified Date:12-24-2008
Novell Product:SUSE Linux Enterprise Server

Disclaimer

The Origin of this information may be internal or external to Novell. Novell makes all reasonable efforts to verify this information. However, the information provided in this document is for your information only. Novell makes no explicit or implied claims to the validity of this information.
Any trademarks referenced in this document are the property of their respective owners. Consult your product manuals for complete trademark information.

http://www.novell.com/support/viewContent.do?externalId=3466408&sliceId=1
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: