openstack-manuals/doc/config-reference/compute/section_hypervisor_xen_libvirt.xml
KATO Tomoyuki b88dd6d17b Update the links to Image Guide
Change-Id: Icf6d35f6f9b7b5d96955d41f643ef17c9bf9eb35
Implements: blueprint image-guide-rst
Depends-On: I694301758f7f85290d4c9f9b01fbd1924b02b476
2015-11-24 10:56:06 +01:00

224 lines
15 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<section xmlns="http://docbook.org/ns/docbook"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xlink="http://www.w3.org/1999/xlink"
version="5.0"
xml:id="xen_libvirt">
<?dbhtml stop-chunking?>
<title>Xen via Libvirt</title>
<para>OpenStack Compute supports the Xen Project Hypervisor (or Xen). Xen can be integrated with
OpenStack Compute via the <link xlink:href="http://libvirt.org/">libvirt</link>
<link xlink:href="http://wiki.xen.org/wiki/Choice_of_Toolstacks">toolstack</link> or via the
<link xlink:href="http://xenproject.org/developers/teams/xapi.html">XAPI</link>
<link xlink:href="http://wiki.xen.org/wiki/Choice_of_Toolstacks">toolstack</link>. 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 <xref linkend="section_hypervisor_xen_xapi"/>.</para>
<section xml:id="xen-libvirt-install">
<title>Installing Xen with Libvirt</title>
<para>At this stage we recommend to use the baseline that we use for the <link
xlink:href="http://wiki.xenproject.org/wiki/OpenStack_CI_Loop_for_Xen-Libvirt">Xen
Project OpenStack CI Loop</link>, which contains the most recent stability fixes to
both Xen and Libvirt.</para>
<para><link
xlink:href="http://www.xenproject.org/downloads/xen-archives/xen-45-series/xen-451.html"
>Xen 4.5.1</link> (or newer) and <link xlink:href="http://libvirt.org/sources/"
>Libvirt 1.2.15</link> (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 <link
xlink:href="http://wiki.xenproject.org/wiki/Category:Host_Install">Dom 0</link>,
whether the relevant version of Xen and Libvirt are available as installable
packages.</para>
<para>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 <link xlink:href="https://build.opensuse.org/project/show/Virtualization">Open
Build Service</link> 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 <link xlink:href="https://build.opensuse.org/package/show/Virtualization/xen"
>here</link> and <link
xlink:href="https://build.opensuse.org/package/show/Virtualization/libvirt"
>here</link>.</para>
<para>Alternatively, it is possible to use the Ubuntu LTS 14.04 Xen Package
<emphasis>4.4.1-0ubuntu0.14.04.4</emphasis> (Xen 4.4.1) and apply the patches
outlined <link
xlink:href="http://wiki.xenproject.org/wiki/OpenStack_CI_Loop_for_Xen-Libvirt#Baseline"
>here</link>. You can also use the Ubuntu LTS 14.04 libvirt package <emphasis>1.2.2
libvirt_1.2.2-0ubuntu13.1.7</emphasis> as baseline and update it to libvirt version
1.2.15, or 1.2.14 with the patches outlined <link
xlink:href="http://wiki.xenproject.org/wiki/OpenStack_CI_Loop_for_Xen-Libvirt#Baseline"
>here</link> applied. Note that this will require re-build these packages partly
from source.</para>
<para>For further information and latest developments, you may want to consult the Xen
Project's <link
xlink:href="http://lists.xenproject.org/cgi-bin/mailman/listinfo/wg-openstack"
>mailing lists for OpenStack related issues and questions</link>.</para>
</section>
<section xml:id="xen-libvirt-configuration">
<title>Configuring Xen with Libvirt</title>
<para>To enable Xen via libvirt, ensure the following options are set in
<filename>/etc/nova/nova.conf</filename> on all hosts running the <systemitem class="service"
>nova-compute</systemitem>
service.<programlisting language="ini">compute_driver = libvirt.LibvirtDriver
[libvirt]
virt_type = xen</programlisting></para>
</section>
<section xml:id="xen-libvirt-additional-configuration">
<title>Additional configuration options</title>
<para>Use the following as a guideline for configuring Xen for use in OpenStack:</para>
<orderedlist>
<listitem>
<para><emphasis role="bold">Dom0 Memory:</emphasis> Set it between 1GB and 4GB by
adding the following parameter to the Xen Boot Options in the <filename><link
xlink:href="http://xenbits.xen.org/docs/unstable/misc/xen-command-line.html"
>grub.conf</link></filename> file.
<programlisting language="ini">dom0_mem=1024M</programlisting></para>
<note><para>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.</para></note>
<note><para>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 <link xlink:href="http://wiki.xenproject.org/wiki/Category:Host_Install"
>Dom 0</link> for more resources).</para></note>
</listitem>
<listitem>
<para><emphasis role="bold">Dom0 vcpus:</emphasis> Set the virtual CPUs to 4 and
employ CPU pinning by adding the following parameters to the Xen Boot Options in the
<filename><link
xlink:href="http://xenbits.xen.org/docs/unstable/misc/xen-command-line.html"
>grub.conf</link></filename> file.
<programlisting language="ini">dom0_max_vcpus=4 dom0_vcpus_pin</programlisting></para>
<note><para>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.</para></note>
</listitem>
<listitem>
<para><emphasis role="bold">PV vs HVM guests:</emphasis> 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
<link xlink:href="http://wiki.xen.org/wiki/Xen_Overview#Guest_Types">
Xen Guest Types</link>.</para>
<para>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.
</para>
<para>
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</para>
<para>To choose one of the HVM modes (HVM, HVM with PV Drivers or PVHVM) use one of
the following two commands
<screen><prompt>$</prompt> <userinput>nova image-meta <replaceable>img-uuid</replaceable> set vm_mode=hvm</userinput></screen>
<screen><prompt>$</prompt> <userinput>glance image-update <replaceable>img-uuid</replaceable> --property vm_mode=hvm</userinput></screen>
To chose PV mode, which is supported by NetBSD, FreeBSD and Linux, useone of
the following two commands
<screen><prompt>$</prompt> <userinput>nova image-meta <replaceable>img-uuid</replaceable> set vm_mode=xen</userinput></screen>
<screen><prompt>$</prompt> <userinput>glance image-update <replaceable>img-uuid</replaceable> --property vm_mode=xen</userinput></screen>
</para>
<note><para>The default for virtualization mode in nova is PV mode.</para></note>
</listitem>
<listitem>
<para><emphasis role="bold">Image Formats:</emphasis> Xen supports raw, qcow2 and vhd
image formats. For more information on image formats, refer to the <link
xlink:href="http://docs.openstack.org/image-guide/introduction.html"
>OpenStack Virtual Image Guide</link> and the <link
xlink:href="http://wiki.xenproject.org/wiki/Storage_options"
>Storage Options Guide on the Xen Project Wiki</link>.</para>
</listitem>
<listitem>
<para><emphasis role="bold">Image Metadata:</emphasis> 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:
<screen><prompt>$</prompt> <userinput>nova image-meta <replaceable>img-uuid</replaceable> set hypervisor_type=xen vm_mode=hvm</userinput></screen>
<screen><prompt>$</prompt> <userinput>glance image-update <replaceable>img-uuid</replaceable> --property hypervisor_type=xen --property vm_mode=hvm</userinput></screen>
</para>
<para>For more more information on image metadata, refer to the <link
xlink:href="http://docs.openstack.org/image-guide/image-metadata.html"
>OpenStack Virtual Image Guide</link>.
</para>
</listitem>
</orderedlist>
<para>To customize the libvirt driver, use the configuration option settings documented in
<xref linkend="config_table_nova_xen"/>.
</para>
</section>
<section xml:id="xen-libvirt-troubleshoot">
<title>Troubleshoot Xen with Libvirt</title>
<itemizedlist>
<listitem>
<para><emphasis role="bold">Important Log Files:</emphasis> When an instance fails to start, or when
you come across other issues, you should first consult the following log files:
<itemizedlist>
<listitem><para><filename>/var/log/nova/compute.log</filename> (for more information refer to
<xref linkend="section_nova-logs"/>).</para></listitem>
<listitem><para><filename>/var/log/libvirt/libxl/libxl-driver.log</filename>,</para></listitem>
<listitem><para><filename>/var/log/xen/qemu-dm-${instancename}.log</filename>,</para></listitem>
<listitem><para><filename>/var/log/xen/xen-hotplug.log</filename>,</para></listitem>
<listitem><para><filename>/var/log/xen/console/guest-${instancename}</filename> (to enable see <link
xlink:href="http://wiki.xen.org/wiki/Reporting_Bugs_against_Xen#Guest_console_logs"
>Enabling Guest Console Logs</link>) and</para>
</listitem>
<listitem><para>Host Console Logs (read <link
xlink:href="http://wiki.xen.org/wiki/Reporting_Bugs_against_Xen#Host_console_logs"
>Enabling and Retrieving Host Console Logs</link>).</para>
</listitem>
</itemizedlist>
</para>
<para>If you need further help you can ask questions on the mailing lists <link
xlink:href="http://lists.xenproject.org/cgi-bin/mailman/listinfo/xen-users"
>xen-users@</link>, <link
xlink:href="http://lists.xenproject.org/cgi-bin/mailman/listinfo/wg-openstack"
>wg-openstack@</link> or <link
xlink:href="http://wiki.xen.org/wiki/Reporting_Bugs_against_Xen">raise a
bug</link> against Xen.</para>
</listitem>
</itemizedlist>
</section>
<section xml:id="xen-libvirt-known-issues">
<title>Known issues</title>
<itemizedlist>
<listitem>
<para>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.</para>
</listitem>
</itemizedlist>
</section>
<section xml:id="xen-libvirt-additional-information">
<title>Additional information and resources</title>
<para>The following section contains links to other useful resources</para>
<itemizedlist>
<listitem>
<para><link
xlink:href="http://wiki.xenproject.org/wiki/OpenStack"
>wiki.xenproject.org/wiki/OpenStack</link> - OpenStack Documentation on the Xen Project wiki</para>
</listitem>
<listitem>
<para><link
xlink:href="http://wiki.xenproject.org/wiki/OpenStack_CI_Loop_for_Xen-Libvirt"
>wiki.xenproject.org/wiki/OpenStack_CI_Loop_for_Xen-Libvirt</link> - Information about the
Xen Project OpenStack CI Loop</para>
</listitem>
<listitem>
<para><link
xlink:href="http://wiki.xenproject.org/wiki/OpenStack_via_DevStack"
>wiki.xenproject.org/wiki/OpenStack_via_DevStack</link> - How to set up OpenStack via DevStack</para>
</listitem>
<listitem>
<para><link
xlink:href="http://lists.xenproject.org/cgi-bin/mailman/listinfo/wg-openstack"
>Mailing lists for OpenStack related issues and questions</link> - This list is dedicated
to coordinating bug fixes and issues across Xen, libvirt and OpenStack and the CI loop.</para>
</listitem>
</itemizedlist>
</section>
</section>