XAPI toolstack on a Debian-based distribution: Difference between revisions
Line 147: | Line 147: | ||
<pre> |
<pre> |
||
sed -i -e 's/xend_start$/#xend_start/' -e 's/xend_stop$/#xend_stop/' /etc/init.d/xend |
sed -i -e 's/xend_start$/#xend_start/' -e 's/xend_stop$/#xend_stop/' /etc/init.d/xend |
||
update-rc.d xendomains disable |
|||
</pre> |
</pre> |
||
Revision as of 23:59, 6 February 2012
This is part of Project Kronos. Follow these instructions to get XCP toolstack (including xapi, the XenAPI server daemon) installed on an Ubuntu Oneiric or Debian Squeeze box, using the upstream Linux kernel. This will effectively allow you to turn an existing Ubuntu or Debian machine into an XCP host. Note that this is *very much* a work-in-progress. Some features will be broken, and there will be a bit of manual configuration required. We appreciate any testing you do for this project, but please don't consider this production ready yet! Please visit the Kronos Supported Features page for a list of XCP features that are known to work on Kronos. The debian packages can be compiled from source following the instructions linked from the Project Kronos page.
What's the best environment?
The best environment is a clean installed modern system with significant amounts of RAM and several cores. However, this guide is written in the knowledge that not everyone will be in the lucky position of having such a box to play with. In fact, many of us will be installing it on a moderately-sized box with an existing (upgraded) version of Ubuntu or Debian running. One of the authors of this guide (MikeCamel) is in exactly that position, so you are not alone. Hopefully this guide will be relevant to you, and will provide working instructions. If you have a problem, let us know.
A note about kernels Kronos is really aimed at distributions (such as Ubuntu Precise Pangolin) which use the 3.2 kernel. There is a nasty bug in the 3.0 series (and probably before) which means that, between them, a couple of the components of Xen are going to reduce the size of Dom0 (and therefore your main operating environment) to something under 1 GiB, which may cause you significant problems. There are work-arounds, but this is a real issue if you're planning to run the XCP toolstack on Oneiric, for instance. There is a work-around available.
Prepare your system
Action | Debian Squeeze | Ubuntu Oneiric or Precise |
---|---|---|
Install OS | Install Debian Squeeze.
Convert to Unstable:
perl -pi -e 's/squeeze/unstable/g' /etc/apt/sources.list apt-get update apt-get dist-upgrade |
Install Ubuntu Oneiric or Precise.
Kronos will work with either Ubuntu Precise Server or Desktop, with the default kernel. If you want to use local storage, you will have to reserve an unformatted partition on your hard disk for xapi. In a later step, you will use this partition to create a local storage repository. Note that the xcp-xapi packages are in Precise, but may have dependency errors. To use these, omit the "Set up repositories" step for Precise. |
Install any required firmware | Install firmware (only if necessary - http://wiki.debian.org/Firmware) | |
Set up repositories | Add the following to /etc/apt/sources.list
deb http://ftp.uk.debian.org/debian/ experimental main deb-src http://ftp.uk.debian.org/debian/ experimental main deb http://downloads.xen.org/XCP/debian/repo/apt/debian unstable main deb-src http://downloads.xen.org/XCP/debian/repo/apt/debian unstable main Add the XCP key to your apt keyring: wget http://downloads.xen.org/XCP/debian/xcp.gpg.key apt-key add xcp.gpg.key |
For Oneiric: add the following to /etc/apt/sources.list
deb http://ppa.launchpad.net/ubuntu-xen-org/xcp-unstable/ubuntu oneiric main deb-src http://ppa.launchpad.net/ubuntu-xen-org/xcp-unstable/ubuntu oneiric main run this (with sudo): apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 9273A937 or For Precise: add the following to /etc/apt/sources.list deb http://ppa.launchpad.net/ubuntu-xen-org/xcp-unstable/ubuntu precise main deb-src http://ppa.launchpad.net/ubuntu-xen-org/xcp-unstable/ubuntu precise main run this (with sudo): apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 9273A937
apt-get install python-software-properties add-apt-repository ppa:ubuntu-xen-org/xcp-unstable |
Work around Open vSwitch bug
If you are installing onto a fresh Oneiric system, then you will hit https://bugs.launchpad.net/ubuntu/+source/openvswitch/+bug/894754. This is fixed in Precise. To work around this:
apt-get update apt-get install openvswitch-datapath-dkms
Workaround xcp-networkd missing file
Before installing xapi run the following commands to work around a missing file in the packages:
mkdir /etc/xen echo "bridge" >> /etc/xcp/network.conf
This will be addressed properly in a future release
Install xapi
This step installs XCP's xapi and all its dependencies, including the Xen hypervisor.
apt-get update apt-get install xcp-xapi apt-get install xcp-xe
Once you've installed these packages, you can just do an `apt-get update && apt-get upgrade` to keep up with the latest builds.
Workaround VM's not going to power-state: halted after shutdown
In the current version of the packages, there is a bug that will prevent a VM from going to a halted power-state when you shut them down. This is caused by the VIF's not being properly torn down after the shutdown. This will be addressed in a future release. You can address this issue by editing the file at /usr/lib/xcp/scripts/vif. Go to the very end of the file and find the block of code below (around line 258):
remove) if [ "${TYPE}" = "vif" ] ;then call_hook_script $DOMID "${ACTION}" # Unclear whether this is necessary, since netback also does it: logger -t script-vif "${dev}: removing ${HOTPLUG_STATUS}" xenstore-rm "${HOTPLUG_STATUS}"
and change the case from remove) to remove|offline) so that it looks like this:
remove|offline) if [ "${TYPE}" = "vif" ] ;then call_hook_script $DOMID "${ACTION}" # Unclear whether this is necessary, since netback also does it: logger -t script-vif "${dev}: removing ${HOTPLUG_STATUS}" xenstore-rm "${HOTPLUG_STATUS}"
Workaround XAPI conflicts with XEND
You will need to disable xend from starting in order to get xcp-xapi to start. This is done by modifying the file at /etc/init.d/xend. Many of the setup processes in this script still need to run, but xend itself should not start. This will be resolved in a future release. The command to resolve this is:
sed -i -e 's/xend_start$/#xend_start/' -e 's/xend_stop$/#xend_stop/' /etc/init.d/xend update-rc.d xendomains disable
Post-install setup
Optional: Make xen the default grub entry.
sed -i 's/GRUB_DEFAULT=.\+/GRUB_DEFAULT="Xen 4.1-amd64"/' /etc/default/grub update-grub
Note: given the default set up for Ubuntu's grub (in /etc/default/grub), you don't get to see the splashscreen with kernel boot options. If you do want to see the list of options, you may need to change some of the settings in this file.
Setup the network/interfaces file
This is likely to be /etc/network/interfaces - ensure that you don't remove any existing settings. Note that if you are running a DHCP server on this machine, then you may need to change the xenbr0 interface to a static or manual IP address, as DHCP may not come up in time to provide an address otherwise.
auto lo xenbr0 iface xenbr0 inet dhcp bridge_ports eth0
Setup the xensource-inventory file
Note: this assumes that the root partition is on /dev/sda1 - change if required. Note: this assumes that your management interface will be xenbr0 - change if required.
control_domain=`uuidgen` installation=`uuidgen` cat > /etc/xcp/xensource-inventory << EOF CURRENT_INTERFACES='xenbr0' BUILD_NUMBER='0' CONTROL_DOMAIN_UUID='${control_domain}' INSTALLATION_UUID='${installation}' MANAGEMENT_INTERFACE='xenbr0' PRIMARY_DISK='/dev/sda1' EOF
Set the Xen toolstack
You will need to set a TOOLSTACK variable to get xcp-xapi to start, you can do that with the following:
echo 'TOOLSTACK="xapi"' >> /etc/default/xen