Liberty -  Liberty -  Liberty -  Liberty -  Liberty -  Liberty -  Liberty -  Liberty - 

 Xen via Libvirt

OpenStack Compute supports the Xen Project Hypervisor (or Xen). Xen can be integrated with OpenStack Compute via the libvirt toolstack or via the XAPI toolstack. This section describes how to set up OpenStack Compute with Xen and libvirt. For information on how to set up Xen with XAPI refer to the section called “XenServer (and other XAPI based Xen variants)”.

 Installing Xen with Libvirt

At this stage we recommend to use the baseline that we use for the Xen Project OpenStack CI Loop, which contains the most recent stability fixes to both Xen and Libvirt.

Xen 4.5.1 (or newer) and Libvirt 1.2.15 (or newer) contain the most recent OpenStack improvements for Xen. The necessary Xen changes have also been backported to the Xen 4.4.3 stable branch (not yet released at this stage). Please check with the Linux and FreeBSD distros you are intending to use as Dom 0, whether the relevant version of Xen and Libvirt are available as installable packages.

The latest releases of Xen and libvirt packages that fulfil the above minimum requirements for the various openSUSE distributions can always be found and installed from the Open Build Service Virtualization project. To install these latest packages, add the Virtualization repository to your software management stack and get the newest packages from there. More information about the latest Xen and Libvirt packages are available here and here.

Alternatively, it is possible to use the Ubuntu LTS 14.04 Xen Package 4.4.1-0ubuntu0.14.04.4 (Xen 4.4.1) and apply the patches outlined here. You can also use the Ubuntu LTS 14.04 libvirt package 1.2.2 libvirt_1.2.2-0ubuntu13.1.7 as baseline and update it to libvirt version 1.2.15, or 1.2.14 with the patches outlined here applied. Note that this will require re-build these packages partly from source.

For further information and latest developments, you may want to consult the Xen Project's mailing lists for OpenStack related issues and questions.

 Configuring Xen with Libvirt

To enable Xen via libvirt, ensure the following options are set in /etc/nova/nova.conf on all hosts running the nova-compute service.

compute_driver = libvirt.LibvirtDriver

virt_type = xen

 Additional configuration options

Use the following as a guideline for configuring Xen for use in OpenStack:

  1. Dom0 Memory: Set it between 1GB and 4GB by adding the following parameter to the Xen Boot Options in the grub.conf file.



    Note that the above memory limits are suggestions and should be based on the available compute host resources. For large hosts, that will run many hundred of instances,the chosen values may need to be higher.


    The location of the grub.conf file depends on the host Linux distribution that you are using. Please refer to the distro documentation for more details (see Dom 0 for more resources).

  2. Dom0 vcpus: Set the virtual CPUs to 4 and employ CPU pinning by adding the following parameters to the Xen Boot Options in the grub.conf file.

    dom0_max_vcpus=4 dom0_vcpus_pin


    Note that the above virtual CPU limits are suggestions and should be based on the available compute host resources. For large hosts, that will run many hundred of instances, the suggested values may need to be higher.

  3. PV vs HVM guests: A Xen virtual machine can be paravirtualized (PV) or hardware virtualized (HVM). The virtualization mode determines the interaction between Xen, Dom 0, and the guest VM's kernel. PV guests are aware of the fact that they are virtualized and will co-operate with Xen and Dom 0. The choice of virtualization mode determines performance characteristics. For an overview of Xen virtualization modes, see Xen Guest Types.

    In OpenStack, customer VMs may run in either PV or HVM mode. The mode is a property of the operating system image used by the VM, and is changed by adjusting the image metadata stored in the glance image service. The image metadata can be changed using the nova or glance commands.

    To choose one of the HVM modes (HVM, HVM with PV Drivers or PVHVM) use nova or glance to set the vm_mode property to hvm

    To choose one of the HVM modes (HVM, HVM with PV Drivers or PVHVM) use one of the following two commands

    $ nova image-meta img-uuid set vm_mode=hvm

    $ glance image-update img-uuid --property vm_mode=hvm

    To chose PV mode, which is supported by NetBSD, FreeBSD and Linux, useone of the following two commands

    $ nova image-meta img-uuid set vm_mode=xen

    $ glance image-update img-uuid --property vm_mode=xen


    The default for virtualization mode in nova is PV mode.

  4. Image Formats: Xen supports raw, qcow2 and vhd image formats. For more information on image formats, refer to the OpenStack Virtual Image Guide and the Storage Options Guide on the Xen Project Wiki.

  5. Image Metadata: In addition to the vm_mode property discussed above, the hypervisor_type property is another important component of the image metadata, especially if your cloud contains mixed hypervisor compute nodes. Setting the hypervisor_type property allows the nova scheduler to select a compute node running the specified hypervisor when launching instances of the image. Image metadata such as vm_mode, hypervisor_type, architecture, and others can be set when importing the image to glance. The metatdata can also be changed using the nova or glance commands:

    $ nova image-meta img-uuid set hypervisor_type=xen vm_mode=hvm

    $ glance image-update img-uuid --property hypervisor_type=xen --property vm_mode=hvm

    For more more information on image metadata, refer to the OpenStack Virtual Image Guide.

To customize the libvirt driver, use the configuration option settings documented in Table 4.63, “Description of Xen configuration options”.

 Troubleshoot Xen with Libvirt

 Known issues

  • Xen via libvirt is currently only supported with nova networking. A number of bugs are currently worked on to make sure that Xen via libvirt will also work with Neutron.

 Additional information and resources

The following section contains links to other useful resources

Questions? Discuss on
Found an error? Report a bug against this page

loading table of contents...