Xen v3.0 用户手册

       

1. Introduction(介绍)

Xen is an open-source para-virtualizing virtual machine monitor (VMM), or ``hypervisor'', for the x86 processor architecture. Xen can securely execute multiple virtual machines on a single physical system with close-to-native performance. Xen facilitates enterprise-grade functionality, including:

Xen 是一个开放源代码的para-virtualizing虚拟机(VMM),或管理程序,是为x86架构的机器而设计的。Xen 可以在一套物理硬件上安全的执行多个虚拟机

  • Virtual machines with performance close to native hardware. (虚拟机的性能更接近真实硬件环境)
  • Live migration of running virtual machines between physical hosts. (在真实物理环境的平台和虚拟平台间自由切换)
  • Up to 32 virtual CPUs per guest virtual machine, with VCPU hotplug.(在每个客户虚拟机支持到 32个虚拟CPU,通过 VCPU热插拔)
  • x86/32, x86/32 with PAE, and x86/64 platform support.x86/32,支持PAE指令集的x86/32, x86/64平台)
  • Intel Virtualization Technology (VT-x) for unmodified guest operating systems (including Microsoft Windows).(通过Intel 虚拟支持VT的支持来用虚拟原始操作系统(未经修改的)支持(包括Microsoft Windows
  • Excellent hardware support (supports almost all Linux device drivers).(优秀的硬件支持.支持几乎所有的Linux设备驱动)

1.1 Usage Scenarios(应用范围)

Usage scenarios for Xen include:
Xen
的应用范围包括:

Server Consolidation. (服务器整合)

Move multiple servers onto a single physical host with performance and fault isolation provided at the virtual machine boundaries.

在虚拟机范围内,在一台物理主机上安装多个服务器, 用于演示及故障隔绝。

Hardware Independence.(无硬件依赖)

Allow legacy applications and operating systems to exploit new hardware.(允许应用程序和操作系统对新硬件的移值测试)

Multiple OS configurations.(多操作系统配置)

Run multiple operating systems simultaneously, for development or testing purposes.(以开发和测试为目的,同时运行多个操作系统)

Kernel Development.(内核开发)

Test and debug kernel modifications in a sand-boxed virtual machine -- no need for a separate test machine.(在虚拟机的沙盒中,做内核的测试和调试,无需为了测试而半独架设一台独立的机器)

Cluster Computing.(集群运算)

Management at VM granularity provides more flexibility than separately managing each physical host, but better control and isolation than single-system image solutions, particularly by using live migration for load balancing.  (和单独的管理每个物理主机相比较,VM级管理更加灵活,在负载均衡方面,更易于控制,和隔离).

Hardware support for custom OSes.(为客户操作系统提供硬件技术支持)

Allow development of new OSes while benefiting from the wide-ranging hardware support of existing OSes such as Linux. (可以开发新的操作系统, 以得益于现存操作系统的广泛硬件支持,比如Linux.

1.2 Operating System Support (操作系统支持)

Para-virtualization permits very high performance virtualization, even on architectures like x86 that are traditionally very hard to virtualize.

This approach requires operating systems to be ported to run on Xen. Porting an OS to run on Xen is similar to supporting a new hardware platform, however the process is simplified because the para-virtual machine architecture is very similar to the underlying native hardware. Even though operating system kernels must explicitly support Xen, a key feature is that user space applications and libraries do not require modification.

With hardware CPU virtualization as provided by Intel VT and AMD SVM technology, the ability to run an unmodified guest OS kernel is available. No porting of the OS is required, although some additional driver support is necessary within Xen itself. Unlike traditional full virtualization hypervisors, which suffer a tremendous performance overhead, the combination of Xen and VT or Xen and Pacifica technology complement one another to offer superb performance for para-virtualized guest operating systems and full support for unmodified guests running natively on the processor. Full support for VT and Pacifica chipsets will appear in early 2006.

Paravirtualized Xen support is available for increasingly many operating systems: currently, mature Linux support is available and included in the standard distribution. Other OS ports--including NetBSD, FreeBSD and Solaris x86 v10--are nearing completion.

1.3 Hardware Support(硬件支持)

Xen currently runs on the x86 architecture, requiring a ``P6'' or newer processor (e.g. Pentium Pro, Celeron, Pentium II, Pentium III, Pentium IV, Xeon, AMD Athlon, AMD Duron). Multiprocessor machines are supported, and there is support for HyperThreading (SMT). In addition, ports to IA64 and Power architectures are in progress.Xen

目前运行在x86架构的机器上,需要P6或更新的处理器(比如 Pentium Pro, Celeron, Pentium II, Pentium III, Pentium IV, Xeon, AMD Athlon, AMD Duron)。支持多处理器,并且支持超线程(SMT)。另外对IA64Power架构的开发也在进行中。

The default 32-bit Xen supports up to 4GB of memory. However Xen 3.0 adds support for Intel's Physical Addressing Extensions (PAE), which enable x86/32 machines to address up to 64 GB of physical memory. Xen 3.0 also supports x86/64 platforms such as Intel EM64T and AMD Opteron which can currently address up to 1TB of physical memory.

32Xen支持最大4GB内存。可是Xen 3.0 Intel处理器物理指令集(PAE)提供支持,这样就能使x86/32架构的机器支持到64GB的物理内存。Xen 3.0也能支持x86/64 平台支持,比如 Intel EM64T AMD Opteron能支持1TB的物理 内存以上;

Xen offloads most of the hardware support issues to the guest OS running in the Domain 0 management virtual machine. Xen itself contains only the code required to detect and start secondary processors, set up interrupt routing, and perform PCI bus enumeration. Device drivers run within a privileged guest OS rather than within Xen itself. This approach provides compatibility with the majority of device hardware supported by Linux. The default XenLinux build contains support for most server-class network and disk hardware, but you can add support for other hardware by configuring your XenLinux kernel in the normal way.

1.4 Structure of a Xen-Based System(基于Xen的操作系统架构)

A Xen system has multiple layers, the lowest and most privileged of which is Xen itself.

一个Xen系统拥有多个层,最底层和最高特权层是 Xen程序本身。

Xen may host multiple guest operating systems, each of which is executed within a secure virtual machine. In Xen terminology, a domain. Domains are scheduled by Xen to make effective use of the available physical CPUs. Each guest OS manages its own applications. This management includes the responsibility of scheduling each application within the time allotted to the VM by Xen.

Xen 可以管理多个客户操作系统,每个操作系统都能在一个安全的虚拟机中实现。在Xen的术语中,DomainXen控制,以高效的利用CPU的物理资源。每个客户操作系统可以管理它自身的应用。这种管理包括每个程序在规定时间内的响应到执行,是通过Xen调度到虚拟机中实现。

The first domain, domain 0, is created automatically when the system boots and has special management privileges. Domain 0 builds other domains and manages their virtual devices. It also performs administrative tasks such as suspending, resuming and migrating other virtual machines.

第一个domain,也就是domain 0(注:其实它就是第一个虚拟的客户系统),是在系统引导时自动创建,它拥有特殊的管理权限。Domain 0 可以构建其它的更多的Domain ,并管理虚拟设备。它还能执行管理任务,比如虚拟机的体眠、唤醒和迁移其它虚拟机。

Within domain 0, a process called xend runs to manage the system. Xend is responsible for managing virtual machines and providing access to their consoles. Commands are issued to xend over an HTTP interface, via a command-line tool.

一个被称为xend的服务器进程通过domain 0来管理系统,Xend 负责管理众多的虚拟主机,并且提供进入这些系统的控制台。命令经一个命令行的工具通过一个HTTP的接口被传送到xend

1.5 History(历史)

Xen was originally developed by the Systems Research Group at the University of Cambridge Computer Laboratory as part of the XenoServers project, funded by the UK-EPSRC.

XenoServers aim to provide a ``public infrastructure for global distributed computing''. Xen plays a key part in that, allowing one to efficiently partition a single machine to enable multiple independent clients to run their operating systems and applications in an environment. This environment provides protection, resource isolation and accounting. The project web page contains further information along with pointers to papers and technical reports: http://www.cl.cam.ac.uk/xeno

Xen has grown into a fully-fledged project in its own right, enabling us to investigate interesting research issues regarding the best techniques for virtualizing resources such as the CPU, memory, disk and network. Project contributors now include XenSource, Intel, IBM, HP, AMD, Novell, RedHat.

Xen was first described in a paper presented at SOSP in 2003 1.1, and the first public release (1.0) was made that October. Since then, Xen has significantly matured and is now used in production scenarios on many sites.

1.6 What's New(最新特性)

Xen 3.0.0 offersXen 3.0.0 拥有):

  • Support for up to 32-way SMP guest operating systems (支持最多32路的处理器的客户虚拟系统)
  • Intel (Physical Addressing Extensions) PAE to support 32-bit servers with more than 4GB physical memory
  • x86/64 support (Intel EM64T, AMD Opteron)
  • Intel VT-x support to enable the running of unmodified guest operating systems (Windows XP/ 2003 , Legacy Linux)
  • Enhanced control tools
  • Improved ACPI support 
  • AGP/DRM graphics

Xen 3.0 features greatly enhanced hardware support, configuration flexibility, usability and a larger complement of supported operating systems. This latest release takes Xen a step closer to being the definitive open source solution for virtualization.

1 Installation(安装)

2. Basic Installation(基础安装)

The Xen distribution includes three main components: Xen itself, ports of Linux and NetBSD to run on Xen, and the userspace tools required to manage a Xen-based system. This chapter describes how to install the Xen 3.0 distribution from source. Alternatively, there may be pre-built packages available as part of your operating system distribution.

Xen 发行版包括三个主要的部件:Xen本身,在Xen上运行LinuxNetBSD的接口,及管理基于Xen的系统的用户工具。这一节我们讲述以源代码的安装方式安装Xen 3.0 。当然,您也可以根据您所用的发行版来选择已经预编译好的Xen的软件包


2.1 Prerequisites
 (准备工作)

The following is a full list of prerequisites. Items marked ` ' are required by the xend control tools, and hence required if you want to run more than one virtual machine; items marked `*' are only required if you wish to build from source.

 $$

A working Linux distribution using the GRUB bootloader and running on a P6-class or newer CPU.(用GRUB的导Linux系统,并且运行在一个 P6级或更新的 CPU机器上)

The iproute2 packageiproute2软件包

The Linux bridge-utilsLinux桥接工具 )2.1 (e.g., /sbin/brctl) 

The Linux hotplug system2.2 (e.g., /sbin/hotplug and related scripts). On newer distributions, this is included alongside the Linux udev system2.3.

*

Build tools (gcc v3.2.x or v3.3.x, binutils, GNU make). {编译工具(gcc v3.2 v3.3.x binutilsGNU make)

*

Development installation of zlib (e.g., zlib-dev).zlib的开发库(例如zlib-dev)}

*

Development installation of Python v2.2 or later (e.g., python-dev).Python v2.2 或高于v2.2的版本的开发库(比如 python-dev)}

*

LATEX and transfig are required to build the documentation.

Once you have satisfied these prerequisites, you can now install either a binary or source distribution of Xen.

一旦您已经做好这些准备工作,您现在可以通过二进制包或源码包来安装Xen

2.2 Installing from Binary Tarball(通过二进制软件包安装)

Pre-built tarballs are available for download from the XenSource downloads page:
可以到XenSource 下载预编译好的二进制包,下载地址发下:

http://www.xensource.com/downloads/

Once you've downloaded the tarball, simply unpack and install:
一旦您下载了软件包,就可以轻松的解压和安装:

# tar zxvf xen-3.0-install.tgz
# cd xen-3.0-install
# sh ./install.sh

Once you've installed the binaries you need to configure your system as described in Section 2.5.
一旦您已经安装了二进制包,您需要配置您的系统,请参考 2.5的章节

2.3 Installing from RPMsRPM包安装

Pre-built RPMs are available for download from the XenSource downloads page:
可以到XenSource 下载预编译好的RPM 包,下载地址发下:

http://www.xensource.com/downloads/

Once you've downloaded the RPMs, you typically install them via the RPM commands:
一旦您下载了RPM包,可以通过RPM的管理工具来安装他们:

# rpm -iv rpmname

See the instructions and the Release Notes for each RPM set referenced at:
这里提供了每个相关RPM的介绍和发行说明

http://www.xensource.com/downloads/.

2.4 Installing from Source(通过源码包安装)

This section describes how to obtain, build and install Xen from source.
这一节主要介绍如何获取源码包并进行编译和安装;

2.4.1 Obtaining the Source(获取源码包)

The Xen source tree is available as either a compressed source tarball or as a clone of our master Mercurial repository.

Obtaining the Source Tarball(获取源码包)


Stable versions and daily snapshots of the Xen source tree are available from the Xen download page:

          稳定版和开发版的每日快照下载页:

http://www.xensource.com/downloads/

Obtaining the source via Mercurial(通过Mercurial获取源代码)


The source tree may also be obtained via the public Mercurial repository at:

可以使用公共 Mercurial库从以下地址获取代码树:

http://xenbits.xensource.com

See the instructions and the Getting Started Guide referenced at(获取介绍和指导手册):

http://www.xensource.com/downloads/

2.4.2 Building from Source(从源码包编译安装)

The top-level Xen Makefile includes a target ``world'' that will do the following:

  • Build Xen
  • 编译Xen
  • Build the control tools, including xend
  • 编译控制工具,包括xend
  • Download (if necessary) and unpack the Linux 2.6 source code, and patch it for use with Xen.
  • 下载Linux 2.6内核源码,并且为内核打补丁
  • Build a Linux kernel to use in domain 0 and a smaller unprivileged kernel, which can be used for unprivileged virtual machines.
  • 编译一个 Linux的内核,主要是用于domain 0 ,并且是一个比较小的无特权的内核。它能用于无特权的虚拟机;

After the build has completed you should have a top-level directory called dist/ in which all resulting targets will be placed. Of particular interest are the two XenLinux kernel images, one with a ``-xen0'' extension which contains hardware device drivers and drivers for Xen's virtual devices, and one with a ``-xenU'' extension that just contains the virtual ones. These are found in dist/install/boot/ along with the image for Xen itself and the configuration files used during the build.

内核编译完成后,您应该有一个顶级目录dist/,所有的编译好的包将放在这里。总共有两个内核,一个是文件名带有"_xen0"的,它包括硬件设备驱动和Xen虚拟设备。另一个内核文件扩展名带有"_xenU"的,这个内核包括虚拟设备。这些文件连同Xen本身及编译过程中所需要的配置文件位于 dist/install/boot目录中

To customize the set of kernels built you need to edit the top-level Makefile. Look for the line:

为了自定义内核配置,您需要编辑顶级目录的 Makefile 。看起来象下面的一行;

KERNELS ?= linux-2.6-xen0 linux-2.6-xenU

You can edit this line to include any set of operating system kernels which have configurations in the top-level buildconfigs/ directory.
您可以把这行加入到操作系统本身拥有的内核配置文件中,此文件位于 buildconfigs/目录;

2.4.3 Custom Kernels自义义内核

If you wish to build a customized XenLinux kernel (e.g. to support additional devices or enable distribution-required features), you can use the standard Linux configuration mechanisms, specifying that the architecture being built for is xen, e.g:
如果您想自定义编译XenLinuxmw 内核(比如支持附加设备或打开发行版的一些特性或功能),您可以用标准的Linux内核配置文件

# cd linux- 2.6.12 -xen0
# make ARCH=xen xconfig
# cd ..
# make

You can also copy an existing Linux configuration (.config) into e.g. linux- 2.6.12 -xen0 and execute:
您也可以复制已有的Linux发行版的内核配置文件。比如Linux- 2.6.12-xen0,然后执行:

# make ARCH=xen oldconfig

You may be prompted with some Xen-specific options. We advise accepting the defaults for these options.
也可以启用一些Xen的特殊选项。我们建议您用默认的选项。

Note that the only difference between the two types of Linux kernels that are built is the configuration file used for each. The ``U'' suffixed (unprivileged) versions don't contain any of the physical hardware device drivers, leading to a 30% reduction in size; hence you may prefer these for your non-privileged domains. The ``0'' suffixed privileged versions can be used to boot the system, as well as in driver domains and unprivileged domains.

注意,编译出来的两个内核是不同的。文件名中带有U的,是无特权内核,这个是用来引导被虚拟的操作系统而用的,它不包括物理硬件的驱动等。而文件名中带有0的包括物理硬件的驱动,它才是被用于引导真实操作系统的内核。 

2.4.4 Installing Generated Binaries (安装已经编译好的二进制内核)

The files produced by the build process are stored under the dist/install/ directory. To install them in their default locations, do:
当编译好内核后,他们被存放在 dist/install/目录中。我们通过如下的命令来安装:

# make install

Alternatively, users with special installation requirements may wish to install them manually by copying the files to their appropriate destinations.

用户可以根据自己的需要做以手动复制到相应的目录,这一过程是可选的。

The dist/install/boot directory will also contain the config files used for building the XenLinux kernels, and also versions of Xen and XenLinux kernels that contain debug symbols such as (xen-syms- 3.0.0 a nd vmlinux-syms-2.6.12.6-xen0) which are essential for interpreting crash dumps. Retain these files as the developers may wish to see them if you post on the mailing list.

在目录 /dist/install/boot目录中,包含编译 XenLinux内核的配置文件config ,也包含XenLinux内核的debug链接文件,比如(xen-syms- 3.0.0 vmlinux-syms-2.6.12.6 -xen0),当系统崩溃时,他们还是有必要的,因为做为开发者,他们需要这些崩溃纪录,您可以通过邮件列表发送给开发者。


2.5 Configuration
(配置)

Once you have built and installed the Xen distribution, it is simple to prepare the machine for booting and running Xen.
如果您编译并安装好了Xen的发行版,您要做一些准备工作,以让机器引导时运行Xen

2.5.1 GRUB ConfigurationGRUB的配置)

An entry should be added to grub.conf (often found under /boot/ or /boot/grub/) to allow Xen / XenLinux to boot. This file is sometimes called menu.lst, depending on your distribution. The entry should look something like the following:

编译好内核后,您应该修改grub.conf文件(这个文件大多是位于/boot/boot/grub目录中),目的是允许引导 Xen/XenLinux grub.conf有时也被称为menul.st 。在grub.confmenu.lst中应该加入类似下面的一段:

title Xen 3.0 / XenLinux 2.6
 kernel /boot/xen-3.0.gz dom0_mem=262144
 module /boot/vmlinuz-2.6-xen0 root=/dev/sda4 ro console=tty0

The kernel line tells GRUB where to find Xen itself and what boot parameters should be passed to it (in this case, setting the domain 0 memory allocation in kilobytes and the settings for the serial port). For more details on the various Xen boot parameters see Section 10.3.

kernel 一行告诉GRUB引导时能找到Xen,以及使用哪些引导参数(在这里,能设置domain 0所占用物理内存大小,其单位是kb,也能设置所占用的串口)。详细请参阅Xen 引导参数章节 10.3

The module line of the configuration describes the location of the XenLinux kernel that Xen should start and the parameters that should be passed to it. These are standard Linux parameters, identifying the root device and specifying it be initially mounted read only and instructing that console output be sent to the screen. Some distributions such as SuSE do not require the ro parameter.

module 这行是描述XenLinux内核所处的位置,这些是Linux的标准参数,比如定义root设备,指定挂载时初始化是只读,并且将控制台输出发送到屏幕上。一些发行版并不需要 ro参数,比如SuSE
To use an initrd, add another module line to the configuration, like:
要使用initrd,还需要在配置文件中添加一 module行,行如:

 module /boot/my_initrd.gz

When installing a new kernel, it is recommended that you do not delete existing menu options from menu.lst, as you may wish to boot your old Linux kernel in future, particularly if you have problems.

安装新的内核时,我们建议您不要删除GRUB启动菜单定义文件 grub.confmenu.lst中的关于老内核的引导项,当用新内核引导时可能遇到问题,或者需要老内核引导时,您可以用老内核启动系统。

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值