XAPI (Xen Project Management API)

Developer(s) Linux Foundation {{#property:P1324}} active OCaml Management stack GNU GPL Repository on Github

What is XAPI?

XAPI is one of the toolstacks which brings cloud-like functions to Xen Project. The hypervisor used with the XAPI toolstack consolidates server workloads, enables savings in power, cooling, and management costs and thus contributing to environmentally sustainable computing, an increased ability to adapt to ever-changing IT environments, an optimized use of existing hardware, and an improved level of IT reliability. The XAPI toolstack is written entirely in OCaml

XenServer project, which is an Open Source distribution of Xen Project software uses XAPI as the default toolstack. The XenServer project is guided by Citrix Systems, but XAPI itself is part of the Linux Foundation.[1][2]

Choice of toolstack

Xen Project software may be used with different toolstacks. On the figure below you can see the choices of toolstacks you have.

Boxes marked in blue are developed by the Xen Project

All of this toolstacks have different trade-offs and are optimized for different use-cases. However in general, the more on the right of the picture you are, the more functionality will be on offer.

Xen Project uses XL as the default toolstack. First pairing of the Xen Project hypervisor and XAPI became known as XCP. Later, XCP had been abandoned and superceded by open source XenServer, which also uses XAPI as the default toolstack. Before the introduction of libxenlight, there was a complicated and inefficient toolstack situation. The issue was that xend, xapi, libvirt, etc. all needed to manage many common low-level operations, which led to code duplication, inefficiences, bugs, and wasted effort (e.g fixing the same bug in all of the toolstacks).

Libxenlight

Libxenlight is a small lower-level library, written in C. It is simple to understand; and easy to modify, and extend. Libxl is (or will be) shared by all Xen Project toolstacks. It was created to provide a simple and robust API for all the toolstacks to use (instead all of the toolstacks each implementing this common functionality). It was also created to be a common codebase to do Xen operations.

Default / XL

XL is a lightweight command line toolstack built using libxenlight. It was designed to be backwards compatible with the xm CLI for xend. It provides a straightforward command line interface to Xen's facilities for guest creation and management. Features:

• PV and HVM guests
• Basic guest lifecycle operations: create, shutdown, reboot, pause, unpause, list, rename etc
• Guest device support
• CPU pools, including cpupool-per-NUMA node
• Control of CPU scheduler parameters
• Live migration and save/restore of guests

XAPI / XE

The Xen Project management API is the default toolstack for XenServer. It is also used in some installations of CloudStack. It has Free Software licence. If you want to learn more about it, read this article carefully.

Libvirt / VIRSH

Libvirt is a virtualization API/toolkit used to manage various virtualization technologies. Originally designed to interface with xm, there is a libxenlight port of libvirt. Libvirt is commonly used by installations which need to support both Xen Project and KVM hypervisors. It is also used by companies like Oracle and SUSE in their OpenStack-based cloud offerings.

Default / XEND

It is the previous toolstack and continues to be included as part of the Xen source releases. However as of Xen 4.1 XEND is now deprecated and will likely be removed in a future release. It is recommended that new deployments use one of the other toolstacks discussed above.

XAPI features

Compared to other Xen Project toolstacks, XAPI offers additional functionality, such as:

• Enabling event tracking, with progress and notification
• Usage of the "pool" conseption: same servers are united into the system of indistinguishable computing resources. Exchange of the servers inside the pool doesn't need special effort.
• Extended and considered software for controlling pool of multiple hosts.
• All the servers inside the pool are configurated through the general pool configuration.
• Special version of XenStored with improved stability and performance, fully written on OCaml
• Number of built-in templates for the most of guest operating systems.
• Built-in support.
• Resource pools are able to include live migration, auto configuration, and disaster recovery
• VM lifecycle is enhanced by including live snapshots, VM checkpointing, and VM migration.
• Common administration method for PV and HVM machines.
• Integrations with cloud orchestration stacks.
• Facilitating real-time performance monitoring and alerting
• Usage of Open vSwitch as the main backend for network connections, which allows to create pure-virtual networks with arbitrary architecture.

XAPI installation

The easiest way to start using Xen with XAPI is to get a clean machine and install CentOS-based XCP distribution on it. In the case you wish to turn an existing Ubuntu or Debian machine into an XCP host, you should take a look at the Project Kronos.

Please note that it is a work-in-progress and can not work properly sometimes. Before starting, make sure you've read the full guide and you know what you are doing, otherwise your system may be broken.[3]

Main steps of the process:

• Installing OS

Install Debian Squeeze. Convert to Unstable: Edit /etc/apt/sources.list and replace 'squeeze' with 'wheezy'

sed -i 's/squeeze/wheezy/g' /etc/apt/sources.list
apt-get update
apt-get dist-upgrade
• Installing firmware
• Setting up repositories

This part isn't needed anymore in Debian, as XCP is now in SID.

• Fixing some known bugs (Ubuntu)
• Installing XAPI via apt-get

This step installs XCP's xapi and all its dependencies, including the Xen hypervisor.

apt-get install pciutils
apt-get update
apt-get install xcp-xapi
apt-get install xcp-xe
• Fixing some conflicts
• Post-install setup
• Setup the network/interfaces file
• Setup the xensource-inventory file
• 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

If you want to learn about installation process in details, it is described on Xen Project wiki

XAPI usage

XAPI can be used via the command line interface by "xe" command. It can be used both from domain zero and from remote hosts and talks to both hosts and Resource Pools over https. The syntax is really simple.

Command syntax from the domain zero:

# xe <command-name> <argument=value>

Command syntax from the remote host:

# xe -s <host> -u <username> -pw <password> <command-name> <argument=value>

Note that values containing spaces should be enclosed with double-quotes.

Here is the list of commands:

• List CD/ISO:
# xe cd-list
• Power on VM:
# xe vm-start vm=<target VM name>
• Mount an ISO:
# xe vm-cd-insert cd-name=<name of ISO or CD> vm=<target VM name>
• Show list of VMs on host:
# xe vm-list
• List SRs:
# xe sr-list
• Delete/Destroy VM on host:
# xe vm-destroy uuid=<UUID of target VM>
• Create Storage Repository:
# xe sr-create name-label=<name> physical-size=<size> type=<type> content-type=<content_type> device-config:<config_name>=<value> [host-uuid=<Xen Cloud Platform host UUID>] [shared=<true | false>]
• Destroy Storage Repository:
# xe sr-destroy uuid=<sr_uuid>

Authors

Roman Chistiakov, Bauman Moscow State Technical University, IU-8, E-mail: romchezz@gmail.com

Literature

1. Wikipedia [Internet]: Xen project — material from Wikipedia — free encyclopedia: Version 16442, saved at 11:05 UTC 1 March 2016. / Authors of Wikipedia // Wikipedia, free encyclopedia. — Electronic data — San Francisco: Wikimedia Foundation, 2016. — Available from: https://wiki.xen.org/wiki/Main_Page
2. Github [Internet]: Project XAPI / Date of the application : 11 December 2016 — Available from: https://github.com/xapi-project/xen-api
3. Wikipedia [Internet]: Programmer's guide — material from Wikipedia — free encyclopedia: Version 9460, saved at 12:31 UTC 11 July 2013. / Authors of Wikipedia // Wikipedia, free encyclopedia. — Electronic data — San Francisco: Wikimedia Foundation, 2016. — Available from: https://wiki.xen.org/wiki/XAPI_Developer_Guide