view docs/src/user.tex @ 16362:e2445c775efc

Users manual updates:
1) PAE as 32-bit Xen default
2) IA64 and Power are supported
3) AMD Virtualization is supported
4) Add console_timestamps boot param

Signed-off-by: Atsushi SAKAI <>
author Keir Fraser <>
date Tue Nov 06 09:41:57 2007 +0000 (2007-11-06)
parents a00cc97b392a
children e39931a314c8
line source
1 \documentclass[11pt,twoside,final,openright]{report}
2 \usepackage{a4,graphicx,html,parskip,setspace,times,xspace,url}
3 \setstretch{1.15}
5 \renewcommand{\ttdefault}{pcr}
7 \def\Xend{{Xend}\xspace}
8 \def\xend{{xend}\xspace}
10 \latexhtml{\renewcommand{\path}[1]{{\small {\tt #1}}}}{\renewcommand{\path}[1]{{\tt #1}}}
13 \begin{document}
16 \pagestyle{empty}
17 \begin{center}
18 \vspace*{\fill}
19 \includegraphics{figs/xenlogo.eps}
20 \vfill
21 \vfill
22 \vfill
23 \begin{tabular}{l}
24 {\Huge \bf Users' Manual} \\[4mm]
25 {\huge Xen v3.0} \\[80mm]
26 \end{tabular}
27 \end{center}
29 {\bf DISCLAIMER: This documentation is always under active development
30 and as such there may be mistakes and omissions --- watch out for
31 these and please report any you find to the developers' mailing list,
32 The latest version is always available
33 on-line. Contributions of material, suggestions and corrections are
34 welcome.}
36 \vfill
37 \clearpage
41 \pagestyle{empty}
43 \vspace*{\fill}
45 Xen is Copyright \copyright 2002-2005, University of Cambridge, UK, XenSource
46 Inc., IBM Corp., Hewlett-Packard Co., Intel Corp., AMD Inc., and others. All
47 rights reserved.
49 Xen is an open-source project. Most portions of Xen are licensed for copying
50 under the terms of the GNU General Public License, version 2. Other portions
51 are licensed under the terms of the GNU Lesser General Public License, the
52 Zope Public License 2.0, or under ``BSD-style'' licenses. Please refer to the
53 COPYING file for details.
55 Xen includes software by Christopher Clark. This software is covered by the
56 following licence:
58 \begin{quote}
59 Copyright (c) 2002, Christopher Clark. All rights reserved.
61 Redistribution and use in source and binary forms, with or without
62 modification, are permitted provided that the following conditions are met:
64 \begin{itemize}
65 \item Redistributions of source code must retain the above copyright notice,
66 this list of conditions and the following disclaimer.
68 \item Redistributions in binary form must reproduce the above copyright
69 notice, this list of conditions and the following disclaimer in the
70 documentation and/or other materials provided with the distribution.
72 \item Neither the name of the original author; nor the names of any
73 contributors may be used to endorse or promote products derived from this
74 software without specific prior written permission.
75 \end{itemize}
87 \end{quote}
89 \cleardoublepage
93 \pagestyle{plain}
94 \pagenumbering{roman}
95 { \parskip 0pt plus 1pt
96 \tableofcontents }
97 \cleardoublepage
101 \pagenumbering{arabic}
102 \raggedbottom
103 \widowpenalty=10000
104 \clubpenalty=10000
105 \parindent=0pt
106 \parskip=5pt
107 \renewcommand{\topfraction}{.8}
108 \renewcommand{\bottomfraction}{.8}
109 \renewcommand{\textfraction}{.2}
110 \renewcommand{\floatpagefraction}{.8}
111 \setstretch{1.1}
114 %% Chapter Introduction moved to introduction.tex
115 \chapter{Introduction}
118 Xen is an open-source \emph{para-virtualizing} virtual machine monitor
119 (VMM), or ``hypervisor'', for the x86 processor architecture. Xen can
120 securely execute multiple virtual machines on a single physical system
121 with close-to-native performance. Xen facilitates enterprise-grade
122 functionality, including:
124 \begin{itemize}
125 \item Virtual machines with performance close to native hardware.
126 \item Live migration of running virtual machines between physical hosts.
127 \item Up to 32\footnote{IA64 supports up to 64 virtual CPUs per guest virtual machine} virtual CPUs per guest virtual machine, with VCPU hotplug.
128 \item x86/32, x86/32 with PAE, x86/64, IA64 and Power platform support.
129 \item Intel and AMD Virtualization Technology for unmodified guest operating systems (including Microsoft Windows).
130 \item Excellent hardware support (supports almost all Linux device
131 drivers).
132 \end{itemize}
135 \section{Usage Scenarios}
137 Usage scenarios for Xen include:
139 \begin{description}
140 \item [Server Consolidation.] Move multiple servers onto a single
141 physical host with performance and fault isolation provided at the
142 virtual machine boundaries.
143 \item [Hardware Independence.] Allow legacy applications and operating
144 systems to exploit new hardware.
145 \item [Multiple OS configurations.] Run multiple operating systems
146 simultaneously, for development or testing purposes.
147 \item [Kernel Development.] Test and debug kernel modifications in a
148 sand-boxed virtual machine --- no need for a separate test machine.
149 \item [Cluster Computing.] Management at VM granularity provides more
150 flexibility than separately managing each physical host, but better
151 control and isolation than single-system image solutions,
152 particularly by using live migration for load balancing.
153 \item [Hardware support for custom OSes.] Allow development of new
154 OSes while benefiting from the wide-ranging hardware support of
155 existing OSes such as Linux.
156 \end{description}
159 \section{Operating System Support}
161 Para-virtualization permits very high performance virtualization, even
162 on architectures like x86 that are traditionally very hard to
163 virtualize.
165 This approach requires operating systems to be \emph{ported} to run on
166 Xen. Porting an OS to run on Xen is similar to supporting a new
167 hardware platform, however the process is simplified because the
168 para-virtual machine architecture is very similar to the underlying
169 native hardware. Even though operating system kernels must explicitly
170 support Xen, a key feature is that user space applications and
171 libraries \emph{do not} require modification.
173 With hardware CPU virtualization as provided by Intel VT and AMD
174 SVM technology, the ability to run an unmodified guest OS kernel
175 is available. No porting of the OS is required, although some
176 additional driver support is necessary within Xen itself. Unlike
177 traditional full virtualization hypervisors, which suffer a tremendous
178 performance overhead, the combination of Xen and VT or Xen and
179 Pacifica technology complement one another to offer superb performance
180 for para-virtualized guest operating systems and full support for
181 unmodified guests running natively on the processor.
183 Paravirtualized Xen support is available for increasingly many
184 operating systems: currently, mature Linux support is available and
185 included in the standard distribution. Other OS ports---including
186 NetBSD, FreeBSD and Solaris x86 v10---are nearing completion.
189 \section{Hardware Support}
191 Xen currently runs on the x86 architecture, requiring a ``P6'' or
192 newer processor (e.g.\ Pentium Pro, Celeron, Pentium~II, Pentium~III,
193 Pentium~IV, Xeon, AMD~Athlon, AMD~Duron). Multiprocessor machines are
194 supported, and there is support for HyperThreading (SMT). In
195 addition, ports to IA64 and Power architectures are supported.
197 The default 32-bit Xen supports for Intel's Physical Addressing Extensions (PAE), which enable x86/32 machines to address up to 64 GB of physical memory.
198 It also supports non-PAE 32-bit Xen up to 4GB of memory.
199 Xen also supports x86/64 platforms such as Intel EM64T and AMD Opteron
200 which can currently address up to 1TB of physical memory.
202 Xen offloads most of the hardware support issues to the guest OS
203 running in the \emph{Domain~0} management virtual machine. Xen itself
204 contains only the code required to detect and start secondary
205 processors, set up interrupt routing, and perform PCI bus
206 enumeration. Device drivers run within a privileged guest OS rather
207 than within Xen itself. This approach provides compatibility with the
208 majority of device hardware supported by Linux. The default XenLinux
209 build contains support for most server-class network and disk
210 hardware, but you can add support for other hardware by configuring
211 your XenLinux kernel in the normal way.
214 \section{Structure of a Xen-Based System}
216 A Xen system has multiple layers, the lowest and most privileged of
217 which is Xen itself.
219 Xen may host multiple \emph{guest} operating systems, each of which is
220 executed within a secure virtual machine. In Xen terminology, a
221 \emph{domain}. Domains are scheduled by Xen to make effective use of the
222 available physical CPUs. Each guest OS manages its own applications.
223 This management includes the responsibility of scheduling each
224 application within the time allotted to the VM by Xen.
226 The first domain, \emph{domain~0}, is created automatically when the
227 system boots and has special management privileges. Domain~0 builds
228 other domains and manages their virtual devices. It also performs
229 administrative tasks such as suspending, resuming and migrating other
230 virtual machines.
232 Within domain~0, a process called \emph{xend} runs to manage the system.
233 \Xend\ is responsible for managing virtual machines and providing access
234 to their consoles. Commands are issued to \xend\ over an HTTP interface,
235 via a command-line tool.
238 \section{History}
240 Xen was originally developed by the Systems Research Group at the
241 University of Cambridge Computer Laboratory as part of the XenoServers
242 project, funded by the UK-EPSRC\@.
244 XenoServers aim to provide a ``public infrastructure for global
245 distributed computing''. Xen plays a key part in that, allowing one to
246 efficiently partition a single machine to enable multiple independent
247 clients to run their operating systems and applications in an
248 environment. This environment provides protection, resource isolation
249 and accounting. The project web page contains further information along
250 with pointers to papers and technical reports:
251 \path{}
253 Xen has grown into a fully-fledged project in its own right, enabling us
254 to investigate interesting research issues regarding the best techniques
255 for virtualizing resources such as the CPU, memory, disk and network.
256 Project contributors now include XenSource, Intel, IBM, HP, AMD, Novell,
257 RedHat.
259 Xen was first described in a paper presented at SOSP in
260 2003\footnote{\tt
261}, and the first
262 public release (1.0) was made that October. Since then, Xen has
263 significantly matured and is now used in production scenarios on many
264 sites.
266 \section{What's New}
268 Xen 3.0.0 offers:
270 \begin{itemize}
271 \item Support for up to 32-way SMP guest operating systems
272 \item Intel (Physical Addressing Extensions) PAE to support 32-bit
273 servers with more than 4GB physical memory
274 \item x86/64 support (Intel EM64T, AMD Opteron)
275 \item Intel VT-x support to enable the running of unmodified guest
276 operating systems (Windows XP/2003, Legacy Linux)
277 \item Enhanced control tools
278 \item Improved ACPI support
279 \item AGP/DRM graphics
280 \end{itemize}
283 Xen 3.0 features greatly enhanced hardware support, configuration
284 flexibility, usability and a larger complement of supported operating
285 systems. This latest release takes Xen a step closer to being the
286 definitive open source solution for virtualization.
290 \part{Installation}
292 %% Chapter Basic Installation
293 \chapter{Basic Installation}
295 The Xen distribution includes three main components: Xen itself, ports
296 of Linux and NetBSD to run on Xen, and the userspace tools required to
297 manage a Xen-based system. This chapter describes how to install the
298 Xen~3.0 distribution from source. Alternatively, there may be pre-built
299 packages available as part of your operating system distribution.
302 \section{Prerequisites}
303 \label{sec:prerequisites}
305 The following is a full list of prerequisites. Items marked `$\dag$' are
306 required by the \xend\ control tools, and hence required if you want to
307 run more than one virtual machine; items marked `$*$' are only required
308 if you wish to build from source.
309 \begin{itemize}
310 \item A working Linux distribution using the GRUB bootloader and running
311 on a P6-class or newer CPU\@.
312 \item [$\dag$] The \path{iproute2} package.
313 \item [$\dag$] The Linux bridge-utils\footnote{Available from {\tt
314}} (e.g., \path{/sbin/brctl})
315 \item [$\dag$] The Linux hotplug system\footnote{Available from {\tt
316}} (e.g.,
317 \path{/sbin/hotplug} and related scripts). On newer distributions,
318 this is included alongside the Linux udev system\footnote{See {\tt
320 \item [$*$] Build tools (gcc v3.2.x or v3.3.x, binutils, GNU make).
321 \item [$*$] Development installation of zlib (e.g.,\ zlib-dev).
322 \item [$*$] Development installation of Python v2.2 or later (e.g.,\
323 python-dev).
324 \item [$*$] \LaTeX\ and transfig are required to build the
325 documentation.
326 \end{itemize}
328 Once you have satisfied these prerequisites, you can now install either
329 a binary or source distribution of Xen.
331 \section{Installing from Binary Tarball}
333 Pre-built tarballs are available for download from the XenSource downloads
334 page:
335 \begin{quote} {\tt}
336 \end{quote}
338 Once you've downloaded the tarball, simply unpack and install:
339 \begin{verbatim}
340 # tar zxvf xen-3.0-install.tgz
341 # cd xen-3.0-install
342 # sh ./
343 \end{verbatim}
345 Once you've installed the binaries you need to configure your system as
346 described in Section~\ref{s:configure}.
348 \section{Installing from RPMs}
349 Pre-built RPMs are available for download from the XenSource downloads
350 page:
351 \begin{quote} {\tt}
352 \end{quote}
354 Once you've downloaded the RPMs, you typically install them via the
355 RPM commands:
357 \verb|# rpm -iv rpmname|
359 See the instructions and the Release Notes for each RPM set referenced at:
360 \begin{quote}
361 {\tt}.
362 \end{quote}
364 \section{Installing from Source}
366 This section describes how to obtain, build and install Xen from source.
368 \subsection{Obtaining the Source}
370 The Xen source tree is available as either a compressed source tarball
371 or as a clone of our master Mercurial repository.
373 \begin{description}
374 \item[Obtaining the Source Tarball]\mbox{} \\
375 Stable versions and daily snapshots of the Xen source tree are
376 available from the Xen download page:
377 \begin{quote} {\tt \tt}
378 \end{quote}
379 \item[Obtaining the source via Mercurial]\mbox{} \\
380 The source tree may also be obtained via the public Mercurial
381 repository at:
382 \begin{quote}{\tt}
383 \end{quote} See the instructions and the Getting Started Guide
384 referenced at:
385 \begin{quote}
386 {\tt}
387 \end{quote}
388 \end{description}
390 % \section{The distribution}
391 %
392 % The Xen source code repository is structured as follows:
393 %
394 % \begin{description}
395 % \item[\path{tools/}] Xen node controller daemon (Xend), command line
396 % tools, control libraries
397 % \item[\path{xen/}] The Xen VMM.
398 % \item[\path{buildconfigs/}] Build configuration files
399 % \item[\path{linux-*-xen-sparse/}] Xen support for Linux.
400 % \item[\path{patches/}] Experimental patches for Linux.
401 % \item[\path{docs/}] Various documentation files for users and
402 % developers.
403 % \item[\path{extras/}] Bonus extras.
404 % \end{description}
406 \subsection{Building from Source}
408 The top-level Xen Makefile includes a target ``world'' that will do the
409 following:
411 \begin{itemize}
412 \item Build Xen.
413 \item Build the control tools, including \xend.
414 \item Download (if necessary) and unpack the Linux 2.6 source code, and
415 patch it for use with Xen.
416 \item Build a Linux kernel to use in domain~0 and a smaller unprivileged
417 kernel, which can be used for unprivileged virtual machines.
418 \end{itemize}
420 After the build has completed you should have a top-level directory
421 called \path{dist/} in which all resulting targets will be placed. Of
422 particular interest are the two XenLinux kernel images, one with a
423 ``-xen0'' extension which contains hardware device drivers and drivers
424 for Xen's virtual devices, and one with a ``-xenU'' extension that
425 just contains the virtual ones. These are found in
426 \path{dist/install/boot/} along with the image for Xen itself and the
427 configuration files used during the build.
429 %The NetBSD port can be built using:
430 %\begin{quote}
431 %\begin{verbatim}
432 %# make netbsd20
433 %\end{verbatim}\end{quote}
434 %NetBSD port is built using a snapshot of the netbsd-2-0 cvs branch.
435 %The snapshot is downloaded as part of the build process if it is not
436 %yet present in the \path{NETBSD\_SRC\_PATH} search path. The build
437 %process also downloads a toolchain which includes all of the tools
438 %necessary to build the NetBSD kernel under Linux.
440 To customize the set of kernels built you need to edit the top-level
441 Makefile. Look for the line:
442 \begin{quote}
443 \begin{verbatim}
444 KERNELS ?= linux-2.6-xen0 linux-2.6-xenU
445 \end{verbatim}
446 \end{quote}
448 You can edit this line to include any set of operating system kernels
449 which have configurations in the top-level \path{buildconfigs/}
450 directory.
452 %% Inspect the Makefile if you want to see what goes on during a
453 %% build. Building Xen and the tools is straightforward, but XenLinux
454 %% is more complicated. The makefile needs a `pristine' Linux kernel
455 %% tree to which it will then add the Xen architecture files. You can
456 %% tell the makefile the location of the appropriate Linux compressed
457 %% tar file by
458 %% setting the LINUX\_SRC environment variable, e.g. \\
459 %% \verb!# LINUX_SRC=/tmp/linux-2.6.11.tar.bz2 make world! \\ or by
460 %% placing the tar file somewhere in the search path of {\tt
461 %% LINUX\_SRC\_PATH} which defaults to `{\tt .:..}'. If the
462 %% makefile can't find a suitable kernel tar file it attempts to
463 %% download it from (this won't work if you're behind a
464 %% firewall).
466 %% After untaring the pristine kernel tree, the makefile uses the {\tt
467 %% mkbuildtree} script to add the Xen patches to the kernel.
469 %% \framebox{\parbox{5in}{
470 %% {\bf Distro specific:} \\
471 %% {\it Gentoo} --- if not using udev (most installations,
472 %% currently), you'll need to enable devfs and devfs mount at boot
473 %% time in the xen0 config. }}
475 \subsection{Custom Kernels}
477 % If you have an SMP machine you may wish to give the {\tt '-j4'}
478 % argument to make to get a parallel build.
480 If you wish to build a customized XenLinux kernel (e.g.\ to support
481 additional devices or enable distribution-required features), you can
482 use the standard Linux configuration mechanisms, specifying that the
483 architecture being built for is \path{xen}, e.g:
484 \begin{quote}
485 \begin{verbatim}
486 # cd linux-2.6.12-xen0
487 # make ARCH=xen xconfig
488 # cd ..
489 # make
490 \end{verbatim}
491 \end{quote}
493 You can also copy an existing Linux configuration (\path{.config}) into
494 e.g.\ \path{linux-2.6.12-xen0} and execute:
495 \begin{quote}
496 \begin{verbatim}
497 # make ARCH=xen oldconfig
498 \end{verbatim}
499 \end{quote}
501 You may be prompted with some Xen-specific options. We advise accepting
502 the defaults for these options.
504 Note that the only difference between the two types of Linux kernels
505 that are built is the configuration file used for each. The ``U''
506 suffixed (unprivileged) versions don't contain any of the physical
507 hardware device drivers, leading to a 30\% reduction in size; hence you
508 may prefer these for your non-privileged domains. The ``0'' suffixed
509 privileged versions can be used to boot the system, as well as in driver
510 domains and unprivileged domains.
512 \subsection{Installing Generated Binaries}
514 The files produced by the build process are stored under the
515 \path{dist/install/} directory. To install them in their default
516 locations, do:
517 \begin{quote}
518 \begin{verbatim}
519 # make install
520 \end{verbatim}
521 \end{quote}
523 Alternatively, users with special installation requirements may wish to
524 install them manually by copying the files to their appropriate
525 destinations.
527 %% Files in \path{install/boot/} include:
528 %% \begin{itemize}
529 %% \item \path{install/boot/xen-3.0.gz} Link to the Xen 'kernel'
530 %% \item \path{install/boot/vmlinuz-2.6-xen0} Link to domain 0
531 %% XenLinux kernel
532 %% \item \path{install/boot/vmlinuz-2.6-xenU} Link to unprivileged
533 %% XenLinux kernel
534 %% \end{itemize}
536 The \path{dist/install/boot} directory will also contain the config
537 files used for building the XenLinux kernels, and also versions of Xen
538 and XenLinux kernels that contain debug symbols such as
539 (\path{xen-syms-3.0.0} and \path{vmlinux-syms-}) which are
540 essential for interpreting crash dumps. Retain these files as the
541 developers may wish to see them if you post on the mailing list.
544 \section{Configuration}
545 \label{s:configure}
547 Once you have built and installed the Xen distribution, it is simple to
548 prepare the machine for booting and running Xen.
550 \subsection{GRUB Configuration}
552 An entry should be added to \path{grub.conf} (often found under
553 \path{/boot/} or \path{/boot/grub/}) to allow Xen / XenLinux to boot.
554 This file is sometimes called \path{menu.lst}, depending on your
555 distribution. The entry should look something like the following:
557 %% KMSelf Thu Dec 1 19:06:13 PST 2005 262144 is useful for RHEL/RH and
558 %% related Dom0s.
559 {\small
560 \begin{verbatim}
561 title Xen 3.0 / XenLinux 2.6
562 kernel /boot/xen-3.0.gz dom0_mem=262144
563 module /boot/vmlinuz-2.6-xen0 root=/dev/sda4 ro console=tty0
564 \end{verbatim}
565 }
567 The kernel line tells GRUB where to find Xen itself and what boot
568 parameters should be passed to it (in this case, setting the domain~0
569 memory allocation in kilobytes and the settings for the serial port).
570 For more details on the various Xen boot parameters see
571 Section~\ref{s:xboot}.
573 The module line of the configuration describes the location of the
574 XenLinux kernel that Xen should start and the parameters that should be
575 passed to it. These are standard Linux parameters, identifying the root
576 device and specifying it be initially mounted read only and instructing
577 that console output be sent to the screen. Some distributions such as
578 SuSE do not require the \path{ro} parameter.
580 %% \framebox{\parbox{5in}{
581 %% {\bf Distro specific:} \\
582 %% {\it SuSE} --- Omit the {\tt ro} option from the XenLinux
583 %% kernel command line, since the partition won't be remounted rw
584 %% during boot. }}
586 To use an initrd, add another \path{module} line to the configuration,
587 like: {\small
588 \begin{verbatim}
589 module /boot/my_initrd.gz
590 \end{verbatim}
591 }
593 %% KMSelf Thu Dec 1 19:05:30 PST 2005 Other configs as an appendix?
595 When installing a new kernel, it is recommended that you do not delete
596 existing menu options from \path{menu.lst}, as you may wish to boot your
597 old Linux kernel in future, particularly if you have problems.
599 \subsection{Serial Console (optional)}
601 Serial console access allows you to manage, monitor, and interact with
602 your system over a serial console. This can allow access from another
603 nearby system via a null-modem (``LapLink'') cable or remotely via a serial
604 concentrator.
606 You system's BIOS, bootloader (GRUB), Xen, Linux, and login access must
607 each be individually configured for serial console access. It is
608 \emph{not} strictly necessary to have each component fully functional,
609 but it can be quite useful.
611 For general information on serial console configuration under Linux,
612 refer to the ``Remote Serial Console HOWTO'' at The Linux Documentation
613 Project: \url{}
615 \subsubsection{Serial Console BIOS configuration}
617 Enabling system serial console output neither enables nor disables
618 serial capabilities in GRUB, Xen, or Linux, but may make remote
619 management of your system more convenient by displaying POST and other
620 boot messages over serial port and allowing remote BIOS configuration.
622 Refer to your hardware vendor's documentation for capabilities and
623 procedures to enable BIOS serial redirection.
626 \subsubsection{Serial Console GRUB configuration}
628 Enabling GRUB serial console output neither enables nor disables Xen or
629 Linux serial capabilities, but may made remote management of your system
630 more convenient by displaying GRUB prompts, menus, and actions over
631 serial port and allowing remote GRUB management.
633 Adding the following two lines to your GRUB configuration file,
634 typically either \path{/boot/grub/menu.lst} or \path{/boot/grub/grub.conf}
635 depending on your distro, will enable GRUB serial output.
637 \begin{quote}
638 {\small \begin{verbatim}
639 serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
640 terminal --timeout=10 serial console
641 \end{verbatim}}
642 \end{quote}
644 Note that when both the serial port and the local monitor and keyboard
645 are enabled, the text ``\emph{Press any key to continue}'' will appear
646 at both. Pressing a key on one device will cause GRUB to display to
647 that device. The other device will see no output. If no key is
648 pressed before the timeout period expires, the system will boot to the
649 default GRUB boot entry.
651 Please refer to the GRUB documentation for further information.
654 \subsubsection{Serial Console Xen configuration}
656 Enabling Xen serial console output neither enables nor disables Linux
657 kernel output or logging in to Linux over serial port. It does however
658 allow you to monitor and log the Xen boot process via serial console and
659 can be very useful in debugging.
661 %% kernel /boot/xen-2.0.gz dom0_mem=131072 console=com1,vga com1=115200,8n1
662 %% module /boot/vmlinuz-2.6-xen0 root=/dev/sda4 ro
664 In order to configure Xen serial console output, it is necessary to
665 add a boot option to your GRUB config; e.g.\ replace the previous
666 example kernel line with:
667 \begin{quote} {\small \begin{verbatim}
668 kernel /boot/xen.gz dom0_mem=131072 com1=115200,8n1
669 \end{verbatim}}
670 \end{quote}
672 This configures Xen to output on COM1 at 115,200 baud, 8 data bits, no
673 parity and 1 stop bit. Modify these parameters for your environment.
674 See Section~\ref{s:xboot} for an explanation of all boot parameters.
676 One can also configure XenLinux to share the serial console; to achieve
677 this append ``\path{console=ttyS0}'' to your module line.
680 \subsubsection{Serial Console Linux configuration}
682 Enabling Linux serial console output at boot neither enables nor
683 disables logging in to Linux over serial port. It does however allow
684 you to monitor and log the Linux boot process via serial console and can be
685 very useful in debugging.
687 To enable Linux output at boot time, add the parameter
688 \path{console=ttyS0} (or ttyS1, ttyS2, etc.) to your kernel GRUB line.
689 Under Xen, this might be:
690 \begin{quote}
691 {\footnotesize \begin{verbatim}
692 module /vmlinuz-2.6-xen0 ro root=/dev/VolGroup00/LogVol00 \
693 console=ttyS0, 115200
694 \end{verbatim}}
695 \end{quote}
696 to enable output over ttyS0 at 115200 baud.
700 \subsubsection{Serial Console Login configuration}
702 Logging in to Linux via serial console, under Xen or otherwise, requires
703 specifying a login prompt be started on the serial port. To permit root
704 logins over serial console, the serial port must be added to
705 \path{/etc/securetty}.
707 \newpage
708 To automatically start a login prompt over the serial port,
709 add the line: \begin{quote} {\small {\tt c:2345:respawn:/sbin/mingetty
710 ttyS0}} \end{quote} to \path{/etc/inittab}. Run \path{init q} to force
711 a reload of your inttab and start getty.
713 To enable root logins, add \path{ttyS0} to \path{/etc/securetty} if not
714 already present.
716 Your distribution may use an alternate getty; options include getty,
717 mgetty and agetty. Consult your distribution's documentation
718 for further information.
721 \subsection{TLS Libraries}
723 Users of the XenLinux 2.6 kernel should disable Thread Local Storage
724 (TLS) (e.g.\ by doing a \path{mv /lib/tls /lib/tls.disabled}) before
725 attempting to boot a XenLinux kernel\footnote{If you boot without first
726 disabling TLS, you will get a warning message during the boot process.
727 In this case, simply perform the rename after the machine is up and
728 then run \path{/sbin/ldconfig} to make it take effect.}. You can
729 always reenable TLS by restoring the directory to its original location
730 (i.e.\ \path{mv /lib/tls.disabled /lib/tls}).
732 The reason for this is that the current TLS implementation uses
733 segmentation in a way that is not permissible under Xen. If TLS is not
734 disabled, an emulation mode is used within Xen which reduces performance
735 substantially. To ensure full performance you should install a
736 `Xen-friendly' (nosegneg) version of the library.
739 \section{Booting Xen}
741 It should now be possible to restart the system and use Xen. Reboot and
742 choose the new Xen option when the Grub screen appears.
744 What follows should look much like a conventional Linux boot. The first
745 portion of the output comes from Xen itself, supplying low level
746 information about itself and the underlying hardware. The last portion
747 of the output comes from XenLinux.
749 You may see some error messages during the XenLinux boot. These are not
750 necessarily anything to worry about---they may result from kernel
751 configuration differences between your XenLinux kernel and the one you
752 usually use.
754 When the boot completes, you should be able to log into your system as
755 usual. If you are unable to log in, you should still be able to reboot
756 with your normal Linux kernel by selecting it at the GRUB prompt.
759 % Booting Xen
760 \chapter{Booting a Xen System}
762 Booting the system into Xen will bring you up into the privileged
763 management domain, Domain0. At that point you are ready to create
764 guest domains and ``boot'' them using the \texttt{xm create} command.
766 \section{Booting Domain0}
768 After installation and configuration is complete, reboot the system
769 and and choose the new Xen option when the Grub screen appears.
771 What follows should look much like a conventional Linux boot. The
772 first portion of the output comes from Xen itself, supplying low level
773 information about itself and the underlying hardware. The last
774 portion of the output comes from XenLinux.
776 %% KMSelf Wed Nov 30 18:09:37 PST 2005: We should specify what these are.
778 When the boot completes, you should be able to log into your system as
779 usual. If you are unable to log in, you should still be able to
780 reboot with your normal Linux kernel by selecting it at the GRUB prompt.
782 The first step in creating a new domain is to prepare a root
783 filesystem for it to boot. Typically, this might be stored in a normal
784 partition, an LVM or other volume manager partition, a disk file or on
785 an NFS server. A simple way to do this is simply to boot from your
786 standard OS install CD and install the distribution into another
787 partition on your hard drive.
789 To start the \xend\ control daemon, type
790 \begin{quote}
791 \verb!# xend start!
792 \end{quote}
794 If you wish the daemon to start automatically, see the instructions in
795 Section~\ref{s:xend}. Once the daemon is running, you can use the
796 \path{xm} tool to monitor and maintain the domains running on your
797 system. This chapter provides only a brief tutorial. We provide full
798 details of the \path{xm} tool in the next chapter.
800 % \section{From the web interface}
801 %
802 % Boot the Xen machine and start Xensv (see Chapter~\ref{cha:xensv}
803 % for more details) using the command: \\
804 % \verb_# xensv start_ \\
805 % This will also start Xend (see Chapter~\ref{cha:xend} for more
806 % information).
807 %
808 % The domain management interface will then be available at {\tt
809 % http://your\_machine:8080/}. This provides a user friendly wizard
810 % for starting domains and functions for managing running domains.
811 %
812 % \section{From the command line}
813 \section{Booting Guest Domains}
815 \subsection{Creating a Domain Configuration File}
817 Before you can start an additional domain, you must create a
818 configuration file. We provide two example files which you can use as
819 a starting point:
820 \begin{itemize}
821 \item \path{/etc/xen/xmexample1} is a simple template configuration
822 file for describing a single VM\@.
823 \item \path{/etc/xen/xmexample2} file is a template description that
824 is intended to be reused for multiple virtual machines. Setting the
825 value of the \path{vmid} variable on the \path{xm} command line
826 fills in parts of this template.
827 \end{itemize}
829 There are also a number of other examples which you may find useful.
830 Copy one of these files and edit it as appropriate. Typical values
831 you may wish to edit include:
833 \begin{quote}
834 \begin{description}
835 \item[kernel] Set this to the path of the kernel you compiled for use
836 with Xen (e.g.\ \path{kernel = ``/boot/vmlinuz-2.6-xenU''})
837 \item[memory] Set this to the size of the domain's memory in megabytes
838 (e.g.\ \path{memory = 64})
839 \item[disk] Set the first entry in this list to calculate the offset
840 of the domain's root partition, based on the domain ID\@. Set the
841 second to the location of \path{/usr} if you are sharing it between
842 domains (e.g.\ \path{disk = ['phy:your\_hard\_drive\%d,sda1,w' \%
843 (base\_partition\_number + vmid),
844 'phy:your\_usr\_partition,sda6,r' ]}
845 \item[dhcp] Uncomment the dhcp variable, so that the domain will
846 receive its IP address from a DHCP server (e.g.\ \path{dhcp=``dhcp''})
847 \end{description}
848 \end{quote}
850 You may also want to edit the {\bf vif} variable in order to choose
851 the MAC address of the virtual ethernet interface yourself. For
852 example:
854 \begin{quote}
855 \verb_vif = ['mac=00:16:3E:F6:BB:B3']_
856 \end{quote}
857 If you do not set this variable, \xend\ will automatically generate a
858 random MAC address from the range 00:16:3E:xx:xx:xx, assigned by IEEE to
859 XenSource as an OUI (organizationally unique identifier). XenSource
860 Inc. gives permission for anyone to use addresses randomly allocated
861 from this range for use by their Xen domains.
863 For a list of IEEE OUI assignments, see
864 \url{}
867 \subsection{Booting the Guest Domain}
869 The \path{xm} tool provides a variety of commands for managing
870 domains. Use the \path{create} command to start new domains. Assuming
871 you've created a configuration file \path{myvmconf} based around
872 \path{/etc/xen/xmexample2}, to start a domain with virtual machine
873 ID~1 you should type:
875 \begin{quote}
876 \begin{verbatim}
877 # xm create -c myvmconf vmid=1
878 \end{verbatim}
879 \end{quote}
881 The \path{-c} switch causes \path{xm} to turn into the domain's
882 console after creation. The \path{vmid=1} sets the \path{vmid}
883 variable used in the \path{myvmconf} file.
885 You should see the console boot messages from the new domain appearing
886 in the terminal in which you typed the command, culminating in a login
887 prompt.
890 \section{Starting / Stopping Domains Automatically}
892 It is possible to have certain domains start automatically at boot
893 time and to have dom0 wait for all running domains to shutdown before
894 it shuts down the system.
896 To specify a domain is to start at boot-time, place its configuration
897 file (or a link to it) under \path{/etc/xen/auto/}.
899 A Sys-V style init script for Red Hat and LSB-compliant systems is
900 provided and will be automatically copied to \path{/etc/init.d/}
901 during install. You can then enable it in the appropriate way for
902 your distribution.
904 For instance, on Red Hat:
906 \begin{quote}
907 \verb_# chkconfig --add xendomains_
908 \end{quote}
910 By default, this will start the boot-time domains in runlevels 3, 4
911 and 5.
913 You can also use the \path{service} command to run this script
914 manually, e.g:
916 \begin{quote}
917 \verb_# service xendomains start_
919 Starts all the domains with config files under /etc/xen/auto/.
920 \end{quote}
922 \begin{quote}
923 \verb_# service xendomains stop_
925 Shuts down all running Xen domains.
926 \end{quote}
930 \part{Configuration and Management}
932 %% Chapter Domain Management Tools and Daemons
933 \chapter{Domain Management Tools}
935 This chapter summarizes the management software and tools available.
938 \section{\Xend\ }
939 \label{s:xend}
942 The \Xend\ node control daemon performs system management functions
943 related to virtual machines. It forms a central point of control of
944 virtualized resources, and must be running in order to start and manage
945 virtual machines. \Xend\ must be run as root because it needs access to
946 privileged system management functions.
948 An initialization script named \texttt{/etc/init.d/xend} is provided to
949 start \Xend\ at boot time. Use the tool appropriate (i.e. chkconfig) for
950 your Linux distribution to specify the runlevels at which this script
951 should be executed, or manually create symbolic links in the correct
952 runlevel directories.
954 \Xend\ can be started on the command line as well, and supports the
955 following set of parameters:
957 \begin{tabular}{ll}
958 \verb!# xend start! & start \xend, if not already running \\
959 \verb!# xend stop! & stop \xend\ if already running \\
960 \verb!# xend restart! & restart \xend\ if running, otherwise start it \\
961 % \verb!# xend trace_start! & start \xend, with very detailed debug logging \\
962 \verb!# xend status! & indicates \xend\ status by its return code
963 \end{tabular}
965 A SysV init script called {\tt xend} is provided to start \xend\ at
966 boot time. {\tt make install} installs this script in
967 \path{/etc/init.d}. To enable it, you have to make symbolic links in
968 the appropriate runlevel directories or use the {\tt chkconfig} tool,
969 where available. Once \xend\ is running, administration can be done
970 using the \texttt{xm} tool.
972 \subsection{Logging}
974 As \xend\ runs, events will be logged to \path{/var/log/xen/xend.log} and
975 (less frequently) to \path{/var/log/xen/xend-debug.log}. These, along with
976 the standard syslog files, are useful when troubleshooting problems.
978 \subsection{Configuring \Xend\ }
980 \Xend\ is written in Python. At startup, it reads its configuration
981 information from the file \path{/etc/xen/xend-config.sxp}. The Xen
982 installation places an example \texttt{xend-config.sxp} file in the
983 \texttt{/etc/xen} subdirectory which should work for most installations.
985 See the example configuration file \texttt{xend-debug.sxp} and the
986 section 5 man page \texttt{xend-config.sxp} for a full list of
987 parameters and more detailed information. Some of the most important
988 parameters are discussed below.
990 An HTTP interface and a Unix domain socket API are available to
991 communicate with \Xend. This allows remote users to pass commands to the
992 daemon. By default, \Xend does not start an HTTP server. It does start a
993 Unix domain socket management server, as the low level utility
994 \texttt{xm} requires it. For support of cross-machine migration, \Xend\
995 can start a relocation server. This support is not enabled by default
996 for security reasons.
998 Note: the example \texttt{xend} configuration file modifies the defaults and
999 starts up \Xend\ as an HTTP server as well as a relocation server.
1001 From the file:
1003 \begin{verbatim}
1004 #(xend-http-server no)
1005 (xend-http-server yes)
1006 #(xend-unix-server yes)
1007 #(xend-relocation-server no)
1008 (xend-relocation-server yes)
1009 \end{verbatim}
1011 Comment or uncomment lines in that file to disable or enable features
1012 that you require.
1014 Connections from remote hosts are disabled by default:
1016 \begin{verbatim}
1017 # Address xend should listen on for HTTP connections, if xend-http-server is
1018 # set.
1019 # Specifying 'localhost' prevents remote connections.
1020 # Specifying the empty string '' (the default) allows all connections.
1021 #(xend-address '')
1022 (xend-address localhost)
1023 \end{verbatim}
1025 It is recommended that if migration support is not needed, the
1026 \texttt{xend-relocation-server} parameter value be changed to
1027 ``\texttt{no}'' or commented out.
1029 \section{Xm}
1030 \label{s:xm}
1032 The xm tool is the primary tool for managing Xen from the console. The
1033 general format of an xm command line is:
1035 \begin{verbatim}
1036 # xm command [switches] [arguments] [variables]
1037 \end{verbatim}
1039 The available \emph{switches} and \emph{arguments} are dependent on the
1040 \emph{command} chosen. The \emph{variables} may be set using
1041 declarations of the form {\tt variable=value} and command line
1042 declarations override any of the values in the configuration file being
1043 used, including the standard variables described above and any custom
1044 variables (for instance, the \path{xmdefconfig} file uses a {\tt vmid}
1045 variable).
1047 For online help for the commands available, type:
1049 \begin{quote}
1050 \begin{verbatim}
1051 # xm help
1052 \end{verbatim}
1053 \end{quote}
1055 This will list the most commonly used commands. The full list can be obtained
1056 using \verb_xm help --long_. You can also type \path{xm help $<$command$>$}
1057 for more information on a given command.
1059 \subsection{Basic Management Commands}
1061 One useful command is \verb_# xm list_ which lists all domains running in rows
1062 of the following format:
1063 \begin{center} {\tt name domid memory vcpus state cputime}
1064 \end{center}
1066 The meaning of each field is as follows:
1067 \begin{quote}
1068 \begin{description}
1069 \item[name] The descriptive name of the virtual machine.
1070 \item[domid] The number of the domain ID this virtual machine is
1071 running in.
1072 \item[memory] Memory size in megabytes.
1073 \item[vcpus] The number of virtual CPUs this domain has.
1074 \item[state] Domain state consists of 5 fields:
1075 \begin{description}
1076 \item[r] running
1077 \item[b] blocked
1078 \item[p] paused
1079 \item[s] shutdown
1080 \item[c] crashed
1081 \end{description}
1082 \item[cputime] How much CPU time (in seconds) the domain has used so
1083 far.
1084 \end{description}
1085 \end{quote}
1087 The \path{xm list} command also supports a long output format when the
1088 \path{-l} switch is used. This outputs the full details of the
1089 running domains in \xend's SXP configuration format.
1091 If you want to know how long your domains have been running for, then
1092 you can use the \verb_# xm uptime_ command.
1095 You can get access to the console of a particular domain using
1096 the \verb_# xm console_ command (e.g.\ \verb_# xm console myVM_).
1098 \subsection{Domain Scheduling Management Commands}
1100 The credit CPU scheduler automatically load balances guest VCPUs
1101 across all available physical CPUs on an SMP host. The user need
1102 not manually pin VCPUs to load balance the system. However, she
1103 can restrict which CPUs a particular VCPU may run on using
1104 the \path{xm vcpu-pin} command.
1106 Each guest domain is assigned a \path{weight} and a \path{cap}.
1108 A domain with a weight of 512 will get twice as much CPU as a
1109 domain with a weight of 256 on a contended host. Legal weights
1110 range from 1 to 65535 and the default is 256.
1112 The cap optionally fixes the maximum amount of CPU a guest will
1113 be able to consume, even if the host system has idle CPU cycles.
1114 The cap is expressed in percentage of one physical CPU: 100 is
1115 1 physical CPU, 50 is half a CPU, 400 is 4 CPUs, etc... The
1116 default, 0, means there is no upper cap.
1118 When you are running with the credit scheduler, you can check and
1119 modify your domains' weights and caps using the \path{xm sched-credit}
1120 command:
1122 \begin{tabular}{ll}
1123 \verb!xm sched-credit -d <domain>! & lists weight and cap \\
1124 \verb!xm sched-credit -d <domain> -w <weight>! & sets the weight \\
1125 \verb!xm sched-credit -d <domain> -c <cap>! & sets the cap
1126 \end{tabular}
1130 %% Chapter Domain Configuration
1131 \chapter{Domain Configuration}
1132 \label{cha:config}
1134 The following contains the syntax of the domain configuration files
1135 and description of how to further specify networking, driver domain
1136 and general scheduling behavior.
1139 \section{Configuration Files}
1140 \label{s:cfiles}
1142 Xen configuration files contain the following standard variables.
1143 Unless otherwise stated, configuration items should be enclosed in
1144 quotes: see the configuration scripts in \path{/etc/xen/}
1145 for concrete examples.
1147 \begin{description}
1148 \item[kernel] Path to the kernel image.
1149 \item[ramdisk] Path to a ramdisk image (optional).
1150 % \item[builder] The name of the domain build function (e.g.
1151 % {\tt'linux'} or {\tt'netbsd'}.
1152 \item[memory] Memory size in megabytes.
1153 \item[vcpus] The number of virtual CPUs.
1154 \item[console] Port to export the domain console on (default 9600 +
1155 domain ID).
1156 \item[vif] Network interface configuration. This may simply contain
1157 an empty string for each desired interface, or may override various
1158 settings, e.g.\
1159 \begin{verbatim}
1160 vif = [ 'mac=00:16:3E:00:00:11, bridge=xen-br0',
1161 'bridge=xen-br1' ]
1162 \end{verbatim}
1163 to assign a MAC address and bridge to the first interface and assign
1164 a different bridge to the second interface, leaving \xend\ to choose
1165 the MAC address. The settings that may be overridden in this way are
1166 type, mac, bridge, ip, script, backend, and vifname.
1167 \item[disk] List of block devices to export to the domain e.g.
1168 \verb_disk = [ 'phy:hda1,sda1,r' ]_
1169 exports physical device \path{/dev/hda1} to the domain as
1170 \path{/dev/sda1} with read-only access. Exporting a disk read-write
1171 which is currently mounted is dangerous -- if you are \emph{certain}
1172 you wish to do this, you can specify \path{w!} as the mode.
1173 \item[dhcp] Set to {\tt `dhcp'} if you want to use DHCP to configure
1174 networking.
1175 \item[netmask] Manually configured IP netmask.
1176 \item[gateway] Manually configured IP gateway.
1177 \item[hostname] Set the hostname for the virtual machine.
1178 \item[root] Specify the root device parameter on the kernel command
1179 line.
1180 \item[nfs\_server] IP address for the NFS server (if any).
1181 \item[nfs\_root] Path of the root filesystem on the NFS server (if
1182 any).
1183 \item[extra] Extra string to append to the kernel command line (if
1184 any)
1185 \end{description}
1187 Additional fields are documented in the example configuration files
1188 (e.g. to configure virtual TPM functionality).
1190 For additional flexibility, it is also possible to include Python
1191 scripting commands in configuration files. An example of this is the
1192 \path{xmexample2} file, which uses Python code to handle the
1193 \path{vmid} variable.
1196 %\part{Advanced Topics}
1199 \section{Network Configuration}
1201 For many users, the default installation should work ``out of the
1202 box''. More complicated network setups, for instance with multiple
1203 Ethernet interfaces and/or existing bridging setups will require some
1204 special configuration.
1206 The purpose of this section is to describe the mechanisms provided by
1207 \xend\ to allow a flexible configuration for Xen's virtual networking.
1209 \subsection{Xen virtual network topology}
1211 Each domain network interface is connected to a virtual network
1212 interface in dom0 by a point to point link (effectively a ``virtual
1213 crossover cable''). These devices are named {\tt
1214 vif$<$domid$>$.$<$vifid$>$} (e.g.\ {\tt vif1.0} for the first
1215 interface in domain~1, {\tt vif3.1} for the second interface in
1216 domain~3).
1218 Traffic on these virtual interfaces is handled in domain~0 using
1219 standard Linux mechanisms for bridging, routing, rate limiting, etc.
1220 Xend calls on two shell scripts to perform initial configuration of
1221 the network and configuration of new virtual interfaces. By default,
1222 these scripts configure a single bridge for all the virtual
1223 interfaces. Arbitrary routing / bridging configurations can be
1224 configured by customizing the scripts, as described in the following
1225 section.
1227 \subsection{Xen networking scripts}
1229 Xen's virtual networking is configured by two shell scripts (by
1230 default \path{network-bridge} and \path{vif-bridge}). These are called
1231 automatically by \xend\ when certain events occur, with arguments to
1232 the scripts providing further contextual information. These scripts
1233 are found by default in \path{/etc/xen/scripts}. The names and
1234 locations of the scripts can be configured in
1235 \path{/etc/xen/xend-config.sxp}.
1237 \begin{description}
1238 \item[network-bridge:] This script is called whenever \xend\ is started or
1239 stopped to respectively initialize or tear down the Xen virtual
1240 network. In the default configuration initialization creates the
1241 bridge `xen-br0' and moves eth0 onto that bridge, modifying the
1242 routing accordingly. When \xend\ exits, it deletes the Xen bridge
1243 and removes eth0, restoring the normal IP and routing configuration.
1245 %% In configurations where the bridge already exists, this script
1246 %% could be replaced with a link to \path{/bin/true} (for instance).
1248 \item[vif-bridge:] This script is called for every domain virtual
1249 interface and can configure firewalling rules and add the vif to the
1250 appropriate bridge. By default, this adds and removes VIFs on the
1251 default Xen bridge.
1252 \end{description}
1254 Other example scripts are available (\path{network-route} and
1255 \path{vif-route}, \path{network-nat} and \path{vif-nat}).
1256 For more complex network setups (e.g.\ where routing is required or
1257 integrate with existing bridges) these scripts may be replaced with
1258 customized variants for your site's preferred configuration.
1260 \section{Driver Domain Configuration}
1261 \label{s:ddconf}
1263 \subsection{PCI}
1264 \label{ss:pcidd}
1266 Individual PCI devices can be assigned to a given domain (a PCI driver domain)
1267 to allow that domain direct access to the PCI hardware.
1269 While PCI Driver Domains can increase the stability and security of a system
1270 by addressing a number of security concerns, there are some security issues
1271 that remain that you can read about in Section~\ref{s:ddsecurity}.
1273 \subsubsection{Compile-Time Setup}
1274 To use this functionality, ensure
1275 that the PCI Backend is compiled in to a privileged domain (e.g. domain 0)
1276 and that the domains which will be assigned PCI devices have the PCI Frontend
1277 compiled in. In XenLinux, the PCI Backend is available under the Xen
1278 configuration section while the PCI Frontend is under the
1279 architecture-specific "Bus Options" section. You may compile both the backend
1280 and the frontend into the same kernel; they will not affect each other.
1282 \subsubsection{PCI Backend Configuration - Binding at Boot}
1283 The PCI devices you wish to assign to unprivileged domains must be "hidden"
1284 from your backend domain (usually domain 0) so that it does not load a driver
1285 for them. Use the \path{pciback.hide} kernel parameter which is specified on
1286 the kernel command-line and is configurable through GRUB (see
1287 Section~\ref{s:configure}). Note that devices are not really hidden from the
1288 backend domain. The PCI Backend appears to the Linux kernel as a regular PCI
1289 device driver. The PCI Backend ensures that no other device driver loads
1290 for the devices by binding itself as the device driver for those devices.
1291 PCI devices are identified by hexadecimal slot/function numbers (on Linux,
1292 use \path{lspci} to determine slot/function numbers of your devices) and
1293 can be specified with or without the PCI domain: \\
1294 \centerline{ {\tt ({\em bus}:{\em slot}.{\em func})} example {\tt (02:1d.3)}} \\
1295 \centerline{ {\tt ({\em domain}:{\em bus}:{\em slot}.{\em func})} example {\tt (0000:02:1d.3)}} \\
1297 An example kernel command-line which hides two PCI devices might be: \\
1298 \centerline{ {\tt root=/dev/sda4 ro console=tty0 pciback.hide=(02:01.f)(0000:04:1d.0) } } \\
1300 \subsubsection{PCI Backend Configuration - Late Binding}
1301 PCI devices can also be bound to the PCI Backend after boot through the manual
1302 binding/unbinding facilities provided by the Linux kernel in sysfs (allowing
1303 for a Xen user to give PCI devices to driver domains that were not specified
1304 on the kernel command-line). There are several attributes with the PCI
1305 Backend's sysfs directory (\path{/sys/bus/pci/drivers/pciback}) that can be
1306 used to bind/unbind devices:
1308 \begin{description}
1309 \item[slots] lists all of the PCI slots that the PCI Backend will try to seize
1310 (or "hide" from Domain 0). A PCI slot must appear in this list before it can
1311 be bound to the PCI Backend through the \path{bind} attribute.
1312 \item[new\_slot] write the name of a slot here (in 0000:00:00.0 format) to
1313 have the PCI Backend seize the device in this slot.
1314 \item[remove\_slot] write the name of a slot here (same format as
1315 \path{new\_slot}) to have the PCI Backend no longer try to seize devices in
1316 this slot. Note that this does not unbind the driver from a device it has
1317 already seized.
1318 \item[bind] write the name of a slot here (in 0000:00:00.0 format) to have
1319 the Linux kernel attempt to bind the device in that slot to the PCI Backend
1320 driver.
1321 \item[unbind] write the name of a skit here (same format as \path{bind}) to have
1322 the Linux kernel unbind the device from the PCI Backend. DO NOT unbind a
1323 device while it is currently given to a PCI driver domain!
1324 \end{description}
1326 Some examples:
1328 Bind a device to the PCI Backend which is not bound to any other driver.
1329 \begin{verbatim}
1330 # # Add a new slot to the PCI Backend's list
1331 # echo -n 0000:01:04.d > /sys/bus/pci/drivers/pciback/new_slot
1332 # # Now that the backend is watching for the slot, bind to it
1333 # echo -n 0000:01:04.d > /sys/bus/pci/drivers/pciback/bind
1334 \end{verbatim}
1336 Unbind a device from its driver and bind to the PCI Backend.
1337 \begin{verbatim}
1338 # # Unbind a PCI network card from its network driver
1339 # echo -n 0000:05:02.0 > /sys/bus/pci/drivers/3c905/unbind
1340 # # And now bind it to the PCI Backend
1341 # echo -n 0000:05:02.0 > /sys/bus/pci/drivers/pciback/new_slot
1342 # echo -n 0000:05:02.0 > /sys/bus/pci/drivers/pciback/bind
1343 \end{verbatim}
1345 Note that the "-n" option in the example is important as it causes echo to not
1346 output a new-line.
1348 \subsubsection{PCI Backend Configuration - User-space Quirks}
1349 Quirky devices (such as the Broadcom Tigon 3) may need write access to their
1350 configuration space registers. Xen can be instructed to allow specified PCI
1351 devices write access to specific configuration space registers. The policy may
1352 be found in:
1354 \centerline{ \path{/etc/xen/xend-pci-quirks.sxp} }
1356 The policy file is heavily commented and is intended to provide enough
1357 documentation for developers to extend it.
1359 \subsubsection{PCI Backend Configuration - Permissive Flag}
1360 If the user-space quirks approach doesn't meet your needs you may want to enable
1361 the permissive flag for that device. To do so, first get the PCI domain, bus,
1362 slot, and function information from dom0 via \path{lspci}. Then augment the
1363 user-space policy for permissive devices. The permissive policy can be found
1364 in:
1366 \centerline{ \path{/etc/xen/xend-pci-permissive.sxp} }
1368 Currently, the only way to reset the permissive flag is to unbind the device
1369 from the PCI Backend driver.
1371 \subsubsection{PCI Backend - Checking Status}
1372 There two important sysfs nodes that provide a mechanism to view specifics on
1373 quirks and permissive devices:
1374 \begin{description}
1375 \item \path{/sys/bus/drivers/pciback/permissive} \\
1376 Use \path{cat} on this file to view a list of permissive slots.
1377 \item \path{/sys/bus/drivers/pciback/quirks} \\
1378 Use \path{cat} on this file view a hierarchical view of devices bound to the
1379 PCI backend, their PCI vendor/device ID, and any quirks that are associated with
1380 that particular slot.
1381 \end{description}
1383 You may notice that every device bound to the PCI backend has 17 quirks standard
1384 "quirks" regardless of \path{xend-pci-quirks.sxp}. These default entries are
1385 necessary to support interactions between the PCI bus manager and the device bound
1386 to it. Even non-quirky devices should have these standard entries.
1388 In this case, preference was given to accuracy over aesthetics by choosing to
1389 show the standard quirks in the quirks list rather than hide them from the
1390 inquiring user
1392 \subsubsection{PCI Frontend Configuration}
1393 To configure a domU to receive a PCI device:
1395 \begin{description}
1396 \item[Command-line:]
1397 Use the {\em pci} command-line flag. For multiple devices, use the option
1398 multiple times. \\
1399 \centerline{ {\tt xm create netcard-dd pci=01:00.0 pci=02:03.0 }} \\
1401 \item[Flat Format configuration file:]
1402 Specify all of your PCI devices in a python list named {\em pci}. \\
1403 \centerline{ {\tt pci=['01:00.0','02:03.0'] }} \\
1405 \item[SXP Format configuration file:]
1406 Use a single PCI device section for all of your devices (specify the numbers
1407 in hexadecimal with the preceding '0x'). Note that {\em domain} here refers
1408 to the PCI domain, not a virtual machine within Xen.
1409 {\small
1410 \begin{verbatim}
1411 (device (pci
1412 (dev (domain 0x0)(bus 0x3)(slot 0x1a)(func 0x1)
1413 (dev (domain 0x0)(bus 0x1)(slot 0x5)(func 0x0)
1415 \end{verbatim}
1417 \end{description}
1419 %% There are two possible types of privileges: IO privileges and
1420 %% administration privileges.
1422 \section{Support for virtual Trusted Platform Module (vTPM)}
1423 \label{ss:vtpm}
1425 Paravirtualized domains can be given access to a virtualized version
1426 of a TPM. This enables applications in these domains to use the services
1427 of the TPM device for example through a TSS stack
1428 \footnote{Trousers TSS stack:}.
1429 The Xen source repository provides the necessary software components to
1430 enable virtual TPM access. Support is provided through several
1431 different pieces. First, a TPM emulator has been modified to provide TPM's
1432 functionality for the virtual TPM subsystem. Second, a virtual TPM Manager
1433 coordinates the virtual TPMs efforts, manages their creation, and provides
1434 protected key storage using the TPM. Third, a device driver pair providing
1435 a TPM front- and backend is available for XenLinux to deliver TPM commands
1436 from the domain to the virtual TPM manager, which dispatches it to a
1437 software TPM. Since the TPM Manager relies on a HW TPM for protected key
1438 storage, therefore this subsystem requires a Linux-supported hardware TPM.
1439 For development purposes, a TPM emulator is available for use on non-TPM
1440 enabled platforms.
1442 \subsubsection{Compile-Time Setup}
1443 To enable access to the virtual TPM, the virtual TPM backend driver must
1444 be compiled for a privileged domain (e.g. domain 0). Using the XenLinux
1445 configuration, the necessary driver can be selected in the Xen configuration
1446 section. Unless the driver has been compiled into the kernel, its module
1447 must be activated using the following command:
1449 \begin{verbatim}
1450 modprobe tpmbk
1451 \end{verbatim}
1453 Similarly, the TPM frontend driver must be compiled for the kernel trying
1454 to use TPM functionality. Its driver can be selected in the kernel
1455 configuration section Device Driver / Character Devices / TPM Devices.
1456 Along with that the TPM driver for the built-in TPM must be selected.
1457 If the virtual TPM driver has been compiled as module, it
1458 must be activated using the following command:
1460 \begin{verbatim}
1461 modprobe tpm_xenu
1462 \end{verbatim}
1464 Furthermore, it is necessary to build the virtual TPM manager and software
1465 TPM by making changes to entries in Xen build configuration files.
1466 The following entry in the file in the Xen root source
1467 directory must be made:
1469 \begin{verbatim}
1470 VTPM_TOOLS ?= y
1471 \end{verbatim}
1473 After a build of the Xen tree and a reboot of the machine, the TPM backend
1474 drive must be loaded. Once loaded, the virtual TPM manager daemon
1475 must be started before TPM-enabled guest domains may be launched.
1476 To enable being the destination of a virtual TPM Migration, the virtual TPM
1477 migration daemon must also be loaded.
1479 \begin{verbatim}
1480 vtpm_managerd
1481 \end{verbatim}
1482 \begin{verbatim}
1483 vtpm_migratord
1484 \end{verbatim}
1486 Once the VTPM manager is running, the VTPM can be accessed by loading the
1487 front end driver in a guest domain.
1489 \subsubsection{Development and Testing TPM Emulator}
1490 For development and testing on non-TPM enabled platforms, a TPM emulator
1491 can be used in replacement of a platform TPM. First, the entry in the file
1492 tools/vtpm/ must look as follows:
1494 \begin{verbatim}
1496 \end{verbatim}
1498 Second, the entry in the file tool/vtpm\_manager/ must be uncommented
1499 as follows:
1501 \begin{verbatim}
1502 # TCS talks to fifo's rather than /dev/tpm. TPM Emulator assumed on fifos
1504 \end{verbatim}
1506 Before starting the virtual TPM Manager, start the emulator by executing
1507 the following in dom0:
1509 \begin{verbatim}
1510 tpm_emulator clear
1511 \end{verbatim}
1513 \subsubsection{vTPM Frontend Configuration}
1514 To provide TPM functionality to a user domain, a line must be added to
1515 the virtual TPM configuration file using the following format:
1517 \begin{verbatim}
1518 vtpm = ['instance=<instance number>, backend=<domain id>']
1519 \end{verbatim}
1521 The { \it instance number} reflects the preferred virtual TPM instance
1522 to associate with the domain. If the selected instance is
1523 already associated with another domain, the system will automatically
1524 select the next available instance. An instance number greater than
1525 zero must be provided. It is possible to omit the instance
1526 parameter from the configuration file.
1528 The {\it domain id} provides the ID of the domain where the
1529 virtual TPM backend driver and virtual TPM are running in. It should
1530 currently always be set to '0'.
1533 Examples for valid vtpm entries in the configuration file are
1535 \begin{verbatim}
1536 vtpm = ['instance=1, backend=0']
1537 \end{verbatim}
1538 and
1539 \begin{verbatim}
1540 vtpm = ['backend=0'].
1541 \end{verbatim}
1543 \subsubsection{Using the virtual TPM}
1545 Access to TPM functionality is provided by the virtual TPM frontend driver.
1546 Similar to existing hardware TPM drivers, this driver provides basic TPM
1547 status information through the {\it sysfs} filesystem. In a Xen user domain
1548 the sysfs entries can be found in /sys/devices/xen/vtpm-0.
1550 Commands can be sent to the virtual TPM instance using the character
1551 device /dev/tpm0 (major 10, minor 224).
1553 % Chapter Storage and FileSytem Management
1554 \chapter{Storage and File System Management}
1556 Storage can be made available to virtual machines in a number of
1557 different ways. This chapter covers some possible configurations.
1559 The most straightforward method is to export a physical block device (a
1560 hard drive or partition) from dom0 directly to the guest domain as a
1561 virtual block device (VBD).
1563 Storage may also be exported from a filesystem image or a partitioned
1564 filesystem image as a \emph{file-backed VBD}.
1566 Finally, standard network storage protocols such as NBD, iSCSI, NFS,
1567 etc., can be used to provide storage to virtual machines.
1570 \section{Exporting Physical Devices as VBDs}
1571 \label{s:exporting-physical-devices-as-vbds}
1573 One of the simplest configurations is to directly export individual
1574 partitions from domain~0 to other domains. To achieve this use the
1575 \path{phy:} specifier in your domain configuration file. For example a
1576 line like
1577 \begin{quote}
1578 \verb_disk = ['phy:hda3,sda1,w']_
1579 \end{quote}
1580 specifies that the partition \path{/dev/hda3} in domain~0 should be
1581 exported read-write to the new domain as \path{/dev/sda1}; one could
1582 equally well export it as \path{/dev/hda} or \path{/dev/sdb5} should
1583 one wish.
1585 In addition to local disks and partitions, it is possible to export
1586 any device that Linux considers to be ``a disk'' in the same manner.
1587 For example, if you have iSCSI disks or GNBD volumes imported into
1588 domain~0 you can export these to other domains using the \path{phy:}
1589 disk syntax. E.g.:
1590 \begin{quote}
1591 \verb_disk = ['phy:vg/lvm1,sda2,w']_
1592 \end{quote}
1594 \begin{center}
1595 \framebox{\bf Warning: Block device sharing}
1596 \end{center}
1597 \begin{quote}
1598 Block devices should typically only be shared between domains in a
1599 read-only fashion otherwise the Linux kernel's file systems will get
1600 very confused as the file system structure may change underneath
1601 them (having the same ext3 partition mounted \path{rw} twice is a
1602 sure fire way to cause irreparable damage)! \Xend\ will attempt to
1603 prevent you from doing this by checking that the device is not
1604 mounted read-write in domain~0, and hasn't already been exported
1605 read-write to another domain. If you want read-write sharing,
1606 export the directory to other domains via NFS from domain~0 (or use
1607 a cluster file system such as GFS or ocfs2).
1608 \end{quote}
1611 \section{Using File-backed VBDs}
1613 It is also possible to use a file in Domain~0 as the primary storage
1614 for a virtual machine. As well as being convenient, this also has the
1615 advantage that the virtual block device will be \emph{sparse} ---
1616 space will only really be allocated as parts of the file are used. So
1617 if a virtual machine uses only half of its disk space then the file
1618 really takes up half of the size allocated.
1620 For example, to create a 2GB sparse file-backed virtual block device
1621 (actually only consumes 1KB of disk):
1622 \begin{quote}
1623 \verb_# dd if=/dev/zero of=vm1disk bs=1k seek=2048k count=1_
1624 \end{quote}
1626 Make a file system in the disk file:
1627 \begin{quote}
1628 \verb_# mkfs -t ext3 vm1disk_
1629 \end{quote}
1631 (when the tool asks for confirmation, answer `y')
1633 Populate the file system e.g.\ by copying from the current root:
1634 \begin{quote}
1635 \begin{verbatim}
1636 # mount -o loop vm1disk /mnt
1637 # cp -ax /{root,dev,var,etc,usr,bin,sbin,lib} /mnt
1638 # mkdir /mnt/{proc,sys,home,tmp}
1639 \end{verbatim}
1640 \end{quote}
1642 Tailor the file system by editing \path{/etc/fstab},
1643 \path{/etc/hostname}, etc.\ Don't forget to edit the files in the
1644 mounted file system, instead of your domain~0 filesystem, e.g.\ you
1645 would edit \path{/mnt/etc/fstab} instead of \path{/etc/fstab}. For
1646 this example put \path{/dev/sda1} to root in fstab.
1648 Now unmount (this is important!):
1649 \begin{quote}
1650 \verb_# umount /mnt_
1651 \end{quote}
1653 In the configuration file set:
1654 \begin{quote}
1655 \verb_disk = ['tap:aio:/full/path/to/vm1disk,sda1,w']_
1656 \end{quote}
1658 As the virtual machine writes to its `disk', the sparse file will be
1659 filled in and consume more space up to the original 2GB.
1661 {\em{Note:}} Users that have worked with file-backed VBDs on Xen in previous
1662 versions will be interested to know that this support is now provided through
1663 the blktap driver instead of the loopback driver. This change results in
1664 file-based block devices that are higher-performance, more scalable, and which
1665 provide better safety properties for VBD data. All that is required to update
1666 your existing file-backed VM configurations is to change VBD configuration
1667 lines from:
1668 \begin{quote}
1669 \verb_disk = ['file:/full/path/to/vm1disk,sda1,w']_
1670 \end{quote}
1671 to:
1672 \begin{quote}
1673 \verb_disk = ['tap:aio:/full/path/to/vm1disk,sda1,w']_
1674 \end{quote}
1677 \subsection{Loopback-mounted file-backed VBDs (deprecated)}
1679 {\em{{\bf{Note:}} Loopback mounted VBDs have now been replaced with
1680 blktap-based support for raw image files, as described above. This
1681 section remains to detail a configuration that was used by older Xen
1682 versions.}}
1684 Raw image file-backed VBDs may also be attached to VMs using the
1685 Linux loopback driver. The only required change to the raw file
1686 instructions above are to specify the configuration entry as:
1687 \begin{quote}
1688 \verb_disk = ['file:/full/path/to/vm1disk,sda1,w']_
1689 \end{quote}
1691 {\bf Note that loopback file-backed VBDs may not be appropriate for backing
1692 I/O-intensive domains.} This approach is known to experience
1693 substantial slowdowns under heavy I/O workloads, due to the I/O
1694 handling by the loopback block device used to support file-backed VBDs
1695 in dom0. Loopback support remains for old Xen installations, and users
1696 are strongly encouraged to use the blktap-based file support (using
1697 ``{\tt{tap:aio}}'' as described above).
1699 Additionally, Linux supports a maximum of eight loopback file-backed
1700 VBDs across all domains by default. This limit can be statically
1701 increased by using the \emph{max\_loop} module parameter if
1702 CONFIG\_BLK\_DEV\_LOOP is compiled as a module in the dom0 kernel, or
1703 by using the \emph{max\_loop=n} boot option if CONFIG\_BLK\_DEV\_LOOP
1704 is compiled directly into the dom0 kernel. Again, users are encouraged
1705 to use the blktap-based file support described above which scales to much
1706 larger number of active VBDs.
1709 \section{Using LVM-backed VBDs}
1710 \label{s:using-lvm-backed-vbds}
1712 A particularly appealing solution is to use LVM volumes as backing for
1713 domain file-systems since this allows dynamic growing/shrinking of
1714 volumes as well as snapshot and other features.
1716 To initialize a partition to support LVM volumes:
1717 \begin{quote}
1718 \begin{verbatim}
1719 # pvcreate /dev/sda10
1720 \end{verbatim}
1721 \end{quote}
1723 Create a volume group named `vg' on the physical partition:
1724 \begin{quote}
1725 \begin{verbatim}
1726 # vgcreate vg /dev/sda10
1727 \end{verbatim}
1728 \end{quote}
1730 Create a logical volume of size 4GB named `myvmdisk1':
1731 \begin{quote}
1732 \begin{verbatim}
1733 # lvcreate -L4096M -n myvmdisk1 vg
1734 \end{verbatim}
1735 \end{quote}
1737 You should now see that you have a \path{/dev/vg/myvmdisk1} Make a
1738 filesystem, mount it and populate it, e.g.:
1739 \begin{quote}
1740 \begin{verbatim}
1741 # mkfs -t ext3 /dev/vg/myvmdisk1
1742 # mount /dev/vg/myvmdisk1 /mnt
1743 # cp -ax / /mnt
1744 # umount /mnt
1745 \end{verbatim}
1746 \end{quote}
1748 Now configure your VM with the following disk configuration:
1749 \begin{quote}
1750 \begin{verbatim}
1751 disk = [ 'phy:vg/myvmdisk1,sda1,w' ]
1752 \end{verbatim}
1753 \end{quote}
1755 LVM enables you to grow the size of logical volumes, but you'll need
1756 to resize the corresponding file system to make use of the new space.
1757 Some file systems (e.g.\ ext3) now support online resize. See the LVM
1758 manuals for more details.
1760 You can also use LVM for creating copy-on-write (CoW) clones of LVM
1761 volumes (known as writable persistent snapshots in LVM terminology).
1762 This facility is new in Linux 2.6.8, so isn't as stable as one might
1763 hope. In particular, using lots of CoW LVM disks consumes a lot of
1764 dom0 memory, and error conditions such as running out of disk space
1765 are not handled well. Hopefully this will improve in future.
1767 To create two copy-on-write clones of the above file system you would
1768 use the following commands:
1770 \begin{quote}
1771 \begin{verbatim}
1772 # lvcreate -s -L1024M -n myclonedisk1 /dev/vg/myvmdisk1
1773 # lvcreate -s -L1024M -n myclonedisk2 /dev/vg/myvmdisk1
1774 \end{verbatim}
1775 \end{quote}
1777 Each of these can grow to have 1GB of differences from the master
1778 volume. You can grow the amount of space for storing the differences
1779 using the lvextend command, e.g.:
1780 \begin{quote}
1781 \begin{verbatim}
1782 # lvextend +100M /dev/vg/myclonedisk1
1783 \end{verbatim}
1784 \end{quote}
1786 Don't let the `differences volume' ever fill up otherwise LVM gets
1787 rather confused. It may be possible to automate the growing process by
1788 using \path{dmsetup wait} to spot the volume getting full and then
1789 issue an \path{lvextend}.
1791 In principle, it is possible to continue writing to the volume that
1792 has been cloned (the changes will not be visible to the clones), but
1793 we wouldn't recommend this: have the cloned volume as a `pristine'
1794 file system install that isn't mounted directly by any of the virtual
1795 machines.
1798 \section{Using NFS Root}
1800 First, populate a root filesystem in a directory on the server
1801 machine. This can be on a distinct physical machine, or simply run
1802 within a virtual machine on the same node.
1804 Now configure the NFS server to export this filesystem over the
1805 network by adding a line to \path{/etc/exports}, for instance:
1807 \begin{quote}
1808 \begin{small}
1809 \begin{verbatim}
1810 /export/vm1root (rw,sync,no_root_squash)
1811 \end{verbatim}
1812 \end{small}
1813 \end{quote}
1815 Finally, configure the domain to use NFS root. In addition to the
1816 normal variables, you should make sure to set the following values in
1817 the domain's configuration file:
1819 \begin{quote}
1820 \begin{small}
1821 \begin{verbatim}
1822 root = '/dev/nfs'
1823 nfs_server = '' # substitute IP address of server
1824 nfs_root = '/path/to/root' # path to root FS on the server
1825 \end{verbatim}
1826 \end{small}
1827 \end{quote}
1829 The domain will need network access at boot time, so either statically
1830 configure an IP address using the config variables \path{ip},
1831 \path{netmask}, \path{gateway}, \path{hostname}; or enable DHCP
1832 (\path{dhcp='dhcp'}).
1834 Note that the Linux NFS root implementation is known to have stability
1835 problems under high load (this is not a Xen-specific problem), so this
1836 configuration may not be appropriate for critical servers.
1839 \chapter{CPU Management}
1841 %% KMS Something sage about CPU / processor management.
1843 Xen allows a domain's virtual CPU(s) to be associated with one or more
1844 host CPUs. This can be used to allocate real resources among one or
1845 more guests, or to make optimal use of processor resources when
1846 utilizing dual-core, hyperthreading, or other advanced CPU technologies.
1848 Xen enumerates physical CPUs in a `depth first' fashion. For a system
1849 with both hyperthreading and multiple cores, this would be all the
1850 hyperthreads on a given core, then all the cores on a given socket,
1851 and then all sockets. I.e. if you had a two socket, dual core,
1852 hyperthreaded Xeon the CPU order would be:
1855 \begin{center}
1856 \begin{tabular}{l|l|l|l|l|l|l|r}
1857 \multicolumn{4}{c|}{socket0} & \multicolumn{4}{c}{socket1} \\ \hline
1858 \multicolumn{2}{c|}{core0} & \multicolumn{2}{c|}{core1} &
1859 \multicolumn{2}{c|}{core0} & \multicolumn{2}{c}{core1} \\ \hline
1860 ht0 & ht1 & ht0 & ht1 & ht0 & ht1 & ht0 & ht1 \\
1861 \#0 & \#1 & \#2 & \#3 & \#4 & \#5 & \#6 & \#7 \\
1862 \end{tabular}
1863 \end{center}
1866 Having multiple vcpus belonging to the same domain mapped to the same
1867 physical CPU is very likely to lead to poor performance. It's better to
1868 use `vcpus-set' to hot-unplug one of the vcpus and ensure the others are
1869 pinned on different CPUs.
1871 If you are running IO intensive tasks, its typically better to dedicate
1872 either a hyperthread or whole core to running domain 0, and hence pin
1873 other domains so that they can't use CPU 0. If your workload is mostly
1874 compute intensive, you may want to pin vcpus such that all physical CPU
1875 threads are available for guest domains.
1877 \chapter{Migrating Domains}
1879 \section{Domain Save and Restore}
1881 The administrator of a Xen system may suspend a virtual machine's
1882 current state into a disk file in domain~0, allowing it to be resumed at
1883 a later time.
1885 For example you can suspend a domain called ``VM1'' to disk using the
1886 command:
1887 \begin{verbatim}
1888 # xm save VM1 VM1.chk
1889 \end{verbatim}
1891 This will stop the domain named ``VM1'' and save its current state
1892 into a file called \path{VM1.chk}.
1894 To resume execution of this domain, use the \path{xm restore} command:
1895 \begin{verbatim}
1896 # xm restore VM1.chk
1897 \end{verbatim}
1899 This will restore the state of the domain and resume its execution.
1900 The domain will carry on as before and the console may be reconnected
1901 using the \path{xm console} command, as described earlier.
1903 \section{Migration and Live Migration}
1905 Migration is used to transfer a domain between physical hosts. There
1906 are two varieties: regular and live migration. The former moves a
1907 virtual machine from one host to another by pausing it, copying its
1908 memory contents, and then resuming it on the destination. The latter
1909 performs the same logical functionality but without needing to pause
1910 the domain for the duration. In general when performing live migration
1911 the domain continues its usual activities and---from the user's
1912 perspective---the migration should be imperceptible.
1914 To perform a live migration, both hosts must be running Xen / \xend\ and
1915 the destination host must have sufficient resources (e.g.\ memory
1916 capacity) to accommodate the domain after the move. Furthermore we
1917 currently require both source and destination machines to be on the same
1918 L2 subnet.
1920 Currently, there is no support for providing automatic remote access
1921 to filesystems stored on local disk when a domain is migrated.
1922 Administrators should choose an appropriate storage solution (i.e.\
1923 SAN, NAS, etc.) to ensure that domain filesystems are also available
1924 on their destination node. GNBD is a good method for exporting a
1925 volume from one machine to another. iSCSI can do a similar job, but is
1926 more complex to set up.
1928 When a domain migrates, it's MAC and IP address move with it, thus it is
1929 only possible to migrate VMs within the same layer-2 network and IP
1930 subnet. If the destination node is on a different subnet, the
1931 administrator would need to manually configure a suitable etherip or IP
1932 tunnel in the domain~0 of the remote node.
1934 A domain may be migrated using the \path{xm migrate} command. To live
1935 migrate a domain to another machine, we would use the command:
1937 \begin{verbatim}
1938 # xm migrate --live mydomain
1939 \end{verbatim}
1941 Without the \path{--live} flag, \xend\ simply stops the domain and
1942 copies the memory image over to the new node and restarts it. Since
1943 domains can have large allocations this can be quite time consuming,
1944 even on a Gigabit network. With the \path{--live} flag \xend\ attempts
1945 to keep the domain running while the migration is in progress, resulting
1946 in typical down times of just 60--300ms.
1948 For now it will be necessary to reconnect to the domain's console on the
1949 new machine using the \path{xm console} command. If a migrated domain
1950 has any open network connections then they will be preserved, so SSH
1951 connections do not have this limitation.
1954 %% Chapter Securing Xen
1955 \chapter{Securing Xen}
1957 This chapter describes how to secure a Xen system. It describes a number
1958 of scenarios and provides a corresponding set of best practices. It
1959 begins with a section devoted to understanding the security implications
1960 of a Xen system.
1963 \section{Xen Security Considerations}
1965 When deploying a Xen system, one must be sure to secure the management
1966 domain (Domain-0) as much as possible. If the management domain is
1967 compromised, all other domains are also vulnerable. The following are a
1968 set of best practices for Domain-0:
1970 \begin{enumerate}
1971 \item \textbf{Run the smallest number of necessary services.} The less
1972 things that are present in a management partition, the better.
1973 Remember, a service running as root in the management domain has full
1974 access to all other domains on the system.
1975 \item \textbf{Use a firewall to restrict the traffic to the management
1976 domain.} A firewall with default-reject rules will help prevent
1977 attacks on the management domain.
1978 \item \textbf{Do not allow users to access Domain-0.} The Linux kernel
1979 has been known to have local-user root exploits. If you allow normal
1980 users to access Domain-0 (even as unprivileged users) you run the risk
1981 of a kernel exploit making all of your domains vulnerable.
1982 \end{enumerate}
1984 \section{Driver Domain Security Considerations}
1985 \label{s:ddsecurity}
1987 Driver domains address a range of security problems that exist regarding
1988 the use of device drivers and hardware. On many operating systems in common
1989 use today, device drivers run within the kernel with the same privileges as
1990 the kernel. Few or no mechanisms exist to protect the integrity of the kernel
1991 from a misbehaving (read "buggy") or malicious device driver. Driver
1992 domains exist to aid in isolating a device driver within its own virtual
1993 machine where it cannot affect the stability and integrity of other
1994 domains. If a driver crashes, the driver domain can be restarted rather than
1995 have the entire machine crash (and restart) with it. Drivers written by
1996 unknown or untrusted third-parties can be confined to an isolated space.
1997 Driver domains thus address a number of security and stability issues with
1998 device drivers.
2000 However, due to limitations in current hardware, a number of security
2001 concerns remain that need to be considered when setting up driver domains (it
2002 should be noted that the following list is not intended to be exhaustive).
2004 \begin{enumerate}
2005 \item \textbf{Without an IOMMU, a hardware device can DMA to memory regions
2006 outside of its controlling domain.} Architectures which do not have an
2007 IOMMU (e.g. most x86-based platforms) to restrict DMA usage by hardware
2008 are vulnerable. A hardware device which can perform arbitrary memory reads
2009 and writes can read/write outside of the memory of its controlling domain.
2010 A malicious or misbehaving domain could use a hardware device it controls
2011 to send data overwriting memory in another domain or to read arbitrary
2012 regions of memory in another domain.
2013 \item \textbf{Shared buses are vulnerable to sniffing.} Devices that share
2014 a data bus can sniff (and possible spoof) each others' data. Device A that
2015 is assigned to Domain A could eavesdrop on data being transmitted by
2016 Domain B to Device B and then relay that data back to Domain A.
2017 \item \textbf{Devices which share interrupt lines can either prevent the
2018 reception of that interrupt by the driver domain or can trigger the
2019 interrupt service routine of that guest needlessly.} A devices which shares
2020 a level-triggered interrupt (e.g. PCI devices) with another device can
2021 raise an interrupt and never clear it. This effectively blocks other devices
2022 which share that interrupt line from notifying their controlling driver
2023 domains that they need to be serviced. A device which shares an
2024 any type of interrupt line can trigger its interrupt continually which
2025 forces execution time to be spent (in multiple guests) in the interrupt
2026 service routine (potentially denying time to other processes within that
2027 guest). System architectures which allow each device to have its own
2028 interrupt line (e.g. PCI's Message Signaled Interrupts) are less
2029 vulnerable to this denial-of-service problem.
2030 \item \textbf{Devices may share the use of I/O memory address space.} Xen can
2031 only restrict access to a device's physical I/O resources at a certain
2032 granularity. For interrupt lines and I/O port address space, that
2033 granularity is very fine (per interrupt line and per I/O port). However,
2034 Xen can only restrict access to I/O memory address space on a page size
2035 basis. If more than one device shares use of a page in I/O memory address
2036 space, the domains to which those devices are assigned will be able to
2037 access the I/O memory address space of each other's devices.
2038 \end{enumerate}
2041 \section{Security Scenarios}
2044 \subsection{The Isolated Management Network}
2046 In this scenario, each node has two network cards in the cluster. One
2047 network card is connected to the outside world and one network card is a
2048 physically isolated management network specifically for Xen instances to
2049 use.
2051 As long as all of the management partitions are trusted equally, this is
2052 the most secure scenario. No additional configuration is needed other
2053 than forcing Xend to bind to the management interface for relocation.
2056 \subsection{A Subnet Behind a Firewall}
2058 In this scenario, each node has only one network card but the entire
2059 cluster sits behind a firewall. This firewall should do at least the
2060 following:
2062 \begin{enumerate}
2063 \item Prevent IP spoofing from outside of the subnet.
2064 \item Prevent access to the relocation port of any of the nodes in the
2065 cluster except from within the cluster.
2066 \end{enumerate}
2068 The following iptables rules can be used on each node to prevent
2069 migrations to that node from outside the subnet assuming the main
2070 firewall does not do this for you:
2072 \begin{verbatim}
2073 # this command disables all access to the Xen relocation
2074 # port:
2075 iptables -A INPUT -p tcp --destination-port 8002 -j REJECT
2077 # this command enables Xen relocations only from the specific
2078 # subnet:
2079 iptables -I INPUT -p tcp -{}-source \
2080 --destination-port 8002 -j ACCEPT
2081 \end{verbatim}
2083 \subsection{Nodes on an Untrusted Subnet}
2085 Migration on an untrusted subnet is not safe in current versions of Xen.
2086 It may be possible to perform migrations through a secure tunnel via an
2087 VPN or SSH. The only safe option in the absence of a secure tunnel is to
2088 disable migration completely. The easiest way to do this is with
2089 iptables:
2091 \begin{verbatim}
2092 # this command disables all access to the Xen relocation port
2093 iptables -A INPUT -p tcp -{}-destination-port 8002 -j REJECT
2094 \end{verbatim}
2096 %% Chapter Xen Mandatory Access Control Framework
2097 \chapter{sHype/Xen Access Control}
2099 The Xen mandatory access control framework is an implementation of the
2100 sHype Hypervisor Security Architecture
2101 (\_shype). It permits or denies communication
2102 and resource access of domains based on a security policy. The
2103 mandatory access controls are enforced in addition to the Xen core
2104 controls, such as memory protection. They are designed to remain
2105 transparent during normal operation of domains (policy-conform
2106 behavior) but to intervene when domains move outside their intended
2107 sharing behavior. This chapter will describe how the sHype access
2108 controls in Xen can be configured to prevent viruses from spilling
2109 over from one into another workload type and secrets from leaking from
2110 one workload type to another. sHype/Xen depends on the correct
2111 behavior of Domain0 (cf previous chapter).
2113 Benefits of configuring sHype/ACM in Xen include:
2114 \begin{itemize}
2115 \item robust workload and resource protection effective against rogue
2116 user domains
2117 \item simple, platform- and operating system-independent security
2118 policies (ideal for heterogeneous distributed environments)
2119 \item safety net with minimal performance overhead in case operating
2120 system security is missing, does not scale, or fails
2121 \end{itemize}
2123 These benefits are very valuable because today's operating systems
2124 become increasingly complex and often have no or insufficient
2125 mandatory access controls. (Discretionary access controls, supported
2126 by of most operating systems, are not effective against viruses or
2127 misbehaving programs.) Where mandatory access control exists (e.g.,
2128 SELinux), they usually deploy complex and difficult to understand
2129 security policies. Additionally, multi-tier applications in business
2130 environments usually require different types of operating systems
2131 (e.g., AIX, Windows, Linux) which cannot be configured with compatible
2132 security policies. Related distributed transactions and workloads
2133 cannot be easily protected on the OS level. The Xen access control
2134 framework steps in to offer a coarse-grained but very robust security
2135 layer and safety net in case operating system security fails or is
2136 missing.
2138 To control sharing between domains, Xen mediates all inter-domain
2139 communication (shared memory, events) as well as the access of domains
2140 to resources such as disks. Thus, Xen can confine distributed
2141 workloads (domain payloads) by permitting sharing among domains
2142 running the same type of workload and denying sharing between pairs of
2143 domains that run different workload types. We assume that--from a Xen
2144 perspective--only one workload type is running per user domain. To
2145 enable Xen to associate domains and resources with workload types,
2146 security labels including the workload types are attached to domains
2147 and resources. These labels and the hypervisor sHype controls cannot
2148 be manipulated or bypassed and are effective even against rogue
2149 domains.
2151 \section{Overview}
2152 This section gives an overview of how workloads can be protected using
2153 the sHype mandatory access control framework in Xen.
2154 Figure~\ref{fig:acmoverview} shows the necessary steps in activating
2155 the Xen workload protection. These steps are described in detail in
2156 Section~\ref{section:acmexample}.
2158 \begin{figure}
2159 \centering
2160 \includegraphics[width=13cm]{figs/acm_overview.eps}
2161 \caption{Overview of activating sHype workload protection in Xen.
2162 Section numbers point to representative examples.}
2163 \label{fig:acmoverview}
2164 \end{figure}
2166 First, the sHype/ACM access control must be enabled in the Xen
2167 distribution and the distribution must be built and installed (cf
2168 Subsection~\ref{subsection:acmexampleconfigure}). Before we can
2169 enforce security, a Xen security policy must be created (cf
2170 Subsection~\ref{subsection:acmexamplecreate}) and deployed (cf
2171 Subsection~\ref{subsection:acmexampleinstall}). This policy defines
2172 the workload types differentiated during access control. It also
2173 defines the rules that compare workload types of domains and resources
2174 to provide access decisions. Workload types are represented by
2175 security labels that can be attached to domains and resources (cf
2176 Subsections~\ref{subsection:acmexamplelabeldomains}
2177 and~\ref{subsection:acmexamplelabelresources}). The functioning of
2178 the active sHype/Xen workload protection is demonstrated using simple
2179 resource assignment, and domain creation tests in
2180 Subsection~\ref{subsection:acmexampletest}.
2181 Section~\ref{section:acmpolicy} describes the syntax and semantics of
2182 the sHype/Xen security policy in detail and introduces briefly the
2183 tools that are available to help create valid security policies.
2185 The next section describes all the necessary steps to create, deploy,
2186 and test a simple workload protection policy. It is meant to enable
2187 anybody to quickly try out the sHype/Xen workload protection. Those
2188 readers who are interested in learning more about how the sHype access
2189 control in Xen works and how it is configured using the XML security
2190 policy should read Section~\ref{section:acmpolicy} as well.
2191 Section~\ref{section:acmlimitations} concludes this chapter with
2192 current limitations of the sHype implementation for Xen.
2194 \section{Xen Workload Protection Step-by-Step}
2195 \label{section:acmexample}
2197 What you are about to do consists of the following sequence:
2198 \begin{itemize}
2199 \item configure and install sHype/Xen
2200 \item create a simple workload protection security policy
2201 \item deploy the sHype/Xen security policy
2202 \item associate domains and resources with workload labels,
2203 \item test the workload protection
2204 \end{itemize}
2205 The essential commands to create and deploy a sHype/Xen security
2206 policy are numbered throughout the following sections. If you want a
2207 quick-guide or return at a later time to go quickly through this
2208 demonstration, simply look for the numbered commands and apply them in
2209 order.
2211 \subsection{Configuring/Building sHype Support into Xen}
2212 \label{subsection:acmexampleconfigure}
2213 First, we need to configure the access control module in Xen and
2214 install the ACM-enabled Xen hypervisor. This step installs security
2215 tools and compiles sHype/ACM controls into the Xen hypervisor.
2217 To enable sHype/ACM in Xen, please edit the file in the top
2218 Xen directory.
2220 \begin{verbatim}
2221 (1) In
2222 Change: ACM_SECURITY ?= n
2223 To: ACM_SECURITY ?= y
2224 \end{verbatim}
2226 Then install the security-enabled Xen environment as follows:
2228 \begin{verbatim}
2229 (2) # make world
2230 # make install
2231 \end{verbatim}
2233 \subsection{Creating A WLP Policy in 3 Simple Steps with ezPolicy}
2234 \label{subsection:acmexamplecreate}
2236 We will use the ezPolicy tool to quickly create a policy that protects
2237 workloads. You will need both the Python and wxPython packages to run
2238 this tool. To run the tool in Domain0, you can download the wxPython
2239 package from or use the command
2240 \verb|yum install wxPython| in Redhat/Fedora. To run the tool on MS
2241 Windows, you also need to download the Python package from
2242 After these packages are installed, start the ezPolicy
2243 tool with the following command:
2245 \begin{verbatim}
2246 (3) # xensec_ezpolicy
2247 \end{verbatim}
2249 Figure~\ref{fig:acmezpolicy} shows a screen-shot of the tool. The
2250 following steps show you how to create the policy shown in
2251 Figure~\ref{fig:acmezpolicy}. You can use \verb|<CTRL>-h| to pop up a
2252 help window at any time. The indicators (a), (b), and (c) in
2253 Figure~\ref{fig:acmezpolicy} show the buttons that are used during the
2254 3 steps of creating a policy:
2255 \begin{enumerate}
2256 \item defining workloads
2257 \item defining run-time conflicts
2258 \item translating the workload definition into a sHype/Xen access
2259 control policy
2260 \end{enumerate}
2262 \paragraph{Defining workloads.} Workloads are defined for each
2263 organization and department that you enter in the left panel. Please
2264 use the ``New Org'' button (a) to create the organizations ``Avis'',
2265 ``Hertz'', ``CocaCola'', and ``PepsiCo''.
2267 You can refine an organization to differentiate between multiple
2268 department workloads by right-clicking the organization and selecting
2269 \verb|Add Department| (or selecting an organization and pressing
2270 \verb|<CRTL>-a|). Create department workloads ``Intranet'',
2271 ``Extranet'', ``HumanResources'', and ``Payroll'' for the ``CocaCola''
2272 organization and department workloads ``Intranet'' and ``Extranet''
2273 for the ``PepsiCo'' organization. The resulting layout of the tool
2274 should be similar to the left panel shown in
2275 Figure~\ref{fig:acmezpolicy}.
2277 \paragraph{Defining run-time conflicts.} Workloads that shall be
2278 prohibited from running concurrently on the same hypervisor platform
2279 are grouped into ``Run-time Exclusion rules'' on the right panel of
2280 the window.
2282 To prevent PepsiCo and CocaCola workloads (including their
2283 departmental workloads) from running simultaneously on the same
2284 hypervisor system, select the organization ``PepsiCo'' and, while
2285 pressing the \verb|<CTRL>|-key, select the organization ``CocaCola''.
2286 Now press the button (b) named ``Create run-time exclusion rule from
2287 selection''. A popup window will ask for the name for this run-time
2288 exclusion rule (enter a name or just hit \verb|<ENTER>|). A rule will
2289 appear on the right panel. The name is used as reference only and does
2290 not affect the hypervisor policy.
2292 Repeat the process to create a run-time exclusion rule just for the
2293 department workloads CocaCola.Extranet and CocaCola.Payroll.
2295 \begin{figure}[htb]
2296 \centering
2297 \includegraphics[width=13cm]{figs/acm_ezpolicy.eps}
2298 \caption{Final layout including workload definition and Run-time Exclusion rules.}
2299 \label{fig:acmezpolicy}
2300 \end{figure}
2302 The resulting layout of your window should be similar to
2303 Figure~\ref{fig:acmezpolicy}. Save this workload definition by
2304 selecting ``Save Workload Definition as ...'' in the ``File'' menu
2305 (c). This workload definition can be later refined if required.
2307 \paragraph{Translating the workload definition into a sHype/Xen access
2308 control policy.} To translate the workload definition into a access
2309 control policy understood by Xen, please select the ``Save as Xen ACM
2310 Security Policy'' in the ``File'' menu (c). Enter the following policy
2311 name in the popup window: \verb|example.chwall_ste.test-wld|. If you
2312 are running ezPolicy in Domain0, the resulting policy file
2313 test-wld\_security-policy.xml will automatically be placed into the
2314 right directory (/etc/xen/acm-security/ policies/example/chwall\_ste).
2315 If you run the tool on another system, then you need to copy the
2316 resulting policy file into Domain0 before continuing. See
2317 Section~\ref{subsection:acmnaming} for naming conventions of security
2318 policies.
2320 \subsection{Deploying a WLP Policy}
2321 \label{subsection:acmexampleinstall}
2322 To deploy the workload protection policy we created in
2323 Section~\ref{subsection:acmexamplecreate}, we create a policy
2324 representation (test-wld.bin) that can be loaded into the Xen
2325 hypervisor and we configure Xen to actually load this policy at
2326 startup time.
2328 The following command translates the source policy representation
2329 into a format that can be loaded into Xen with sHype/ACM support.
2330 Refer to the \verb|xm| man page for further details:
2332 \begin{verbatim}
2333 (4) # xm makepolicy example.chwall_ste.test-wld
2334 \end{verbatim}
2336 The easiest way to install a security policy for Xen is to include the
2337 policy in the boot sequence. The following command does just this:
2339 \begin{verbatim}
2340 (5) # xm cfgbootpolicy example.chwall_ste.test-wld
2341 \end{verbatim}
2343 \textit{Alternatively, if this command fails} (e.g., because it cannot
2344 identify the Xen boot entry), you can manually install the policy in 2
2345 steps. First, manually copy the policy binary file into the boot
2346 directory:
2348 \begin{scriptsize}
2349 \begin{verbatim}
2350 # cp /etc/xen/acm-security/policies/example/chwall_ste/test-wld.bin \
2351 /boot/example.chwall_ste.test-wld.bin
2352 \end{verbatim}
2353 \end{scriptsize}
2355 Second, manually add a module line to your Xen boot entry so that grub
2356 loads this policy file during startup:
2358 \begin{scriptsize}
2359 \begin{verbatim}
2360 title Xen (
2361 root (hd0,0)
2362 kernel /xen.gz dom0_mem=2000000 console=vga
2363 module /vmlinuz- ro root=/dev/hda3
2364 module /initrd-
2365 module /example.chwall_ste.test-wld.bin
2366 \end{verbatim}
2367 \end{scriptsize}
2369 Now reboot into this Xen boot entry to activate the policy and the
2370 security-enabled Xen hypervisor.
2372 \begin{verbatim}
2373 (6) # reboot
2374 \end{verbatim}
2376 After reboot, check if security is enabled:
2378 \begin{scriptsize}
2379 \begin{verbatim}
2380 # xm list --label
2381 Name ID Mem(MiB) VCPUs State Time(s) Label
2382 Domain-0 0 1949 4 r----- 163.9 SystemManagement
2383 \end{verbatim}
2384 \end{scriptsize}
2386 If the security label at the end of the line says ``INACTIV'' then the
2387 security is not enabled. Verify the previous steps. Note: Domain0 is
2388 assigned a default label (see \verb|bootstrap| policy attribute
2389 explained in Section~\ref{section:acmpolicy}). All other domains must
2390 be labeled in order to start on this sHype/ACM-enabled Xen hypervisor
2391 (see following sections for labeling domains and resources).
2393 \subsection{Labeling Domains}
2394 \label{subsection:acmexamplelabeldomains}
2395 You should have a Xen domain configuration file that looks like the
2396 following (Note: or might be good
2397 places to look for example domU images). The following configuration
2398 file defines \verb|domain1|:
2400 \begin{scriptsize}
2401 \begin{verbatim}
2402 # cat domain1.xm
2403 kernel = "/boot/vmlinuz-"
2404 memory = 128
2405 name = "domain1"
2406 vif = [ '' ]
2407 dhcp = "dhcp"
2408 disk = ['file:/home/xen/dom_fc5/fedora.fc5.img,sda1,w', \
2409 'file:/home/xen/dom_fc5/fedora.swap,sda2,w']
2410 root = "/dev/sda1 ro"
2411 \end{verbatim}
2412 \end{scriptsize}
2414 If you try to start domain1, you will get the following error:
2416 \begin{scriptsize}
2417 \begin{verbatim}
2418 # xm create domain1.xm
2419 Using config file "domain1.xm".
2420 domain1: DENIED
2421 --> Domain not labeled
2422 Checking resources: (skipped)
2423 Security configuration prevents domain from starting
2424 \end{verbatim}
2425 \end{scriptsize}
2427 Every domain must be associated with a security label before it can
2428 start on sHype/Xen. Otherwise, sHype/Xen would not be able to enforce
2429 the policy consistently. The following command prints all domain
2430 labels available in the active policy:
2432 \begin{scriptsize}
2433 \begin{verbatim}
2434 # xm labels type=dom
2435 Avis
2436 CocaCola
2437 CocaCola.Extranet
2438 CocaCola.HumanResources
2439 CocaCola.Intranet
2440 CocaCola.Payroll
2441 Hertz
2442 PepsiCo
2443 PepsiCo.Extranet
2444 PepsiCo.Intranet
2445 SystemManagement
2446 \end{verbatim}
2447 \end{scriptsize}
2449 Now label domain1 with the CocaCola label and another domain2 with the
2450 PepsiCo.Extranet label. Please refer to the xm man page for further
2451 information.
2453 \begin{verbatim}
2454 (7) # xm addlabel CocaCola dom domain1.xm
2455 # xm addlabel PepsiCo.Extranet dom domain2.xm
2456 \end{verbatim}
2458 Let us try to start the domain again:
2460 \begin{scriptsize}
2461 \begin{verbatim}
2462 # xm create domain1.xm
2463 Using config file "domain1.xm".
2464 file:/home/xen/dom_fc5/fedora.fc5.img: DENIED
2465 --> res:__NULL_LABEL__ (NULL)
2466 --> dom:CocaCola (example.chwall_ste.test-wld)
2467 file:/home/xen/dom_fc5/fedora.swap: DENIED
2468 --> res:__NULL_LABEL__ (NULL)
2469 --> dom:CocaCola (example.chwall_ste.test-wld)
2470 Security configuration prevents domain from starting
2471 \end{verbatim}
2472 \end{scriptsize}
2474 This error indicates that domain1, if started, would not be able to
2475 access its image and swap files because they are not labeled. This
2476 makes sense because to confine workloads, access of domains to
2477 resources must be controlled. Otherwise, domains that are not allowed
2478 to communicate or run simultaneously could share data through storage
2479 resources.
2481 \subsection{Labeling Resources}
2482 \label{subsection:acmexamplelabelresources}
2483 You can use the \verb|xm labels type=res| command to list available
2484 resource labels. Let us assign the CocaCola resource label to the domain1
2485 image file representing \verb|/dev/sda1| and to its swap file:
2487 \begin{verbatim}
2488 (8) # xm addlabel CocaCola res \
2489 file:/home/xen/dom_fc5/fedora.fc5.img
2490 Resource file not found, creating new file at:
2491 /etc/xen/acm-security/policies/resource_labels
2492 # xm addlabel CocaCola res \
2493 file:/home/xen/dom_fc5/fedora.swap
2494 \end{verbatim}
2496 Starting \verb|domain1| now will succeed:
2498 \begin{scriptsize}
2499 \begin{verbatim}
2500 # xm create domain1.xm
2501 # xm list --label
2502 Name ID Mem(MiB) VCPUs State Time(s) Label
2503 domain1 1 128 1 r----- 2.8 CocaCola
2504 Domain-0 0 1949 4 r----- 387.7 SystemManagement
2505 \end{verbatim}
2506 \end{scriptsize}
2508 The following command lists all labeled resources on the
2509 system, e.g., to lookup or verify the labeling:
2511 \begin{scriptsize}
2512 \begin{verbatim}
2513 # xm resources
2514 file:/home/xen/dom_fc5/fedora.swap
2515 policy: example.chwall_ste.test-wld
2516 label: CocaCola
2517 file:/home/xen/dom_fc5/fedora.fc5.img
2518 policy: example.chwall_ste.test-wld
2519 label: CocaCola
2520 \end{verbatim}
2521 \end{scriptsize}
2523 Currently, if a labeled resource is moved to another location, the
2524 label must first be manually removed, and after the move re-attached
2525 using the xm commands \verb|xm rmlabel| and \verb|xm addlabel|
2526 respectively. Please see Section~\ref{section:acmlimitations} for
2527 further details.
2529 \begin{verbatim}
2530 (9) Label the resources of domain2 as PepsiCo.Extranet
2531 Do not try to start this domain yet
2532 \end{verbatim}
2534 \subsection{Testing The Xen Workload Protection}
2535 \label{subsection:acmexampletest}
2536 We are about to demonstrate how the workload protection works by
2537 verifying:
2538 \begin{itemize}
2539 \item that domains with conflicting workloads cannot run
2540 simultaneously
2541 \item that domains cannot access resources of other workloads
2542 \item that domains cannot exchange network packets if they are not
2543 associated with the same workload type
2544 \end{itemize}
2546 \paragraph{Test 1: Run-time exclusion rules.} We assume that domain1
2547 with the CocaCola label is still running. While domain1 is running,
2548 the run-time exclusion set of our policy says that domain2 cannot
2549 start because the label of domain1 includes the CHWALL type CocaCola
2550 and the label of domain2 includes the CHWALL type PepsiCo. The
2551 run-time exclusion rule of our policy enforces that PepsiCo and
2552 CocaCola cannot run at the same time on the same hypervisor platform.
2553 Once domain1 is stopped or saved, domain2 can start but domain1 can no
2554 longer start or be resumed. The ezPolicy tool, when creating the
2555 Chinese Wall types for the workload labels, ensures that department
2556 workloads inherit the organization type (and with it any organization
2557 exclusions).
2559 \begin{scriptsize}
2560 \begin{verbatim}
2561 # xm list --label
2562 Name ID Mem(MiB) VCPUs State Time(s) Label
2563 domain1 2 128 1 -b---- 6.9 CocaCola
2564 Domain-0 0 1949 4 r----- 273.1 SystemManagement
2566 # xm create domain2.xm
2567 Using config file "domain2.xm".
2568 Error: (1, 'Operation not permitted')
2570 # xm destroy domain1
2571 # xm create domain2.xm
2572 Using config file "domain2.xm".
2573 Started domain domain2
2575 # xm list --label
2576 Name ID Mem(MiB) VCPUs State Time(s) Label
2577 domain2 4 164 1 r----- 4.3 PepsiCo.Extranet
2578 Domain-0 0 1949 4 r----- 298.4 SystemManagement
2580 # xm create domain1.xm
2581 Using config file "domain1.xm".
2582 Error: (1, 'Operation not permitted')
2584 # xm destroy domain2
2585 # xm list
2586 Name ID Mem(MiB) VCPUs State Time(s)
2587 Domain-0 0 1949 4 r----- 391.2
2588 \end{verbatim}
2589 \end{scriptsize}
2591 You can verify that domains with Avis label can run together with
2592 domains labeled CocaCola, PepsiCo, or Hertz.
2594 \paragraph{Test2: Resource access.} In this test, we will re-label the
2595 swap file for domain1 with the Avis resource label. We expect that
2596 Domain1 will no longer start because it cannot access this resource.
2597 This test checks the sharing abilities of domains, which are defined
2598 by the Simple Type Enforcement Policy component.
2600 \begin{scriptsize}
2601 \begin{verbatim}
2602 # xm rmlabel res file:/home/xen/dom_fc5/fedora.swap
2603 # xm addlabel Avis res file:/home/xen/dom_fc5/fedora.swap
2604 # xm resources
2605 file:/home/xen/dom_fc5/fedora.swap
2606 policy: example.chwall_ste.test-wld
2607 label: Avis
2608 file:/home/xen/dom_fc5/fedora.fc5.img
2609 policy: example.chwall_ste.test-wld
2610 label: CocaCola
2612 # xm create domain1.xm
2613 Using config file "domain1.xm".
2614 file:/home/xen/dom_fc4/fedora.swap: DENIED
2615 --> res:Avis (example.chwall_ste.test-wld)
2616 --> dom:CocaCola (example.chwall_ste.test-wld)
2617 Security configuration prevents domain from starting
2618 \end{verbatim}
2619 \end{scriptsize}
2621 \paragraph{Test 3: Communication.} In this test we would verify that
2622 two domains with labels Hertz and Avis cannot exchange network packets
2623 by using the 'ping' connectivity test. It is also related to the STE
2624 policy.{\bf Note:} sHype/Xen does control direct communication between
2625 domains. However, domains associated with different workloads can
2626 currently still communicate through the Domain0 virtual network. We
2627 are working on the sHype/ACM controls for local and remote network
2628 traffic through Domain0. Please monitor the xen-devel mailing list
2629 for updated information.
2631 \section{Xen Access Control Policy}
2632 \label{section:acmpolicy}
2634 This section describes the sHype/Xen access control policy in detail.
2635 It gives enough information to enable the reader to write custom
2636 access control policies and to use the available Xen policy tools. The
2637 policy language is expressive enough to specify most symmetric access
2638 relationships between domains and resources efficiently.
2640 The Xen access control policy consists of two policy components. The
2641 first component, called Chinese Wall (CHWALL) policy, controls which
2642 domains can run simultaneously on the same virtualized platform. The
2643 second component, called Simple Type Enforcement (STE) policy,
2644 controls the sharing between running domains, i.e., communication or
2645 access to shared resources. The CHWALL and STE policy components can
2646 be configured to run alone, however in our examples we will assume
2647 that both policy components are configured together since they
2648 complement each other. The XML policy file includes all information
2649 needed by Xen to enforce the policies.
2651 Figures~\ref{fig:acmxmlfilea} and \ref{fig:acmxmlfileb} show a fully
2652 functional but very simple example policy for Xen. The policy can
2653 distinguish two workload types \verb|CocaCola| and \verb|PepsiCo| and
2654 defines the labels necessary to associate domains and resources with
2655 one of these workload types. The XML Policy consists of four parts:
2656 \begin{enumerate}
2657 \item policy header including the policy name
2658 \item Simple Type Enforcement block
2659 \item Chinese Wall Policy block
2660 \item label definition block
2661 \end{enumerate}
2663 \begin{figure}
2664 \begin{scriptsize}
2665 \begin{verbatim}
2666 01 <?xml version="1.0" encoding="UTF-8"?>
2667 02 <!-- Auto-generated by ezPolicy -->
2668 03 <SecurityPolicyDefinition
2669 xmlns=""
2670 xmlns:xsi=""
2671 xsi:schemaLocation=
2672 " ../../security_policy.xsd ">
2673 04 <PolicyHeader>
2674 05 <PolicyName>example.test</PolicyName>
2675 06 <Date>Wed Jul 12 17:32:59 2006</Date>
2676 07 <Version>1.0</Version>
2677 08 </PolicyHeader>
2678 09
2679 10 <SimpleTypeEnforcement>
2680 11 <SimpleTypeEnforcementTypes>
2681 12 <Type>SystemManagement</Type>
2682 13 <Type>PepsiCo</Type>
2683 14 <Type>CocaCola</Type>
2684 15 </SimpleTypeEnforcementTypes>
2685 16 </SimpleTypeEnforcement>
2686 17
2687 18 <ChineseWall priority="PrimaryPolicyComponent">
2688 19 <ChineseWallTypes>
2689 20 <Type>SystemManagement</Type>
2690 21 <Type>PepsiCo</Type>
2691 22 <Type>CocaCola</Type>
2692 23 </ChineseWallTypes>
2693 24
2694 25 <ConflictSets>
2695 26 <Conflict name="RER1">
2696 27 <Type>CocaCola</Type>
2697 28 <Type>PepsiCo</Type>
2698 29 </Conflict>
2699 30 </ConflictSets>
2700 31 </ChineseWall>
2701 32
2702 \end{verbatim}
2703 \end{scriptsize}
2704 \caption{Example XML security policy file -- Part I: Types and Rules Definition.}
2705 \label{fig:acmxmlfilea}
2706 \end{figure}
2708 \subsection{Policy Header and Policy Name}
2709 \label{subsection:acmnaming}
2710 Lines 1-2 (cf Figure~\ref{fig:acmxmlfilea}) include the usual XML
2711 header. The security policy definition starts in Line 3 and refers to
2712 the policy schema. The XML-Schema definition for the Xen policy can be
2713 found in the file
2714 \textit{/etc/xen/acm-security/policies/security-policy.xsd}. Examples
2715 for security policies can be found in the example subdirectory. The
2716 acm-security directory is only installed if ACM security is configured
2717 during installation (cf Section~\ref{subsection:acmexampleconfigure}).
2719 The \verb|Policy Header| spans lines 4-7. It includes a date field and
2720 defines the policy name \verb|example.chwall_ste.test|. It can also
2721 include optional fields that are not shown and are for future use (see
2722 schema definition).
2724 The policy name serves two purposes: First, it provides a unique name
2725 for the security policy. This name is also exported by the Xen
2726 hypervisor to the Xen management tools in order to ensure that both
2727 enforce the same policy. We plan to extend the policy name with a
2728 digital fingerprint of the policy contents to better protect this
2729 correlation. Second, it implicitly points the xm tools to the
2730 location where the XML policy file is stored on the Xen system.
2731 Replacing the colons in the policy name by slashes yields the local
2732 path to the policy file starting from the global policy directory
2733 \verb|/etc/xen/acm-security/policies|. The last part of the policy
2734 name is the prefix for the XML policy file name, completed by
2735 \verb|-security_policy.xml|. Consequently, the policy with the name
2736 \verb|example.chwall_ste.test| can be found in the XML policy file
2737 named \verb|test-security_policy.xml| that is stored in the local
2738 directory \verb|example/chwall_ste| under the global policy directory.
2740 \subsection{Simple Type Enforcement Policy Component}
2742 The Simple Type Enforcement (STE) policy controls which domains can
2743 communicate or share resources. This way, Xen can enforce confinement
2744 of workload types by confining the domains running those workload
2745 types. The mandatory access control framework enforces its policy when
2746 domains access intended ways of communication or cooperation (shared
2747 memory, events, shared resources such as block devices). It builds on
2748 top of the core hypervisor isolation, which restricts the ways of
2749 inter-communication to those intended means. STE does not protect or
2750 intend to protect from covert channels in the hypervisor or hardware;
2751 this is an orthogonal problem that can be mitigated by using the
2752 Run-time Exclusion rules described above or by fixing the problem in
2753 the core hypervisor.
2755 Xen controls sharing between domains on the resource and domain level
2756 because this is the abstraction the hypervisor and its management
2757 understand naturally. While this is coarse-grained, it is also very
2758 reliable and robust and it requires minimal changes to implement
2759 mandatory access controls in the hypervisor. It enables platform- and
2760 operation system-independent policies as part of a layered security
2761 approach.
2763 Lines 9-15 (cf Figure~\ref{fig:acmxmlfilea}) define the Simple Type
2764 Enforcement policy component. Essentially, they define the workload
2765 type names \verb|SystemManagement|, \verb|PepsiCo|, and
2766 \verb|CocaCola| that are available in the STE policy component. The
2767 policy rules are implicit: Xen permits a domain to communicate with
2768 another domain if and only if the labels of the domains share an
2769 common STE type. Xen permits a domain to access a resource if and
2770 only if the labels of the domain and the resource share a common STE
2771 workload type.
2773 \subsection{Chinese Wall Policy Component}
2775 The Chinese Wall security policy interpretation of sHype enables users
2776 to prevent certain workloads from running simultaneously on the same
2777 hypervisor platform. Run-time Exclusion rules (RER), also called
2778 Conflict Sets, define a set of workload types that are not permitted
2779 to run simultaneously. Of all the workloads specified in a Run-time
2780 Exclusion rule, at most one type can run on the same hypervisor
2781 platform at a time. Run-time Exclusion Rules implement a less
2782 rigorous variant of the original Chinese Wall security component. They
2783 do not implement the *-property of the policy, which would require to
2784 restrict also types that are not part of an exclusion rule once they
2785 are running together with a type in an exclusion rule (please refer to
2786 for more information
2787 on the original Chinese Wall policy).
2789 Xen considers the \verb|ChineseWallTypes| part of the label for the
2790 enforcement of the Run-time Exclusion rules. It is illegal to define
2791 labels including conflicting Chinese Wall types.
2793 Lines 17-30 (cf Figure~\ref{fig:acmxmlfilea}) define the Chinese Wall
2794 policy component. Lines 17-22 define the known Chinese Wall types,
2795 which coincide here with the STE types defined above. This usually
2796 holds if the criteria for sharing among domains and sharing of the
2797 hardware platform are the same. Lines 24-29 define one Run-time
2798 Exclusion rule:
2800 \begin{scriptsize}
2801 \begin{verbatim}
2802 <Conflict name="RER1">
2803 <Type>CocaCola</Type>
2804 <Type>PepsiCo</Type>
2805 </Conflict>
2806 \end{verbatim}
2807 \end{scriptsize}
2809 Based on this rule, Xen enforces that only one of the types
2810 \verb|CocaCola| or \verb|PepsiCo| will run on a single hypervisor
2811 platform at a time. For example, once a domain assigned a
2812 \verb|CocaCola| workload type is started, domains with the
2813 \verb|PepsiCo| type will be denied to start. When the former domain
2814 stops and no other domains with the \verb|CocaCola| type are running,
2815 then domains with the \verb|PepsiCo| type can start.
2817 Xen maintains reference counts on each running workload type to keep
2818 track of which workload types are running. Every time a domain starts
2819 or resumes, the reference count on those Chinese Wall types that are
2820 referenced in the domain's label are incremented. Every time a domain
2821 is destroyed or saved, the reference counts of its Chinese Wall types
2822 are decremented. sHype in Xen covers migration and live-migration,
2823 which is treated the same way as saving a domain on the source
2824 platform and resuming it on the destination platform.
2826 Reasons why users would want to restrict which workloads or domains
2827 can share the system hardware include:
2829 \begin{itemize}
2830 \item Imperfect resource management or control might enable a rogue
2831 domain to starve another domain and the workload running in it.
2832 \item Redundant domains might run the same workload to increase
2833 availability; such domains should not run on the same hardware to
2834 avoid single points of failure.
2835 \item Imperfect Xen core domain isolation might enable two rogue
2836 domains running different workload types to use unintended and
2837 unknown ways (covert channels) to exchange some data. This way, they
2838 bypass the policed Xen access control mechanisms. Such
2839 imperfections cannot be completely eliminated and are a result of
2840 trade-offs between security and other design requirements. For a
2841 simple example of a covert channel see
2842 Such covert channels
2843 exist also between workloads running on different platforms if they
2844 are connected through networks. The Xen Chinese Wall policy provides
2845 an approximation of this imperfect ``air-gap'' between selected
2846 workload types.
2847 \end{itemize}
2849 \subsection{Security Labels}
2851 To enable Xen to associate domains with workload types running in
2852 them, each domain is assigned a security label that includes the
2853 workload types of the domain.
2855 \begin{figure}
2856 \begin{scriptsize}
2857 \begin{verbatim}
2858 32 <SecurityLabelTemplate>
2859 33 <SubjectLabels bootstrap="SystemManagement">
2860 34 <VirtualMachineLabel>
2861 35 <Name>SystemManagement</Name>
2862 36 <SimpleTypeEnforcementTypes>
2863 37 <Type>SystemManagement</Type>
2864 38 <Type>PepsiCo</Type>
2865 39 <Type>CocaCola</Type>
2866 40 </SimpleTypeEnforcementTypes>
2867 41 <ChineseWallTypes>
2868 42 <Type>SystemManagement</Type>
2869 43 </ChineseWallTypes>
2870 44 </VirtualMachineLabel>
2871 45
2872 46 <VirtualMachineLabel>
2873 47 <Name>PepsiCo</Name>
2874 48 <SimpleTypeEnforcementTypes>
2875 49 <Type>PepsiCo</Type>
2876 50 </SimpleTypeEnforcementTypes>
2877 51 <ChineseWallTypes>
2878 52 <Type>PepsiCo</Type>
2879 53 </ChineseWallTypes>
2880 54 </VirtualMachineLabel>
2881 55
2882 56 <VirtualMachineLabel>
2883 57 <Name>CocaCola</Name>
2884 58 <SimpleTypeEnforcementTypes>
2885 59 <Type>CocaCola</Type>
2886 60 </SimpleTypeEnforcementTypes>
2887 61 <ChineseWallTypes>
2888 62 <Type>CocaCola</Type>
2889 63 </ChineseWallTypes>
2890 64 </VirtualMachineLabel>
2891 65 </SubjectLabels>
2892 66
2893 67 <ObjectLabels>
2894 68 <ResourceLabel>
2895 69 <Name>SystemManagement</Name>
2896 70 <SimpleTypeEnforcementTypes>
2897 71 <Type>SystemManagement</Type>
2898 72 </SimpleTypeEnforcementTypes>
2899 73 </ResourceLabel>
2900 74
2901 75 <ResourceLabel>
2902 76 <Name>PepsiCo</Name>
2903 77 <SimpleTypeEnforcementTypes>
2904 78 <Type>PepsiCo</Type>
2905 79 </SimpleTypeEnforcementTypes>
2906 80 </ResourceLabel>
2907 81
2908 82 <ResourceLabel>
2909 83 <Name>CocaCola</Name>
2910 84 <SimpleTypeEnforcementTypes>
2911 85 <Type>CocaCola</Type>
2912 86 </SimpleTypeEnforcementTypes>
2913 87 </ResourceLabel>
2914 88 </ObjectLabels>
2915 89 </SecurityLabelTemplate>
2916 90 </SecurityPolicyDefinition>
2917 \end{verbatim}
2918 \end{scriptsize}
2919 \caption{Example XML security policy file -- Part II: Label Definition.}
2920 \label{fig:acmxmlfileb}
2921 \end{figure}
2923 Lines 32-89 (cf Figure~\ref{fig:acmxmlfileb}) define the
2924 \verb|SecurityLabelTemplate|, which includes the labels that can be
2925 attached to domains and resources when this policy is active. The
2926 domain labels include Chinese Wall types while resource labels do not
2927 include Chinese Wall types. Lines 33-65 define the
2928 \verb|SubjectLabels| that can be assigned to domains. For example, the
2929 virtual machine label \verb|CocaCola| (cf lines 56-64 in
2930 Figure~\ref{fig:acmxmlfileb}) associates the domain that carries it
2931 with the workload type \verb|CocaCola|.
2933 The \verb|bootstrap| attribute names the label
2934 \verb|SystemManagement|. Xen will assign this label to Domain0 at
2935 boot time. All other domains are assigned labels according to their
2936 domain configuration file (see
2937 Section~\ref{subsection:acmexamplelabeldomains} for examples of how to
2938 label domains). Lines 67-88 define the \verb|ObjectLabels|. Those
2939 labels can be assigned to resources when this policy is active.
2941 In general, user domains should be assigned labels that have only a
2942 single SimpleTypeEnforcement workload type. This way, workloads remain
2943 confined even if user domains become rogue. Any domain that is
2944 assigned a label with multiple STE types must be trusted to keep
2945 information belonging to the different STE types separate (confined).
2946 For example, Domain0 is assigned the bootstrap label
2947 \verb|SystemsManagement|, which includes all existing STE types.
2948 Therefore, Domain0 must take care not to enable unauthorized
2949 information flow (eg. through block devices or virtual networking)
2950 between domains or resources that are assigned different STE types.
2952 Security administrators simply use the name of a label (specified in
2953 the \verb|<Name>| field) to associate a label with a domain (cf.
2954 Section~\ref{subsection:acmexamplelabeldomains}). The types inside the
2955 label are used by the Xen access control enforcement. While the name
2956 can be arbitrarily chosen (as long as it is unique), it is advisable
2957 to choose the label name in accordance to the security types included.
2958 While the XML representation in the above label seems unnecessary
2959 flexible, labels in general can consist of multiple types as we will
2960 see in the following example.
2962 Assume that \verb|PepsiCo| and \verb|CocaCola| workloads use virtual
2963 disks that are provided by a virtual I/O domain hosting a physical
2964 storage device and carrying the following label:
2966 \begin{scriptsize}
2967 \begin{verbatim}
2968 <VirtualMachineLabel>
2969 <Name>VIO</Name>
2970 <SimpleTypeEnforcementTypes>
2971 <Type>CocaCola</Type>
2972 <Type>PepsiCo</Type>
2973 </SimpleTypeEnforcementTypes>
2974 <ChineseWallTypes>
2975 <Type>VIOServer</Type>
2976 </ChineseWallTypes>
2977 </VirtualMachineLabel>
2978 \end{verbatim}
2979 \end{scriptsize}
2981 This Virtual I/O domain (VIO) exports its virtualized disks by
2982 communicating both to domains labeled with the \verb|PepsiCo| label
2983 and domains labeled with the \verb|CocaCola| label. This requires the
2984 VIO domain to carry both the STE types \verb|CocaCola| and
2985 \verb|PepsiCo|. In this example, the confinement of \verb|CocaCola|
2986 and \verb|PepsiCo| workload depends on a VIO domain that must keep the
2987 data of those different workloads separate. The virtual disks are
2988 labeled as well (see Section~\ref{subsection:acmexamplelabelresources}
2989 for labeling resources) and enforcement functions inside the VIO
2990 domain must ensure that the labels of the domain mounting a virtual
2991 disk and the virtual disk label share a common STE type. The VIO label
2992 carrying its own VIOServer CHWALL type introduces the flexibility to
2993 permit the trusted VIO server to run together with CocaCola or PepsiCo
2994 workloads.
2996 Alternatively, a system that has two hard-drives does not need a VIO
2997 domain but can directly assign one hardware storage device to each of
2998 the workloads (if the platform offers an IO-MMU, cf
2999 Section~\ref{s:ddsecurity}. Sharing hardware through virtualization
3000 is a trade-off between the amount of trusted code (size of the trusted
3001 computing base) and the amount of acceptable over-provisioning. This
3002 holds both for peripherals and for system platforms.
3004 \subsection{Tools For Creating sHype/Xen Security Policies}
3005 To create a security policy for Xen, you can use one of the following
3006 tools:
3007 \begin{itemize}
3008 \item \verb|ezPolicy| GUI tool -- start writing policies
3009 \item \verb|xensec_gen| tool -- refine policies created with \verb|ezPolicy|
3010 \item text or XML editor
3011 \end{itemize}
3013 We use the \verb|ezPolicy| tool in
3014 Section~\ref{subsection:acmexamplecreate} to quickly create a workload
3015 protection policy. If desired, the resulting XML policy file can be
3016 loaded into the \verb|xensec_gen| tool to refine it. It can also be
3017 directly edited using an XML editor. Any XML policy file is verified
3018 against the security policy schema when it is translated (see
3019 Subsection~\ref{subsection:acmexampleinstall}).
3021 \section{Current Limitations}
3022 \label{section:acmlimitations}
3024 The sHype/ACM configuration for Xen is work in progress. There is
3025 ongoing work for protecting virtualized resources and planned and
3026 ongoing work for protecting access to remote resources and domains.
3027 The following sections describe limitations of some of the areas into
3028 which access control is being extended.
3030 \subsection{Network Traffic}
3031 Local and remote network traffic is currently not controlled.
3032 Solutions to add sHype/ACM policy enforcement to the virtual network
3033 exist but need to be discussed before they can become part of Xen.
3034 Subjecting external network traffic to the ACM security policy is work
3035 in progress. Manually setting up filters in domain 0 is required for
3036 now but does not scale well.
3038 \subsection{Resource Access and Usage Control}
3040 Enforcing the security policy across multiple hypervisor systems and
3041 on access to remote shared resources is work in progress. Extending
3042 access control to new types of resources is ongoing work (e.g. network
3043 storage).
3045 On a single Xen system, information about the association of resources
3046 and security labels is stored in
3047 \verb|/etc/xen/acm-security/policy/resource_labels|. This file relates
3048 a full resource path with a security label. This association is weak
3049 and will break if resources are moved or renamed without adapting the
3050 label file. Improving the protection of label-resource relationships
3051 is ongoing work.
3053 Controlling resource usage and enforcing resource limits in general is
3054 ongoing work in the Xen community.
3056 \subsection{Domain Migration}
3058 Labels on domains are enforced during domain migration and the
3059 destination hypervisor will ensure that the domain label is valid and
3060 the domain is permitted to run (considering the Chinese Wall policy
3061 rules) before it accepts the migration. However, the network between
3062 the source and destination hypervisor as well as both hypervisors must
3063 be trusted. Architectures and prototypes exist that both protect the
3064 network connection and ensure that the hypervisors enforce access
3065 control consistently but patches are not yet available for the main
3066 stream.
3068 \subsection{Covert Channels}
3070 The sHype access control aims at system independent security policies.
3071 It builds on top of the core hypervisor isolation. Any covert channels
3072 that exist in the core hypervisor or in the hardware (e.g., shared
3073 processor cache) will be inherited. If those covert channels are not
3074 the result of trade-offs between security and other system properties,
3075 then they are most effectively minimized or eliminated where they are
3076 caused. sHype offers however some means to mitigate their impact
3077 (cf. run-time exclusion rules).
3079 \part{Reference}
3081 %% Chapter Build and Boot Options
3082 \chapter{Build and Boot Options}
3084 This chapter describes the build- and boot-time options which may be
3085 used to tailor your Xen system.
3087 \section{Top-level Configuration Options}
3089 Top-level configuration is achieved by editing one of two
3090 files: \path{} and \path{Makefile}.
3092 The former allows the overall build target architecture to be
3093 specified. You will typically not need to modify this unless
3094 you are cross-compiling or if you wish to build a non-PAE
3095 Xen system. Additional configuration options are documented
3096 in the \path{} file.
3098 The top-level \path{Makefile} is chiefly used to customize the set of
3099 kernels built. Look for the line:
3100 \begin{quote}
3101 \begin{verbatim}
3102 KERNELS ?= linux-2.6-xen0 linux-2.6-xenU
3103 \end{verbatim}
3104 \end{quote}
3106 Allowable options here are any kernels which have a corresponding
3107 build configuration file in the \path{buildconfigs/} directory.
3111 \section{Xen Build Options}
3113 Xen provides a number of build-time options which should be set as
3114 environment variables or passed on make's command-line.
3116 \begin{description}
3117 \item[verbose=y] Enable debugging messages when Xen detects an
3118 unexpected condition. Also enables console output from all domains.
3119 \item[debug=y] Enable debug assertions. Implies {\bf verbose=y}.
3120 (Primarily useful for tracing bugs in Xen).
3121 \item[debugger=y] Enable the in-Xen debugger. This can be used to
3122 debug Xen, guest OSes, and applications.
3123 \item[perfc=y] Enable performance counters for significant events
3124 within Xen. The counts can be reset or displayed on Xen's console
3125 via console control keys.
3126 \end{description}
3129 \section{Xen Boot Options}
3130 \label{s:xboot}
3132 These options are used to configure Xen's behaviour at runtime. They
3133 should be appended to Xen's command line, either manually or by
3134 editing \path{grub.conf}.
3136 \begin{description}
3137 \item [ noreboot ] Don't reboot the machine automatically on errors.
3138 This is useful to catch debug output if you aren't catching console
3139 messages via the serial line.
3140 \item [ nosmp ] Disable SMP support. This option is implied by
3141 `ignorebiostables'.
3142 \item [ watchdog ] Enable NMI watchdog which can report certain
3143 failures.
3144 \item [ noirqbalance ] Disable software IRQ balancing and affinity.
3145 This can be used on systems such as Dell 1850/2850 that have
3146 workarounds in hardware for IRQ-routing issues.
3147 \item [ badpage=$<$page number$>$,$<$page number$>$, \ldots ] Specify
3148 a list of pages not to be allocated for use because they contain bad
3149 bytes. For example, if your memory tester says that byte 0x12345678
3150 is bad, you would place `badpage=0x12345' on Xen's command line.
3151 \item [ com1=$<$baud$>$,DPS,$<$io\_base$>$,$<$irq$>$
3152 com2=$<$baud$>$,DPS,$<$io\_base$>$,$<$irq$>$ ] \mbox{}\\
3153 Xen supports up to two 16550-compatible serial ports. For example:
3154 `com1=9600, 8n1, 0x408, 5' maps COM1 to a 9600-baud port, 8 data
3155 bits, no parity, 1 stop bit, I/O port base 0x408, IRQ 5. If some
3156 configuration options are standard (e.g., I/O base and IRQ), then
3157 only a prefix of the full configuration string need be specified. If
3158 the baud rate is pre-configured (e.g., by the bootloader) then you
3159 can specify `auto' in place of a numeric baud rate.
3160 \item [ console=$<$specifier list$>$ ] Specify the destination for Xen
3161 console I/O. This is a comma-separated list of, for example:
3162 \begin{description}
3163 \item[ vga ] Use VGA console (until domain 0 boots, unless {\bf
3164 vga=...keep } is specified).
3165 \item[ com1 ] Use serial port com1.
3166 \item[ com2H ] Use serial port com2. Transmitted chars will have the
3167 MSB set. Received chars must have MSB set.
3168 \item[ com2L] Use serial port com2. Transmitted chars will have the
3169 MSB cleared. Received chars must have MSB cleared.
3170 \end{description}
3171 The latter two examples allow a single port to be shared by two
3172 subsystems (e.g.\ console and debugger). Sharing is controlled by
3173 MSB of each transmitted/received character. [NB. Default for this
3174 option is `com1,vga']
3175 \item [ vga=$<$mode$>$(,keep) ] The mode is one of the following options:
3176 \begin{description}
3177 \item[ ask ] Display a vga menu allowing manual selection of video
3178 mode.
3179 \item[ current ] Use existing vga mode without modification.
3180 \item[ text-$<$mode$>$ ] Select text-mode resolution, where mode is
3181 one of 80x25, 80x28, 80x30, 80x34, 80x43, 80x50, 80x60.
3182 \item[ gfx-$<$mode$>$ ] Select VESA graphics mode
3183 $<$width$>$x$<$height$>$x$<$depth$>$ (e.g., `vga=gfx-1024x768x32').
3184 \item[ mode-$<$mode$>$ ] Specify a mode number as discovered by `vga
3185 ask'. Note that the numbers are displayed in hex and hence must be
3186 prefixed by `0x' here (e.g., `vga=mode-0x0335').
3187 \end{description}
3188 The mode may optionally be followed by `{\bf,keep}' to cause Xen to keep
3189 writing to the VGA console after domain 0 starts booting (e.g., `vga=text-80x50,keep').
3190 \item [ no-real-mode ] (x86 only) Do not execute real-mode bootstrap
3191 code when booting Xen. This option should not be used except for
3192 debugging. It will effectively disable the {\bf vga} option, which
3193 relies on real mode to set the video mode.
3194 \item [ edid=no,force ] (x86 only) Either force retrieval of monitor
3195 EDID information via VESA DDC, or disable it (edid=no). This option
3196 should not normally be required except for debugging purposes.
3197 \item [ edd=off,on,skipmbr ] (x86 only) Control retrieval of Extended
3198 Disc Data (EDD) from the BIOS during boot.
3199 \item [ console\_to\_ring ] Place guest console output into the
3200 hypervisor console ring buffer. This is disabled by default.
3201 When enabled, both hypervisor output and guest console output
3202 is available from the ring buffer. This can be useful for logging
3203 and/or remote presentation of console data.
3204 \item [ sync\_console ] Force synchronous console output. This is
3205 useful if you system fails unexpectedly before it has sent all
3206 available output to the console. In most cases Xen will
3207 automatically enter synchronous mode when an exceptional event
3208 occurs, but this option provides a manual fallback.
3209 \item [ conswitch=$<$switch-char$><$auto-switch-char$>$ ] Specify how
3210 to switch serial-console input between Xen and DOM0. The required
3211 sequence is CTRL-$<$switch-char$>$ pressed three times. Specifying
3212 the backtick character disables switching. The
3213 $<$auto-switch-char$>$ specifies whether Xen should auto-switch
3214 input to DOM0 when it boots --- if it is `x' then auto-switching is
3215 disabled. Any other value, or omitting the character, enables
3216 auto-switching. [NB. Default switch-char is `a'.]
3217 \item [ loglvl=$<$level$>/<$level$>$ ]
3218 Specify logging level. Messages of the specified severity level (and
3219 higher) will be printed to the Xen console. Valid levels are `none',
3220 `error', `warning', `info', `debug', and `all'. The second level
3221 specifier is optional: it is used to specify message severities
3222 which are to be rate limited. Default is `loglvl=warning'.
3223 \item [ guest\_loglvl=$<$level$>/<$level$>$ ] As for loglvl, but
3224 applies to messages relating to guests. Default is
3225 `guest\_loglvl=none/warning'.
3226 \item [ console\_timestamps ]
3227 Adds a timestamp prefix to each line of Xen console output.
3228 \item [ nmi=xxx ]
3229 Specify what to do with an NMI parity or I/O error. \\
3230 `nmi=fatal': Xen prints a diagnostic and then hangs. \\
3231 `nmi=dom0': Inform DOM0 of the NMI. \\
3232 `nmi=ignore': Ignore the NMI.
3233 \item [ mem=xxx ] Set the physical RAM address limit. Any RAM
3234 appearing beyond this physical address in the memory map will be
3235 ignored. This parameter may be specified with a B, K, M or G suffix,
3236 representing bytes, kilobytes, megabytes and gigabytes respectively.
3237 The default unit, if no suffix is specified, is kilobytes.
3238 \item [ dom0\_mem=$<$specifier list$>$ ] Set the amount of memory to
3239 be allocated to domain 0. This is a comma-separated list containing
3240 the following optional components:
3241 \begin{description}
3242 \item[ min:$<$min\_amt$>$ ] Minimum amount to allocate to domain 0
3243 \item[ max:$<$min\_amt$>$ ] Maximum amount to allocate to domain 0
3244 \item[ $<$amt$>$ ] Precise amount to allocate to domain 0
3245 \end{description}
3246 Each numeric parameter may be specified with a B, K, M or
3247 G suffix, representing bytes, kilobytes, megabytes and gigabytes
3248 respectively; if no suffix is specified, the parameter defaults to
3249 kilobytes. Negative values are subtracted from total available
3250 memory. If $<$amt$>$ is not specified, it defaults to all available
3251 memory less a small amount (clamped to 128MB) for uses such as DMA
3252 buffers.
3253 \item [ dom0\_vcpus\_pin ] Pins domain 0 VCPUs on their respective
3254 physical CPUS (default=false).
3255 \item [ tbuf\_size=xxx ] Set the size of the per-cpu trace buffers, in
3256 pages (default 0).
3257 \item [ sched=xxx ] Select the CPU scheduler Xen should use. The
3258 current possibilities are `credit' (default), and `sedf'.
3259 \item [ apic\_verbosity=debug,verbose ] Print more detailed
3260 information about local APIC and IOAPIC configuration.
3261 \item [ lapic ] Force use of local APIC even when left disabled by
3262 uniprocessor BIOS.
3263 \item [ nolapic ] Ignore local APIC in a uniprocessor system, even if
3264 enabled by the BIOS.
3265 \item [ apic=bigsmp,default,es7000,summit ] Specify NUMA platform.
3266 This can usually be probed automatically.
3267 \item [ dma\_bits=xxx ] Specify width of DMA
3268 addresses in bits. Default is 30 bits (addresses up to 1GB are DMAable).
3269 \item [ dma\_emergency\_pool=xxx ] Specify lower bound on size of DMA
3270 pool below which ordinary allocations will fail rather than fall
3271 back to allocating from the DMA pool.
3272 \item [ hap ] Instruct Xen to detect hardware-assisted paging support, such
3273 as AMD-V's nested paging or Intel\textregistered VT's extended paging. If
3274 available, Xen will use hardware-assisted paging instead of shadow paging
3275 for guest memory management.
3276 \end{description}
3278 In addition, the following options may be specified on the Xen command
3279 line. Since domain 0 shares responsibility for booting the platform,
3280 Xen will automatically propagate these options to its command line.
3281 These options are taken from Linux's command-line syntax with
3282 unchanged semantics.
3284 \begin{description}
3285 \item [ acpi=off,force,strict,ht,noirq,\ldots ] Modify how Xen (and
3286 domain 0) parses the BIOS ACPI tables.
3287 \item [ acpi\_skip\_timer\_override ] Instruct Xen (and domain~0) to
3288 ignore timer-interrupt override instructions specified by the BIOS
3289 ACPI tables.
3290 \item [ noapic ] Instruct Xen (and domain~0) to ignore any IOAPICs
3291 that are present in the system, and instead continue to use the
3292 legacy PIC.
3293 \end{description}
3296 \section{XenLinux Boot Options}
3298 In addition to the standard Linux kernel boot options, we support:
3299 \begin{description}
3300 \item[ xencons=xxx ] Specify the device node to which the Xen virtual
3301 console driver is attached. The following options are supported:
3302 \begin{center}
3303 \begin{tabular}{l}
3304 `xencons=off': disable virtual console \\
3305 `xencons=tty': attach console to /dev/tty1 (tty0 at boot-time) \\
3306 `xencons=ttyS': attach console to /dev/ttyS0
3307 \end{tabular}
3308 \end{center}
3309 The default is ttyS for dom0 and tty for all other domains.
3310 \end{description}
3313 %% Chapter Further Support
3314 \chapter{Further Support}
3316 If you have questions that are not answered by this manual, the
3317 sources of information listed below may be of interest to you. Note
3318 that bug reports, suggestions and contributions related to the
3319 software (or the documentation) should be sent to the Xen developers'
3320 mailing list (address below).
3323 \section{Other Documentation}
3325 For developers interested in porting operating systems to Xen, the
3326 \emph{Xen Interface Manual} is distributed in the \path{docs/}
3327 directory of the Xen source distribution.
3330 \section{Online References}
3332 The official Xen web site can be found at:
3333 \begin{quote} {\tt}
3334 \end{quote}
3336 This contains links to the latest versions of all online
3337 documentation, including the latest version of the FAQ.
3339 Information regarding Xen is also available at the Xen Wiki at
3340 \begin{quote} {\tt}\end{quote}
3341 The Xen project uses Bugzilla as its bug tracking system. You'll find
3342 the Xen Bugzilla at
3345 \section{Mailing Lists}
3347 There are several mailing lists that are used to discuss Xen related
3348 topics. The most widely relevant are listed below. An official page of
3349 mailing lists and subscription information can be found at \begin{quote}
3350 {\tt} \end{quote}
3352 \begin{description}
3353 \item[] Used for development
3354 discussions and bug reports. Subscribe at: \\
3355 {\small {\tt}}
3356 \item[] Used for installation and usage
3357 discussions and requests for help. Subscribe at: \\
3358 {\small {\tt}}
3359 \item[] Used for announcements only.
3360 Subscribe at: \\
3361 {\small {\tt}}
3362 \item[] Changelog feed
3363 from the unstable and 2.0 trees - developer oriented. Subscribe at: \\
3364 {\small {\tt}}
3365 \end{description}
3369 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3371 \appendix
3373 \chapter{Unmodified (VMX) guest domains in Xen with Intel\textregistered Virtualization Technology (VT)}
3375 Xen supports guest domains running unmodified Guest operating systems using Virtualization Technology (VT) available on recent Intel Processors. More information about the Intel Virtualization Technology implementing Virtual Machine Extensions (VMX) in the processor is available on the Intel website at \\
3376 {\small {\tt}}
3378 \section{Building Xen with VT support}
3380 The following packages need to be installed in order to build Xen with VT support. Some Linux distributions do not provide these packages by default.
3382 \begin{tabular}{lp{11.0cm}}
3383 {\bfseries Package} & {\bfseries Description} \\
3385 dev86 & The dev86 package provides an assembler and linker for real mode 80x86 instructions. You need to have this package installed in order to build the BIOS code which runs in (virtual) real mode.
3387 If the dev86 package is not available on the x86\_64 distribution, you can install the i386 version of it. The dev86 rpm package for various distributions can be found at {\scriptsize {\tt\&submit=Search}} \\
3389 LibVNCServer & The unmodified guest's VGA display, keyboard, and mouse can be virtualized by the vncserver library. You can get the sources of libvncserver from {\small {\tt}}. Build and install the sources on the build system to get the libvncserver library. There is a significant performance degradation in 0.8 version. The current sources in the CVS tree have fixed this degradation. So it is highly recommended to download the latest CVS sources and install them.\\
3391 SDL-devel, SDL & Simple DirectMedia Layer (SDL) is another way of virtualizing the unmodified guest console. It provides an X window for the guest console.
3393 If the SDL and SDL-devel packages are not installed by default on the build system, they can be obtained from {\scriptsize {\tt\&amp;submit=Search}}
3394 , {\scriptsize {\tt\&submit=Search}} \\
3396 \end{tabular}
3398 \section{Configuration file for unmodified VMX guests}
3400 The Xen installation includes a sample configuration file, {\small {\tt /etc/xen/xmexample.vmx}}. There are comments describing all the options. In addition to the common options that are the same as those for paravirtualized guest configurations, VMX guest configurations have the following settings:
3402 \begin{tabular}{lp{11.0cm}}
3404 {\bfseries Parameter} & {\bfseries Description} \\
3406 kernel & The VMX firmware loader, {\small {\tt /usr/lib/xen/boot/vmxloader}}\\
3408 builder & The domain build function. The VMX domain uses the vmx builder.\\
3410 acpi & Enable VMX guest ACPI, default=0 (disabled)\\
3412 apic & Enable VMX guest APIC, default=0 (disabled)\\
3414 pae & Enable VMX guest PAE, default=0 (disabled)\\
3416 vif & Optionally defines MAC address and/or bridge for the network interfaces. Random MACs are assigned if not given. {\small {\tt type=ioemu}} means ioemu is used to virtualize the VMX NIC. If no type is specified, vbd is used, as with paravirtualized guests.\\
3418 disk & Defines the disk devices you want the domain to have access to, and what you want them accessible as. If using a physical device as the VMX guest's disk, each disk entry is of the form
3420 {\small {\tt phy:UNAME,ioemu:DEV,MODE,}}
3422 where UNAME is the device, DEV is the device name the domain will see, and MODE is r for read-only, w for read-write. ioemu means the disk will use ioemu to virtualize the VMX disk. If not adding ioemu, it uses vbd like paravirtualized guests.
3424 If using disk image file, its form should be like
3426 {\small {\tt file:FILEPATH,ioemu:DEV,MODE}}
3428 If using more than one disk, there should be a comma between each disk entry. For example:
3430 {\scriptsize {\tt disk = ['file:/var/images/image1.img,ioemu:hda,w', 'file:/var/images/image2.img,ioemu:hdb,w']}}\\
3432 cdrom & Disk image for CD-ROM. The default is {\small {\tt /dev/cdrom}} for Domain0. Inside the VMX domain, the CD-ROM will available as device {\small {\tt /dev/hdc}}. The entry can also point to an ISO file.\\
3434 boot & Boot from floppy (a), hard disk (c) or CD-ROM (d). For example, to boot from CD-ROM, the entry should be:
3436 boot='d'\\
3438 device\_model & The device emulation tool for VMX guests. This parameter should not be changed.\\
3440 sdl & Enable SDL library for graphics, default = 0 (disabled)\\
3442 vnc & Enable VNC library for graphics, default = 1 (enabled)\\
3444 vncviewer & Enable spawning of the vncviewer (only valid when vnc=1), default = 1 (enabled)
3446 If vnc=1 and vncviewer=0, user can use vncviewer to manually connect VMX from remote. For example:
3448 {\small {\tt vncviewer domain0\_IP\_address:VMX\_domain\_id}} \\
3450 ne2000 & Enable ne2000, default = 0 (disabled; use pcnet)\\
3452 serial & Enable redirection of VMX serial output to pty device\\
3454 \end{tabular}
3456 \begin{tabular}{lp{10cm}}
3458 usb & Enable USB support without defining a specific USB device.
3459 This option defaults to 0 (disabled) unless the option usbdevice is
3460 specified in which case this option then defaults to 1 (enabled).\\
3462 usbdevice & Enable USB support and also enable support for the given
3463 device. Devices that can be specified are {\small {\tt mouse}} (a PS/2 style
3464 mouse), {\small {\tt tablet}} (an absolute pointing device) and
3465 {\small {\tt host:id1:id2}} (a physical USB device on the host machine whose
3466 ids are {\small {\tt id1}} and {\small {\tt id2}}). The advantage
3467 of {\small {\tt tablet}} is that Windows guests will automatically recognize
3468 and support this device so specifying the config line
3470 {\small
3471 \begin{verbatim}
3472 usbdevice='tablet'
3473 \end{verbatim}
3476 will create a mouse that works transparently with Windows guests under VNC.
3477 Linux doesn't recognize the USB tablet yet so Linux guests under VNC will
3478 still need the Summagraphics emulation.
3479 Details about mouse emulation are provided in section \textbf{A.4.3}.\\
3481 localtime & Set the real time clock to local time [default=0, that is, set to UTC].\\
3483 enable-audio & Enable audio support. This is under development.\\
3485 full-screen & Start in full screen. This is under development.\\
3487 nographic & Another way to redirect serial output. If enabled, no 'sdl' or 'vnc' can work. Not recommended.\\
3489 \end{tabular}
3492 \section{Creating virtual disks from scratch}
3493 \subsection{Using physical disks}
3494 If you are using a physical disk or physical disk partition, you need to install a Linux OS on the disk first. Then the boot loader should be installed in the correct place. For example {\small {\tt dev/sda}} for booting from the whole disk, or {\small {\tt /dev/sda1}} for booting from partition 1.
3496 \subsection{Using disk image files}
3497 You need to create a large empty disk image file first; then, you need to install a Linux OS onto it. There are two methods you can choose. One is directly installing it using a VMX guest while booting from the OS installation CD-ROM. The other is copying an installed OS into it. The boot loader will also need to be installed.
3499 \subsubsection*{To create the image file:}
3500 The image size should be big enough to accommodate the entire OS. This example assumes the size is 1G (which is probably too small for most OSes).
3502 {\small {\tt \# dd if=/dev/zero of=hd.img bs=1M count=1 seek=1023}}
3504 \subsubsection*{To directly install Linux OS into an image file using a VMX guest:}
3506 Install Xen and create VMX with the original image file with booting from CD-ROM. Then it is just like a normal Linux OS installation. The VMX configuration file should have these two entries before creating:
3508 {\small {\tt cdrom='/dev/cdrom'
3509 boot='d'}}
3511 If this method does not succeed, you can choose the following method of copying an installed Linux OS into an image file.
3513 \subsubsection*{To copy a installed OS into an image file:}
3514 Directly installing is an easier way to make partitions and install an OS in a disk image file. But if you want to create a specific OS in your disk image, then you will most likely want to use this method.
3516 \begin{enumerate}
3517 \item {\bfseries Install a normal Linux OS on the host machine}\\
3518 You can choose any way to install Linux, such as using yum to install Red Hat Linux or YAST to install Novell SuSE Linux. The rest of this example assumes the Linux OS is installed in {\small {\tt /var/guestos/}}.
3520 \item {\bfseries Make the partition table}\\
3521 The image file will be treated as hard disk, so you should make the partition table in the image file. For example:
3523 {\scriptsize {\tt \# losetup /dev/loop0 hd.img\\
3524 \# fdisk -b 512 -C 4096 -H 16 -S 32 /dev/loop0\\
3525 press 'n' to add new partition\\
3526 press 'p' to choose primary partition\\
3527 press '1' to set partition number\\
3528 press "Enter" keys to choose default value of "First Cylinder" parameter.\\
3529 press "Enter" keys to choose default value of "Last Cylinder" parameter.\\
3530 press 'w' to write partition table and exit\\
3531 \# losetup -d /dev/loop0}}
3533 \item {\bfseries Make the file system and install grub}\\
3534 {\scriptsize {\tt \# ln -s /dev/loop0 /dev/loop\\
3535 \# losetup /dev/loop0 hd.img\\
3536 \# losetup -o 16384 /dev/loop1 hd.img\\
3537 \# mkfs.ext3 /dev/loop1\\
3538 \# mount /dev/loop1 /mnt\\
3539 \# mkdir -p /mnt/boot/grub\\
3540 \# cp /boot/grub/stage* /boot/grub/e2fs\_stage1\_5 /mnt/boot/grub\\
3541 \# umount /mnt\\
3542 \# grub\\
3543 grub> device (hd0) /dev/loop\\
3544 grub> root (hd0,0)\\
3545 grub> setup (hd0)\\
3546 grub> quit\\
3547 \# rm /dev/loop\\
3548 \# losetup -d /dev/loop0\\
3549 \# losetup -d /dev/loop1}}
3551 The {\small {\tt losetup}} option {\small {\tt -o 16384}} skips the partition table in the image file. It is the number of sectors times 512. We need {\small {\tt /dev/loop}} because grub is expecting a disk device \emph{name}, where \emph{name} represents the entire disk and \emph{name1} represents the first partition.
3553 \item {\bfseries Copy the OS files to the image}\\
3554 If you have Xen installed, you can easily use {\small {\tt lomount}} instead of {\small {\tt losetup}} and {\small {\tt mount}} when coping files to some partitions. {\small {\tt lomount}} just needs the partition information.
3556 {\scriptsize {\tt \# lomount -t ext3 -diskimage hd.img -partition 1 /mnt/guest\\
3557 \# cp -ax /var/guestos/\{root,dev,var,etc,usr,bin,sbin,lib\} /mnt/guest\\
3558 \# mkdir /mnt/guest/\{proc,sys,home,tmp\}}}
3560 \item {\bfseries Edit the {\small {\tt /etc/fstab}} of the guest image}\\
3561 The fstab should look like this:
3563 {\scriptsize {\tt \# vim /mnt/guest/etc/fstab\\
3564 /dev/hda1 / ext3 defaults 1 1\\
3565 none /dev/pts devpts gid=5,mode=620 0 0\\
3566 none /dev/shm tmpfs defaults 0 0\\
3567 none /proc proc defaults 0 0\\
3568 none /sys sysfs efaults 0 0}}
3570 \item {\bfseries umount the image file}\\
3571 {\small {\tt \# umount /mnt/guest}}
3572 \end{enumerate}
3574 Now, the guest OS image {\small {\tt hd.img}} is ready. You can also reference {\small {\tt}} for quickstart images. But make sure to install the boot loader.
3576 \subsection{Install Windows into an Image File using a VMX guest}
3577 In order to install a Windows OS, you should keep {\small {\tt acpi=0}} in your VMX configuration file.
3579 \section{VMX Guests}
3580 \subsection{Editing the Xen VMX config file}
3581 Make a copy of the example VMX configuration file {\small {\tt /etc/xen/xmeaxmple.vmx}} and edit the line that reads
3583 {\small {\tt disk = [ 'file:/var/images/\emph{guest.img},ioemu:hda,w' ]}}
3585 replacing \emph{guest.img} with the name of the guest OS image file you just made.
3587 \subsection{Creating VMX guests}
3588 Simply follow the usual method of creating the guest, using the -f parameter and providing the filename of your VMX configuration file:\\
3590 {\small {\tt \# xend start\\
3591 \# xm create /etc/xen/vmxguest.vmx}}
3593 In the default configuration, VNC is on and SDL is off. Therefore VNC windows will open when VMX guests are created. If you want to use SDL to create VMX guests, set {\small {\tt sdl=1}} in your VMX configuration file. You can also turn off VNC by setting {\small {\tt vnc=0}}.
3595 \subsection{Mouse issues, especially under VNC}
3596 Mouse handling when using VNC is a little problematic.
3597 The problem is that the VNC viewer provides a virtual pointer which is
3598 located at an absolute location in the VNC window and only absolute
3599 coordinates are provided.
3600 The VMX device model converts these absolute mouse coordinates
3601 into the relative motion deltas that are expected by the PS/2
3602 mouse driver running in the guest.
3603 Unfortunately,
3604 it is impossible to keep these generated mouse deltas
3605 accurate enough for the guest cursor to exactly match
3606 the VNC pointer.
3607 This can lead to situations where the guest's cursor
3608 is in the center of the screen and there's no way to
3609 move that cursor to the left
3610 (it can happen that the VNC pointer is at the left
3611 edge of the screen and,
3612 therefore,
3613 there are no longer any left mouse deltas that
3614 can be provided by the device model emulation code.)
3616 To deal with these mouse issues there are 4 different
3617 mouse emulations available from the VMX device model:
3619 \begin{description}
3620 \item[PS/2 mouse over the PS/2 port.]
3621 This is the default mouse
3622 that works perfectly well under SDL.
3623 Under VNC the guest cursor will get
3624 out of sync with the VNC pointer.
3625 When this happens you can re-synchronize
3626 the guest cursor to the VNC pointer by
3627 holding down the
3628 \textbf{left-ctl}
3629 and
3630 \textbf{left-alt}
3631 keys together.
3632 While these keys are down VNC pointer motions
3633 will not be reported to the guest so
3634 that the VNC pointer can be moved
3635 to a place where it is possible
3636 to move the guest cursor again.
3638 \item[Summagraphics mouse over the serial port.]
3639 The device model also provides emulation
3640 for a Summagraphics tablet,
3641 an absolute pointer device.
3642 This emulation is provided over the second
3643 serial port,
3644 \textbf{/dev/ttyS1}
3645 for Linux guests and
3646 \textbf{COM2}
3647 for Windows guests.
3648 Unfortunately,
3649 neither Linux nor Windows provides
3650 default support for the Summagraphics
3651 tablet so the guest will have to be
3652 manually configured for this mouse.
3654 \textbf{Linux configuration.}
3656 First,
3657 configure the GPM service to use the Summagraphics tablet.
3658 This can vary between distributions but,
3659 typically,
3660 all that needs to be done is modify the file
3661 \path{/etc/sysconfig/mouse} to contain the lines:
3663 {\small
3664 \begin{verbatim}
3665 MOUSETYPE="summa"
3667 DEVICE=/dev/ttyS1
3668 \end{verbatim}
3671 and then restart the GPM daemon.
3673 Next,
3674 modify the X11 config
3675 \path{/etc/X11/xorg.conf}
3676 to support the Summgraphics tablet by replacing
3677 the input device stanza with the following:
3679 {\small
3680 \begin{verbatim}
3681 Section "InputDevice"
3682 Identifier "Mouse0"
3683 Driver "summa"
3684 Option "Device" "/dev/ttyS1"
3685 Option "InputFashion" "Tablet"
3686 Option "Mode" "Absolute"
3687 Option "Name" "EasyPen"
3688 Option "Compatible" "True"
3689 Option "Protocol" "Auto"
3690 Option "SendCoreEvents" "on"
3691 Option "Vendor" "GENIUS"
3692 EndSection
3693 \end{verbatim}
3696 Restart X and the X cursor should now properly
3697 track the VNC pointer.
3700 \textbf{Windows configuration.}
3702 Get the file
3703 \path{}
3704 and execute that file on the guest,
3705 answering the questions as follows:
3707 \begin{enumerate}
3708 \item When the program asks for \textbf{model},
3709 scroll down and selese \textbf{SummaSketch (MM Compatible)}.
3711 \item When the program asks for \textbf{COM Port} specify \textbf{com2}.
3713 \item When the programs asks for a \textbf{Cursor Type} specify
3714 \textbf{4 button cursor/puck}.
3716 \item The guest system will then reboot and,
3717 when it comes back up,
3718 the guest cursor will now properly track
3719 the VNC pointer.
3720 \end{enumerate}
3722 \item[PS/2 mouse over USB port.]
3723 This is just the same PS/2 emulation except it is
3724 provided over a USB port.
3725 This emulation is enabled by the configuration flag:
3726 {\small
3727 \begin{verbatim}
3728 usbdevice='mouse'
3729 \end{verbatim}
3732 \item[USB tablet over USB port.]
3733 The USB tablet is an absolute pointing device
3734 that has the advantage that it is automatically
3735 supported under Windows guests,
3736 although Linux guests still require some
3737 manual configuration.
3738 This mouse emulation is enabled by the
3739 configuration flag:
3740 {\small
3741 \begin{verbatim}
3742 usbdevice='tablet'
3743 \end{verbatim}
3746 \textbf{Linux configuration.}
3748 Unfortunately,
3749 there is no GPM support for the
3750 USB tablet at this point in time.
3751 If you intend to use a GPM pointing
3752 device under VNC you should
3753 configure the guest for Summagraphics
3754 emulation.
3756 Support for X11 is available by following
3757 the instructions at\\
3758 \verb+\\
3759 with one minor change.
3760 The
3761 \path{xorg.conf}
3762 given in those instructions
3763 uses the wrong values for the X \& Y minimums and maximums,
3764 use the following config stanza instead:
3766 {\small
3767 \begin{verbatim}
3768 Section "InputDevice"
3769 Identifier "Tablet"
3770 Driver "evtouch"
3771 Option "Device" "/dev/input/event2"
3772 Option "DeviceName" "touchscreen"
3773 Option "MinX" "0"
3774 Option "MinY" "0"
3775 Option "MaxX" "32256"
3776 Option "MaxY" "32256"
3777 Option "ReportingMode" "Raw"
3778 Option "Emulate3Buttons"
3779 Option "Emulate3Timeout" "50"
3780 Option "SendCoreEvents" "On"
3781 EndSection
3782 \end{verbatim}
3785 \textbf{Windows configuration.}
3787 Just enabling the USB tablet in the
3788 guest's configuration file is sufficient,
3789 Windows will automatically recognize and
3790 configure device drivers for this
3791 pointing device.
3793 \end{description}
3795 \subsection{USB Support}
3796 There is support for an emulated USB mouse,
3797 an emulated USB tablet
3798 and physical low speed USB devices
3799 (support for high speed USB 2.0 devices is
3800 still under development).
3802 \begin{description}
3803 \item[USB PS/2 style mouse.]
3804 Details on the USB mouse emulation are
3805 given in sections
3806 \textbf{A.2}
3807 and
3808 \textbf{A.4.3}.
3809 Enabling USB PS/2 style mouse emulation
3810 is just a matter of adding the line
3812 {\small
3813 \begin{verbatim}
3814 usbdevice='mouse'
3815 \end{verbatim}
3818 to the configuration file.
3819 \item[USB tablet.]
3820 Details on the USB tablet emulation are
3821 given in sections
3822 \textbf{A.2}
3823 and
3824 \textbf{A.4.3}.
3825 Enabling USB tablet emulation
3826 is just a matter of adding the line
3828 {\small
3829 \begin{verbatim}
3830 usbdevice='tablet'
3831 \end{verbatim}
3834 to the configuration file.
3835 \item[USB physical devices.]
3836 Access to a physical (low speed) USB device
3837 is enabled by adding a line of the form
3839 {\small
3840 \begin{verbatim}
3841 usbdevice='host:vid:pid'
3842 \end{verbatim}
3845 into the the configuration file.\footnote{
3846 There is an alternate
3847 way of specifying a USB device that
3848 uses the syntax
3849 \textbf{host:bus.addr}
3850 but this syntax suffers from
3851 a major problem that makes
3852 it effectively useless.
3853 The problem is that the
3854 \textbf{addr}
3855 portion of this address
3856 changes every time the USB device
3857 is plugged into the system.
3858 For this reason this addressing
3859 scheme is not recommended and
3860 will not be documented further.
3862 \textbf{vid}
3863 and
3864 \textbf{pid}
3865 are a
3866 product id and
3867 vendor id
3868 that uniquely identify
3869 the USB device.
3870 These ids can be identified
3871 in two ways:
3873 \begin{enumerate}
3874 \item Through the control window.
3875 As described in section
3876 \textbf{A.4.6}
3877 the control window
3878 is activated by pressing
3879 \textbf{ctl-alt-2}
3880 in the guest VGA window.
3881 As long as USB support is
3882 enabled in the guest by including
3883 the config file line
3884 {\small
3885 \begin{verbatim}
3886 usb=1
3887 \end{verbatim}
3889 then executing the command
3890 {\small
3891 \begin{verbatim}
3892 info usbhost
3893 \end{verbatim}
3895 in the control window
3896 will display a list of all
3897 usb devices and their ids.
3898 For example,
3899 this output:
3900 {\small
3901 \begin{verbatim}
3902 Device 1.3, speed 1.5 Mb/s
3903 Class 00: USB device 04b3:310b
3904 \end{verbatim}
3906 was created from a USB mouse with
3907 vendor id
3908 \textbf{04b3}
3909 and product id
3910 \textbf{310b}.
3911 This device could be made available
3912 to the VMX guest by including the
3913 config file entry
3914 {\small
3915 \begin{verbatim}
3916 usbdevice='host:04be:310b'
3917 \end{verbatim}
3920 It is also possible to
3921 enable access to a USB
3922 device dynamically through
3923 the control window.
3924 The control window command
3925 {\small
3926 \begin{verbatim}
3927 usb_add host:vid:pid
3928 \end{verbatim}
3930 will also allow access to a
3931 USB device with vendor id
3932 \textbf{vid}
3933 and product id
3934 \textbf{pid}.
3935 \item Through the
3936 \path{/proc} file system.
3937 The contents of the pseudo file
3938 \path{/proc/bus/usb/devices}
3939 can also be used to identify
3940 vendor and product ids.
3941 Looking at this file,
3942 the line starting with
3943 \textbf{P:}
3944 has a field
3945 \textbf{Vendor}
3946 giving the vendor id and
3947 another field
3948 \textbf{ProdID}
3949 giving the product id.
3950 The contents of
3951 \path{/proc/bus/usb/devices}
3952 for the example mouse is as
3953 follows:
3954 {\small
3955 \begin{verbatim}
3956 T: Bus=01 Lev=01 Prnt=01 Port=01 Cnt=02 Dev#= 3 Spd=1.5 MxCh= 0
3957 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
3958 P: Vendor=04b3 ProdID=310b Rev= 1.60
3959 C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=100mA
3960 I: If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=01 Prot=02 Driver=(none)
3961 E: Ad=81(I) Atr=03(Int.) MxPS= 4 Ivl=10ms
3962 \end{verbatim}
3964 Note that the
3965 \textbf{P:}
3966 line correctly identifies the
3967 vendor id and product id
3968 for this mouse as
3969 \textbf{04b3:310b}.
3970 \end{enumerate}
3971 There is one other issue to
3972 be aware of when accessing a
3973 physical USB device from the guest.
3974 The Dom0 kernel must not have
3975 a device driver loaded for
3976 the device that the guest wishes
3977 to access.
3978 This means that the Dom0
3979 kernel must not have that
3980 device driver compiled into
3981 the kernel or,
3982 if using modules,
3983 that driver module must
3984 not be loaded.
3985 Note that this is the device
3986 specific USB driver that must
3987 not be loaded,
3988 either the
3989 \textbf{UHCI}
3990 or
3991 \textbf{OHCI}
3992 USB controller driver must
3993 still be loaded.
3995 Going back to the USB mouse
3996 as an example,
3997 if \textbf{lsmod}
3998 gives the output:
4000 {\small
4001 \begin{verbatim}
4002 Module Size Used by
4003 usbmouse 4128 0
4004 usbhid 28996 0
4005 uhci_hcd 35409 0
4006 \end{verbatim}
4009 then the USB mouse is being
4010 used by the Dom0 kernel and is
4011 not available to the guest.
4012 Executing the command
4013 \textbf{rmmod usbhid}\footnote{
4014 Turns out the
4015 \textbf{usbhid}
4016 driver is the significant
4017 one for the USB mouse,
4018 the presence or absence of
4019 the module
4020 \textbf{usbmouse}
4021 has no effect on whether or
4022 not the guest can see a USB mouse.}
4023 will remove the USB mouse
4024 driver from the Dom0 kernel
4025 and the mouse will now be
4026 accessible by the VMX guest.
4028 Be aware the the Linux USB
4029 hotplug system will reload
4030 the drivers if a USB device
4031 is removed and plugged back
4032 in.
4033 This means that just unloading
4034 the driver module might not
4035 be sufficient if the USB device
4036 is removed and added back.
4037 A more reliable technique is
4038 to first
4039 \textbf{rmmod}
4040 the driver and then rename the
4041 driver file in the
4042 \path{/lib/modules}
4043 directory,
4044 just to make sure it doesn't get
4045 reloaded.
4046 \end{description}
4048 \subsection{Destroy VMX guests}
4049 VMX guests can be destroyed in the same way as can paravirtualized guests. We recommend that you type the command
4051 {\small {\tt poweroff}}
4053 in the VMX guest's console first to prevent data loss. Then execute the command
4055 {\small {\tt xm destroy \emph{vmx\_guest\_id} }}
4057 at the Domain0 console.
4059 \subsection{VMX window (X or VNC) Hot Key}
4060 If you are running in the X environment after creating a VMX guest, an X window is created. There are several hot keys for control of the VMX guest that can be used in the window.
4062 {\bfseries Ctrl+Alt+2} switches from guest VGA window to the control window. Typing {\small {\tt help }} shows the control commands help. For example, 'q' is the command to destroy the VMX guest.\\
4063 {\bfseries Ctrl+Alt+1} switches back to VMX guest's VGA.\\
4064 {\bfseries Ctrl+Alt+3} switches to serial port output. It captures serial output from the VMX guest. It works only if the VMX guest was configured to use the serial port. \\
4066 \subsection{Save/Restore and Migration}
4067 VMX guests currently cannot be saved and restored, nor migrated. These features are currently under active development.
4069 \chapter{Vnets - Domain Virtual Networking}
4071 Xen optionally supports virtual networking for domains using {\em vnets}.
4072 These emulate private LANs that domains can use. Domains on the same
4073 vnet can be hosted on the same machine or on separate machines, and the
4074 vnets remain connected if domains are migrated. Ethernet traffic
4075 on a vnet is tunneled inside IP packets on the physical network. A vnet is a virtual
4076 network and addressing within it need have no relation to addressing on
4077 the underlying physical network. Separate vnets, or vnets and the physical network,
4078 can be connected using domains with more than one network interface and
4079 enabling IP forwarding or bridging in the usual way.
4081 Vnet support is included in \texttt{xm} and \xend:
4082 \begin{verbatim}
4083 # xm vnet-create <config>
4084 \end{verbatim}
4085 creates a vnet using the configuration in the file \verb|<config>|.
4086 When a vnet is created its configuration is stored by \xend and the vnet persists until it is
4087 deleted using
4088 \begin{verbatim}
4089 # xm vnet-delete <vnetid>
4090 \end{verbatim}
4091 The vnets \xend knows about are listed by
4092 \begin{verbatim}
4093 # xm vnet-list
4094 \end{verbatim}
4095 More vnet management commands are available using the
4096 \texttt{vn} tool included in the vnet distribution.
4098 The format of a vnet configuration file is
4099 \begin{verbatim}
4100 (vnet (id <vnetid>)
4101 (bridge <bridge>)
4102 (vnetif <vnet interface>)
4103 (security <level>))
4104 \end{verbatim}
4105 White space is not significant. The parameters are:
4106 \begin{itemize}
4107 \item \verb|<vnetid>|: vnet id, the 128-bit vnet identifier. This can be given
4108 as 8 4-digit hex numbers separated by colons, or in short form as a single 4-digit hex number.
4109 The short form is the same as the long form with the first 7 fields zero.
4110 Vnet ids must be non-zero and id 1 is reserved.
4112 \item \verb|<bridge>|: the name of a bridge interface to create for the vnet. Domains
4113 are connected to the vnet by connecting their virtual interfaces to the bridge.
4114 Bridge names are limited to 14 characters by the kernel.
4116 \item \verb|<vnetif>|: the name of the virtual interface onto the vnet (optional). The
4117 interface encapsulates and decapsulates vnet traffic for the network and is attached
4118 to the vnet bridge. Interface names are limited to 14 characters by the kernel.
4120 \item \verb|<level>|: security level for the vnet (optional). The level may be one of
4121 \begin{itemize}
4122 \item \verb|none|: no security (default). Vnet traffic is in clear on the network.
4123 \item \verb|auth|: authentication. Vnet traffic is authenticated using IPSEC
4124 ESP with hmac96.
4125 \item \verb|conf|: confidentiality. Vnet traffic is authenticated and encrypted
4126 using IPSEC ESP with hmac96 and AES-128.
4127 \end{itemize}
4128 Authentication and confidentiality are experimental and use hard-wired keys at present.
4129 \end{itemize}
4130 When a vnet is created its configuration is stored by \xend and the vnet persists until it is
4131 deleted using \texttt{xm vnet-delete <vnetid>}. The interfaces and bridges used by vnets
4132 are visible in the output of \texttt{ifconfig} and \texttt{brctl show}.
4134 \section{Example}
4135 If the file \path{vnet97.sxp} contains
4136 \begin{verbatim}
4137 (vnet (id 97) (bridge vnet97) (vnetif vnif97)
4138 (security none))
4139 \end{verbatim}
4140 Then \texttt{xm vnet-create vnet97.sxp} will define a vnet with id 97 and no security.
4141 The bridge for the vnet is called vnet97 and the virtual interface for it is vnif97.
4142 To add an interface on a domain to this vnet set its bridge to vnet97
4143 in its configuration. In Python:
4144 \begin{verbatim}
4145 vif="bridge=vnet97"
4146 \end{verbatim}
4147 In sxp:
4148 \begin{verbatim}
4149 (dev (vif (mac aa:00:00:01:02:03) (bridge vnet97)))
4150 \end{verbatim}
4151 Once the domain is started you should see its interface in the output of \texttt{brctl show}
4152 under the ports for \texttt{vnet97}.
4154 To get best performance it is a good idea to reduce the MTU of a domain's interface
4155 onto a vnet to 1400. For example using \texttt{ifconfig eth0 mtu 1400} or putting
4156 \texttt{MTU=1400} in \texttt{ifcfg-eth0}.
4157 You may also have to change or remove cached config files for eth0 under
4158 \texttt{/etc/sysconfig/networking}. Vnets work anyway, but performance can be reduced
4159 by IP fragmentation caused by the vnet encapsulation exceeding the hardware MTU.
4161 \section{Installing vnet support}
4162 Vnets are implemented using a kernel module, which needs to be loaded before
4163 they can be used. You can either do this manually before starting \xend, using the
4164 command \texttt{vn insmod}, or configure \xend to use the \path{network-vnet}
4165 script in the xend configuration file \texttt{/etc/xend/xend-config.sxp}:
4166 \begin{verbatim}
4167 (network-script network-vnet)
4168 \end{verbatim}
4169 This script insmods the module and calls the \path{network-bridge} script.
4171 The vnet code is not compiled and installed by default.
4172 To compile the code and install on the current system
4173 use \texttt{make install} in the root of the vnet source tree,
4174 \path{tools/vnet}. It is also possible to install to an installation
4175 directory using \texttt{make dist}. See the \path{Makefile} in
4176 the source for details.
4178 The vnet module creates vnet interfaces \texttt{vnif0002},
4179 \texttt{vnif0003} and \texttt{vnif0004} by default. You can test that
4180 vnets are working by configuring IP addresses on these interfaces
4181 and trying to ping them across the network. For example, using machines
4182 hostA and hostB:
4183 \begin{verbatim}
4184 hostA# ifconfig vnif0004 up
4185 hostB# ifconfig vnif0004 up
4186 hostB# ping
4187 \end{verbatim}
4189 The vnet implementation uses IP multicast to discover vnet interfaces, so
4190 all machines hosting vnets must be reachable by multicast. Network switches
4191 are often configured not to forward multicast packets, so this often
4192 means that all machines using a vnet must be on the same LAN segment,
4193 unless you configure vnet forwarding.
4195 You can test multicast coverage by pinging the vnet multicast address:
4196 \begin{verbatim}
4197 # ping -b
4198 \end{verbatim}
4199 You should see replies from all machines with the vnet module running.
4200 You can see if vnet packets are being sent or received by dumping traffic
4201 on the vnet UDP port:
4202 \begin{verbatim}
4203 # tcpdump udp port 1798
4204 \end{verbatim}
4206 If multicast is not being forwarded between machines you can configure
4207 multicast forwarding using vn. Suppose we have machines hostA on
4208 and hostB on and that multicast is not forwarded between them.
4209 We use vn to configure each machine to forward to the other:
4210 \begin{verbatim}
4211 hostA# vn peer-add hostB
4212 hostB# vn peer-add hostA
4213 \end{verbatim}
4214 Multicast forwarding needs to be used carefully - you must avoid creating forwarding
4215 loops. Typically only one machine on a subnet needs to be configured to forward,
4216 as it will forward multicasts received from other machines on the subnet.
4218 %% Chapter Glossary of Terms moved to glossary.tex
4219 \chapter{Glossary of Terms}
4221 \begin{description}
4223 \item[Domain] A domain is the execution context that contains a
4224 running {\bf virtual machine}. The relationship between virtual
4225 machines and domains on Xen is similar to that between programs and
4226 processes in an operating system: a virtual machine is a persistent
4227 entity that resides on disk (somewhat like a program). When it is
4228 loaded for execution, it runs in a domain. Each domain has a {\bf
4229 domain ID}.
4231 \item[Domain 0] The first domain to be started on a Xen machine.
4232 Domain 0 is responsible for managing the system.
4234 \item[Domain ID] A unique identifier for a {\bf domain}, analogous to
4235 a process ID in an operating system.
4237 \item[Full virtualization] An approach to virtualization which
4238 requires no modifications to the hosted operating system, providing
4239 the illusion of a complete system of real hardware devices.
4241 \item[Hypervisor] An alternative term for {\bf VMM}, used because it
4242 means `beyond supervisor', since it is responsible for managing
4243 multiple `supervisor' kernels.
4245 \item[Live migration] A technique for moving a running virtual machine
4246 to another physical host, without stopping it or the services
4247 running on it.
4249 \item[Paravirtualization] An approach to virtualization which requires
4250 modifications to the operating system in order to run in a virtual
4251 machine. Xen uses paravirtualization but preserves binary
4252 compatibility for user space applications.
4254 \item[Shadow pagetables] A technique for hiding the layout of machine
4255 memory from a virtual machine's operating system. Used in some {\bf
4256 VMMs} to provide the illusion of contiguous physical memory, in
4257 Xen this is used during {\bf live migration}.
4259 \item[Virtual Block Device] Persistent storage available to a virtual
4260 machine, providing the abstraction of an actual block storage device.
4261 {\bf VBD}s may be actual block devices, filesystem images, or
4262 remote/network storage.
4264 \item[Virtual Machine] The environment in which a hosted operating
4265 system runs, providing the abstraction of a dedicated machine. A
4266 virtual machine may be identical to the underlying hardware (as in
4267 {\bf full virtualization}, or it may differ, as in {\bf
4268 paravirtualization}).
4270 \item[VMM] Virtual Machine Monitor - the software that allows multiple
4271 virtual machines to be multiplexed on a single physical machine.
4273 \item[Xen] Xen is a paravirtualizing virtual machine monitor,
4274 developed primarily by the Systems Research Group at the University
4275 of Cambridge Computer Laboratory.
4277 \item[XenLinux] A name for the port of the Linux kernel that
4278 runs on Xen.
4280 \end{description}
4283 \end{document}
4286 %% Other stuff without a home
4288 %% Instructions Re Python API
4290 %% Other Control Tasks using Python
4291 %% ================================
4293 %% A Python module 'Xc' is installed as part of the tools-install
4294 %% process. This can be imported, and an 'xc object' instantiated, to
4295 %% provide access to privileged command operations:
4297 %% # import Xc
4298 %% # xc =
4299 %% # dir(xc)
4300 %% # help(xc.domain_create)
4302 %% In this way you can see that the class 'xc' contains useful
4303 %% documentation for you to consult.
4305 %% A further package of useful routines (xenctl) is also installed:
4307 %% # import xenctl.utils
4308 %% # help(xenctl.utils)
4310 %% You can use these modules to write your own custom scripts or you
4311 %% can customise the scripts supplied in the Xen distribution.
4315 % Explain about AGP GART
4318 %% If you're not intending to configure the new domain with an IP
4319 %% address on your LAN, then you'll probably want to use NAT. The
4320 %% 'xen_nat_enable' installs a few useful iptables rules into domain0
4321 %% to enable NAT. [NB: We plan to support RSIP in future]
4325 %% Installing the file systems from the CD
4326 %% =======================================
4328 %% If you haven't got an existing Linux installation onto which you
4329 %% can just drop down the Xen and Xenlinux images, then the file
4330 %% systems on the CD provide a quick way of doing an install. However,
4331 %% you would be better off in the long run doing a proper install of
4332 %% your preferred distro and installing Xen onto that, rather than
4333 %% just doing the hack described below:
4335 %% Choose one or two partitions, depending on whether you want a
4336 %% separate /usr or not. Make file systems on it/them e.g.:
4337 %% mkfs -t ext3 /dev/hda3
4338 %% [or mkfs -t ext2 /dev/hda3 && tune2fs -j /dev/hda3 if using an old
4339 %% version of mkfs]
4341 %% Next, mount the file system(s) e.g.:
4342 %% mkdir /mnt/root && mount /dev/hda3 /mnt/root
4343 %% [mkdir /mnt/usr && mount /dev/hda4 /mnt/usr]
4345 %% To install the root file system, simply untar /usr/XenDemoCD/root.tar.gz:
4346 %% cd /mnt/root && tar -zxpf /usr/XenDemoCD/root.tar.gz
4348 %% You'll need to edit /mnt/root/etc/fstab to reflect your file system
4349 %% configuration. Changing the password file (etc/shadow) is probably a
4350 %% good idea too.
4352 %% To install the usr file system, copy the file system from CD on
4353 %% /usr, though leaving out the "XenDemoCD" and "boot" directories:
4354 %% cd /usr && cp -a X11R6 etc java libexec root src bin dict kerberos
4355 %% local sbin tmp doc include lib man share /mnt/usr
4357 %% If you intend to boot off these file systems (i.e. use them for
4358 %% domain 0), then you probably want to copy the /usr/boot
4359 %% directory on the cd over the top of the current symlink to /boot
4360 %% on your root filesystem (after deleting the current symlink)
4361 %% i.e.:
4362 %% cd /mnt/root ; rm boot ; cp -a /usr/boot .