4

I have just upgraded to Ubuntu Server 12.04 and permanently run a Xen guest.

We have migrated to the xl toolstack for Xen (from xm) as suggested which unlike xm does not have support for managed domains. xm is being removed in Xen 4.2 so I need to migrate away.

How should I configure my host to autostart Xen guests?

3 Answers 3

10

There is a best practice in place & it has nothing to do with xl:

Do >nano /etc/default/xendomains then deactivate VM restore using XENDOMAINS_RESTORE=false & save

Then, create the subfolder auto underneath the /xen folder.

mkdir -p /etc/xen/auto

cd /etc/xen/auto

create a symlink to the virtual machine that you want to auto start at Dom0 boot & don't forget the dot at the end of the command

ln -s /etc/xen/yourvm.cfg .

Reboot

I asked to disable the restore feature because i had problems with it.

4

The Short Answer

To load all config files on boot link the auto folder directly to /etc/xen:

ln -s /etc/xen/ /etc/xen/auto

To load only specific config files link each individually:

mkdir -p /etc/xen/auto
ln -s /etc/xen/MY_DOMU_GUEST_1.cfg /etc/xen/auto/
ln -s /etc/xen/MY_DOMU_GUEST_2.cfg /etc/xen/auto/

Explanation

There's a lesser-known xen config file /etc/default/xendomains.

There you can find in the comments documentation for three default settings:

XENDOMAINS_SAVE=/var/lib/xen/save
XENDOMAINS_RESTORE=true
XENDOMAINS_AUTO=/etc/xen/auto

To summarize the docs:

  • XENDOMAINS_SAVE causes the VMs to be saved on a proper reboot.

  • XENDOMAINS_RESTORE causes the VMs to be brought back up from the saved state when saved (whether saved manually with xl save or due to host reboot).

  • XENDOMAINS_AUTO specifies a folder from which to load configs for VMs when no save state exists (i.e. XENDOMAINS_SAVE is disabled or there was a power failure or explicit shutdown instead of a reboot)

If you create the auto folder under /etc/xen and give it symlinks to the config file of the virtual machine (DomU guest) you'd like to start on physical machine (Dom0 host) then generally speaking they'll restore from the saved state that happens during the physical (host) server on reboot, but when that isn't available (such as after a shutdown or power failure or crash), they'll still load anyway.

If you'd rather always have the VMs shutdown on reboot rather than save state you can set XENDOMAINS_SAVE= and XENDOMAINS_RESTORE=false.

The Old Way

It used to be that where there is now on_shutdown, on_reboot, and on_crash that you could also configure on_xend_start = 'start' and on_xend_stop = 'shutdown'... but those are not the current practice.

Current (apply to the VM state itself):

on_shutdown = 'destroy'
on_reboot = 'restart'
on_crash = 'restart'

Ignored / Deprecated (apply to the host state):

on_xend_start = 'start'
on_xend_stop = 'shutdown'
0

www.gossamer-threads.com/lists/xen/users/259014 suggests to me that Xen 4.1 with xl is unfortunately not a great combination.

The "fix" is to go back to xm until Xen 4.2 is packed in Ubuntu, at which point xendomains won't depend on xend, so you can start guests at boot and use xl.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .