1 <?xml version=
"1.0" encoding=
"UTF-8"?>
3 <html xmlns=
"http://www.w3.org/1999/xhtml">
5 <h1>libxl hypervisor driver for Xen
</h1>
10 The libvirt libxl driver provides the ability to manage virtual
11 machines on any Xen release from
4.6.0 onwards.
14 <h2><a id=
"project">Project Links
</a></h2>
18 The
<a href=
"https://www.xenproject.org">Xen
</a>
19 hypervisor on Linux and Solaris hosts
23 <h2><a id=
"prereq">Deployment pre-requisites
</a></h2>
26 The libvirt libxl driver uses Xen's libxl API, also known as
27 libxenlight, to implement libvirt's hypervisor driver
28 functionality. libxl provides a consolidated interface for
29 managing a Xen host and its virtual machines, unlike old
30 versions of Xen where applications often had to communicate
31 with xend, xenstored, and the hypervisor itself via hypercalls.
32 With libxl the only pre-requisit is a properly installed Xen
33 host with the libxl toolstack running in a service domain
37 <h2><a id=
"uri">Connections to libxl driver
</a></h2>
40 The libvirt libxl driver is a single-instance privileged driver,
41 with a driver name of 'xen'. Some example connection URIs for
46 xen:///system (local access, direct)
47 xen+unix:///system (local access, via daemon)
48 xen://example.com/system (remote access, TLS/x509)
49 xen+tcp://example.com/system (remote access, SASl/Kerberos)
50 xen+ssh://root@example.com/system (remote access, SSH tunnelled)
53 <h2><a id=
"imex">Import and export of libvirt domain XML configs
</a></h2>
56 The libxl driver currently supports three native
57 config formats. The first, known as
<code>xen-xm
</code>, is the
58 original Xen virtual machine config format used by the legacy
59 xm/xend toolstack. The second, known as
<code>xen-sxpr
</code>,
60 is also one of the original formats that was used by xend's
61 legacy HTTP RPC service (
<span class='removed'
>removed in
5.6.0</span>)
65 The third format is
<code>xen-xl
</code>, which is the virtual
66 machine config format supported by modern Xen. The
<code>xen-xl
</code>
67 format is described in the xl.cfg(
5) man page.
70 <h3><a id=
"xmlimport">Converting from XM config files to domain XML
</a></h3>
73 The
<code>virsh domxml-from-native
</code> provides a way to convert an
74 existing set of xl, xm, or sxpr config files to libvirt Domain XML,
75 which can then be used by libvirt.
78 <pre>$ virsh -c xen:///system domxml-from-native xen-xm rhel5.cfg
79 <domain type='xen'
>
80 <name
>rhel5pv
</name
>
81 <uuid
>8f07fe28-
753f-
2729-d76d-bdbd892f949a
</uuid
>
82 <memory
>2560000</memory
>
83 <currentMemory
>307200</currentMemory
>
84 <vcpu
>4</vcpu
>
85 <bootloader
>/usr/bin/pygrub
</bootloader
>
87 <type arch='x86_64' machine='xenpv'
>linux
</type
>
89 <clock offset='utc'/
>
90 <on_poweroff
>destroy
</on_poweroff
>
91 <on_reboot
>restart
</on_reboot
>
92 <on_crash
>restart
</on_crash
>
94 <disk type='file' device='disk'
>
95 <driver name='tap' type='aio'/
>
96 <source file='/var/lib/xen/images/rhel5pv.img'/
>
97 <target dev='xvda' bus='xen'/
>
99 <disk type='file' device='disk'
>
100 <driver name='tap' type='qcow'/
>
101 <source file='/root/qcow1-xen.img'/
>
102 <target dev='xvdd' bus='xen'/
>
104 <interface type='bridge'
>
105 <mac address='
00:
16:
3e:
60:
36:ba'/
>
106 <source bridge='xenbr0'/
>
108 <console type='pty'
>
109 <target port='
0'/
>
111 <input type='mouse' bus='xen'/
>
112 <graphics type='vnc' port='-
1' autoport='yes' listen='
0.0.0.0'/
>
114 </domain
></pre>
116 <h3><a id=
"xmlexport">Converting from domain XML to XM config files
</a></h3>
119 The
<code>virsh domxml-to-native
</code> provides a way to convert a
120 guest description using libvirt Domain XML into xl, xm, or sxpr config
124 <pre>$ virsh -c xen:///system domxml-to-native xen-xm rhel5pv.xml
126 uuid =
"8f07fe28-753f-2729-d76d-bdbd892f949a"
130 bootloader =
"/usr/bin/pygrub"
131 kernel =
"/var/lib/xen/boot_kernel.0YK-cS"
132 ramdisk =
"/var/lib/xen/boot_ramdisk.vWgrxK"
133 extra =
"ro root=/dev/VolGroup00/LogVol00 rhgb quiet"
134 on_poweroff =
"destroy"
135 on_reboot =
"restart"
140 vnclisten =
"0.0.0.0"
141 disk = [
"tap:aio:/var/lib/xen/images/rhel5pv.img,xvda,w",
"tap:qcow:/root/qcow1-xen.img,xvdd,w" ]
142 vif = [
"mac=00:16:3e:60:36:ba,bridge=virbr0,script=vif-bridge,vifname=vif5.0" ]
</pre>
144 <h2><a id=
"xmlconfig">Example domain XML config
</a></h2>
147 Below are some example XML configurations for Xen guest domains.
148 For full details of the available options, consult the
<a href=
"formatdomain.html">domain XML format
</a>
152 <h3>Paravirtualized guest bootloader
</h3>
155 Using a bootloader allows a paravirtualized guest to be booted using
156 a kernel stored inside its virtual disk image
159 <pre><domain type='xen'
>
160 <name
>fc8
</name
>
161 <bootloader
>/usr/bin/pygrub
</bootloader
>
163 <type
>linux
</type
>
165 <memory
>131072</memory
>
166 <vcpu
>1</vcpu
>
168 <disk type='file'
>
169 <source file='/var/lib/xen/images/fc4.img'/
>
170 <target dev='sda1'/
>
172 <interface type='bridge'
>
173 <source bridge='xenbr0'/
>
174 <mac address='aa:
00:
00:
00:
00:
11'/
>
175 <script path='/etc/xen/scripts/vif-bridge'/
>
177 <console tty='/dev/pts/
5'/
>
179 </domain
></pre>
181 <h3>Paravirtualized guest direct kernel boot
</h3>
184 For installation of paravirtualized guests it is typical to boot the
185 domain using a kernel and initrd stored in the host OS
188 <pre><domain type='xen'
>
189 <name
>fc8
</name
>
191 <type
>linux
</type
>
192 <kernel
>/var/lib/xen/install/vmlinuz-fedora8-x86_64
</kernel
>
193 <initrd
>/var/lib/xen/install/initrd-vmlinuz-fedora8-x86_64
</initrd
>
194 <cmdline
> kickstart=http://example.com/myguest.ks
</cmdline
>
196 <memory
>131072</memory
>
197 <vcpu
>1</vcpu
>
199 <disk type='file'
>
200 <source file='/var/lib/xen/images/fc4.img'/
>
201 <target dev='sda1'/
>
203 <interface type='bridge'
>
204 <source bridge='xenbr0'/
>
205 <mac address='aa:
00:
00:
00:
00:
11'/
>
206 <script path='/etc/xen/scripts/vif-bridge'/
>
208 <graphics type='vnc' port='-
1'/
>
209 <console tty='/dev/pts/
5'/
>
211 </domain
></pre>
213 <h3>Fullyvirtualized guest BIOS boot
</h3>
216 Fullyvirtualized guests use the emulated BIOS to boot off the primary
217 harddisk, CDROM or Network PXE ROM.
220 <pre><domain type='xen' id='
3'
>
221 <name
>fv0
</name
>
222 <uuid
>4dea22b31d52d8f32516782e98ab3fa0
</uuid
>
224 <type
>hvm
</type
>
225 <loader
>/usr/lib/xen/boot/hvmloader
</loader
>
226 <boot dev='hd'/
>
228 <memory
>524288</memory
>
229 <vcpu
>1</vcpu
>
230 <on_poweroff
>destroy
</on_poweroff
>
231 <on_reboot
>restart
</on_reboot
>
232 <on_crash
>restart
</on_crash
>
238 <clock
sync=
"localtime"/
>
240 <emulator
>/usr/lib/xen/bin/qemu-dm
</emulator
>
241 <interface type='bridge'
>
242 <source bridge='xenbr0'/
>
243 <mac address='
00:
16:
3e:
5d:c7:
9e'/
>
244 <script path='vif-bridge'/
>
246 <disk type='file'
>
247 <source file='/var/lib/xen/images/fv0'/
>
248 <target dev='hda'/
>
250 <disk type='file' device='cdrom'
>
251 <source file='/var/lib/xen/images/fc5-x86_64-boot.iso'/
>
252 <target dev='hdc'/
>
255 <disk type='file' device='floppy'
>
256 <source file='/root/fd.img'/
>
257 <target dev='fda'/
>
259 <graphics type='vnc' port='
5904'/
>
261 </domain
></pre>
263 <h3>Fullyvirtualized guest direct kernel boot
</h3>
266 With Xen
3.2.0 or later it is possible to bypass the BIOS and directly
267 boot a Linux kernel and initrd as a fullyvirtualized domain. This allows
268 for complete automation of OS installation, for example using the Anaconda
272 <pre><domain type='xen' id='
3'
>
273 <name
>fv0
</name
>
274 <uuid
>4dea22b31d52d8f32516782e98ab3fa0
</uuid
>
276 <type
>hvm
</type
>
277 <loader
>/usr/lib/xen/boot/hvmloader
</loader
>
278 <kernel
>/var/lib/xen/install/vmlinuz-fedora8-x86_64
</kernel
>
279 <initrd
>/var/lib/xen/install/initrd-vmlinuz-fedora8-x86_64
</initrd
>
280 <cmdline
> kickstart=http://example.com/myguest.ks
</cmdline
>
282 <memory
>524288</memory
>
283 <vcpu
>1</vcpu
>
284 <on_poweroff
>destroy
</on_poweroff
>
285 <on_reboot
>restart
</on_reboot
>
286 <on_crash
>restart
</on_crash
>
292 <clock
sync=
"localtime"/
>
294 <emulator
>/usr/lib/xen/bin/qemu-dm
</emulator
>
295 <interface type='bridge'
>
296 <source bridge='xenbr0'/
>
297 <mac address='
00:
16:
3e:
5d:c7:
9e'/
>
298 <script path='vif-bridge'/
>
300 <disk type='file'
>
301 <source file='/var/lib/xen/images/fv0'/
>
302 <target dev='hda'/
>
304 <disk type='file' device='cdrom'
>
305 <source file='/var/lib/xen/images/fc5-x86_64-boot.iso'/
>
306 <target dev='hdc'/
>
309 <disk type='file' device='floppy'
>
310 <source file='/root/fd.img'/
>
311 <target dev='fda'/
>
313 <graphics type='vnc' port='
5904'/
>
315 </domain
></pre>