# Kernel image file.
kernel = "/usr/lib/xen/boot/hvmloader"
設(shè)定該HVM虛擬機的內(nèi)核鏡像文件,默認是采用宿主機上/usr/lib/xen/boot/hvmloader這個來引導(dǎo)的。
# The domain build function. HVM domain uses 'hvm'.
builder='hvm'
設(shè)定虛擬域的建立方式,一個虛擬域?qū)?yīng)了一個虛擬機,宿主機通過根域0來管理。如果是HVM虛擬機的話,這項要設(shè)定為hvm。
# Initial memory allocation (in megabytes) for the new domain.
# WARNING: Creating a domain with insufficient memory may cause out of emory errors. The domain needs enough memory to boot kernel and modules. Allocating less than 32MBs is not recommended.
memory = 128
設(shè)定虛擬機的占用的內(nèi)存,如手冊上說的,不建議設(shè)定低于32MB。
# Shadow pagetable memory for the domain, in MB.
# Should be at least 2KB per MB of domain memory, plus a few MB per vcpu.
shadow_memory = 8
設(shè)定影內(nèi)存?(這個術(shù)語的意思我還不了解,還煩請高手指點)這個配置項的默認值為8,單位MB。虛擬機每多一個VCPU就應(yīng)到增加一些。
# A name for your domain. All domains must have different names.
name = "ExampleHVMDomain"
設(shè)定虛擬機的域名實例。這個相當(dāng)于你的虛擬機在XEN內(nèi)的注冊名,可以通過xm命令操作的命名。
# 128-bit UUID for the domain. The default behavior is to generate a new UUID
# on each call to 'xm create'.
uuid = "06ed00fe-1162-4fc4-b5d8-11993ee4a8b9"
設(shè)定虛擬域的UUID標(biāo)示。默認情況下,當(dāng)收到xm create啟動命令時會自動生成一個新的UUID。
內(nèi)存和CPU參數(shù)部分:
-----------------------------------------------------------------------------
# the number of cpus guest platform has, default=1
vcpus=1
設(shè)定虛擬機的虛擬CPU數(shù)量。默認是1。
# enable/disable HVM guest PAE, default=0 (disabled)
pae=0
設(shè)定啟用或關(guān)閉HVM的PAE,默認值0表示關(guān)閉。
# enable/disable HVM guest ACPI, default=0 (disabled)
acpi=0
設(shè)定啟用或關(guān)閉HVM的ACPI,默認值0表示關(guān)閉。(注:在使用HVM安裝Windows2003這種系統(tǒng)時,必須要關(guān)閉,否則將會一直卡在一個安裝畫面中。)
# enable/disable HVM guest APIC, default=0 (disabled)
apic=0
設(shè)定啟用或關(guān)閉HVM的APCI,默認值0表示關(guān)閉。(注:在使用HVM安裝Windows2003這種系統(tǒng)時,必須要關(guān)閉,否則將會一直卡在一個安裝畫面中。)
設(shè)定虛擬機被允許使用的CPU對象。默認是無需指定而讓XEN自己來挑選的。
一些設(shè)定的方式:
cpus = "" 不指定,讓XEN自己去選擇。
cpus = "0" 指定讓虛擬機的VCPU運行在宿主機的CPU0(第一個CPU,0號)。
cpus = "0-3" 指定讓虛擬機的VCPU運行在宿主機的0號、1號、2號、3號CPU。
cpus = "5" 指定讓虛擬機的VCPU運行在宿主機的5號CPU上(第六個CPU)。
cpus = "^1" 指定讓虛擬機的VCPU不運行在宿主機除1號CPU上(^表示“非”的意思,但沒有說是“除這個之外其他全部”的意思,而僅僅是“非”的意思)。
cpus = "0-3,5,^1" 指定讓虛擬機的VCPU運行在宿主機的0、1、2、3、5號CPU上,但是由于最后跟著一個^1,所以要把1號CPU去掉。實際指定的是0、2、3、5這四個CPU。
網(wǎng)絡(luò)接口參數(shù)部分:
------------------------------------------------------------------------------
vif = [ 'type=ioemu, mac=00:16:3e:00:00:11, bridge=xenbr0, model=ne2k_pci' ]
設(shè)定MAC地址,一般情況下虛擬機的MAC地址如果不特別指定的話,它是自動隨機的。(一般無需特別指定配置)
vif = [ 'type=ioemu, bridge=xenbr0' ]
設(shè)定網(wǎng)絡(luò)接口的類型,虛擬網(wǎng)絡(luò)接口類型指定的是ioemu,表示是一個模擬的IO設(shè)備,而不是真實的網(wǎng)絡(luò)設(shè)備。(一般無需特別指定配置)
存儲設(shè)備參數(shù)部分:
------------------------------------------------------------------------------
disk = [ 'phy:hda1,hda1,r' ]
disk = [ 'file:/var/images/min-el3-i386.img,hda,w', ',hdc:cdrom,r' ]
設(shè)定虛擬機使用的“磁盤”以及“光驅(qū)”設(shè)備,通過制定宿主機系統(tǒng)里的某個路徑和文件來實現(xiàn)(file),也可以指向宿主機上的真實設(shè)備(phy),另外需要指定這些“設(shè)備”的一些屬性。比如hda,就表示這個設(shè)備在虛擬機里的角色是位置IDE-1-Master的磁盤;比如hdc:cdrom,表示這個設(shè)備在虛擬機里的角色是位置IDE-2-Master位置的光驅(qū)。另外w和r分別表示設(shè)備的寫和讀的屬性。
虛擬機狀態(tài)參數(shù)控制部分:
----------------------------------------------------------------------------
#Configure the behaviour when a domain exits. There are three 'reasons'
#for a domain to stop: poweroff, reboot, and crash. For each of these you
#may specify:
當(dāng)一個虛擬機存在并運行的時候,會有3個原因會造成虛擬機的停止:關(guān)機、重啟、崩潰。對于這每個可能,需要制定一些措施。
# "destroy", meaning that the domain is cleaned up as normal;
虛擬域的正常停止,使用“Destroy”方式來表達。
# "restart", meaning that a new domain is started in place of the old one;
一個新的虛擬域啟動來代替舊虛擬域,使用“Restart”方式來表達。
# "preserve", meaning that no clean-up is done until the domain is manually destroyed (using xm destroy, for example); or
保護虛擬域,虛擬域不會被清除直到被一次人為手動地停止。使用“Preserve”方式來表達。
# "rename-restart", meaning that the old domain is not cleaned up, but is renamed and a new domain started in its place.
舊的虛擬域并沒有被清除,但是它被改名之后并以一個新域的的方式啟動。使用“Rename-Restart”的方式來表達。
默認情況如下
on_poweroff = 'destroy' 當(dāng)遇到關(guān)機的時候,就會自動采用Destory來操作自己。
on_reboot = 'restart' 當(dāng)遇到重啟的時候,就會自動采用Restart來操作自己。
on_crash = 'restart' 當(dāng)遇到崩潰的時候,就會自動采用Restart來操作自己。
關(guān)于VNC控制以及其他的一些虛擬機參數(shù):
----------------------------------------------------------------------------
# New stuff
device_model = '/usr/' + arch_libdir + '/xen/bin/qemu-dm'
新虛擬機的設(shè)備模版。注意后面的qemu-dm。宿主機上提供的XEN-VNC控制就是由它提供的。
# boot on floppy (a), hard disk (c) or CD-ROM (d)
# default: hard disk, cd-rom, floppy
boot="cda"
設(shè)定虛擬機的啟動順序,“a”表示軟盤,“c”表示硬盤,“d”才表示CDROM。從左到右依次表示順序。
(這里友情提示一下:當(dāng)建立虛擬機的時候CDROM的“d”一般設(shè)定在最前,為的是從光盤中引導(dǎo)和安裝操作系統(tǒng)。當(dāng)安裝完畢后請記得把啟動順序更改,將硬盤啟動作為最優(yōu)先。)
# write to temporary files instead of disk image files
snapshot=1
設(shè)定寫入方式,寫入到臨時文件而不是鏡像文件時設(shè)定為1。(一般無需特別指定配置)
# enable SDL library for graphics, default = 0
sdl=0
設(shè)定SDL庫支持圖像,默認值0。(一般我也沒有配置過這項,所以這里不是很理解,希望了解的朋友給與指點)
# enable VNC library for graphics, default = 1
vnc=1
設(shè)定使用VNC來支持圖像,默認值1表示支持。很重要的選項!尤其是在安裝HVM虛擬機的時候!
# address that should be listened on for the VNC server if vnc is set.default is to use 'vnc-listen' setting from /etc/xen/xend-config.sxp
vnclisten="127.0.0.1"
設(shè)定VNC監(jiān)聽的網(wǎng)絡(luò)接口地址。這個地址必須是VNC服務(wù)器設(shè)定允許監(jiān)聽的有效地址。(默認是127.0.0.1的本機地址,一般我設(shè)定為0.0.0.0即全開放。)如果這項不設(shè)定的話,將會參考/etc/xen/xend-config.sxp這個配置文件里的設(shè)定。
# set VNC display number, default = domid
vncdisplay=1
設(shè)定VNC的顯示號,默認是為自己的DomainID。
# try to find an unused port for the VNC server, default = 1
vncunused=1
設(shè)定VNC服務(wù)器使用一個未占用的端口來提供VNC連接服務(wù)。默認值1表示打開。
# enable spawning vncviewer for domain's console
# (only valid when vnc=1), default = 0
vncconsole=0
設(shè)定是否支持使用其他VNC類型客戶端接入來管理虛擬機。此功能只在vnc項置1(啟用VNC支持)的情況下有效。默認值0表示不支持。
# set password for domain's VNC console
# default is depents on vncpasswd in xend-config.sxp
vncpasswd=''
設(shè)定此虛擬機的VNC的接入口令,如果這里不設(shè)定,那么將會默認參考xend-config.sxp主設(shè)定文件中的vncpasswd口令值。
# no graphics, use serial port
nographic=0
設(shè)定無圖形支持,使用串行端口。默認值0表示默認支持圖形界面。
# enable stdvga, default = 0 (use cirrus logic device model)
stdvga=0
設(shè)定啟用標(biāo)準(zhǔn)VGA。默認值為0。(一般無需特別指定配置)
# serial port re-direct to pty deivce, /dev/pts/n then xm console or minicom can connect
serial='pty'
設(shè)定控制臺的串行接口設(shè)備。(一般無需特別指定配置)
# enable sound card support, [sb16|es1370|all|..,..], default none
soundhw='sb16'
設(shè)定音頻硬件設(shè)備。默認是沒有。個人認為一般XEN作為服務(wù)器,用到音頻的非常少。(一般無需配置)
# set the real time clock to local time [default=0 i.e. set to utc]
localtime=1
設(shè)定本地時間同步,默認值為1。(一般無需特別指定配置)
# start in full screen
full-screen=1
設(shè)定是否以全屏方式啟動。(一般無需特別指定配置)
對周邊設(shè)備支持的參數(shù)設(shè)定
-----------------------------------------------------------------------------
# Enable USB support (specific devices specified at runtime through the monitor window)
usb=1
設(shè)定是否支持支持USB。(一般無需特別指定配置)
# Enable USB mouse support (only enable one of the following, `mouse' for PS/2 protocol relative mouse, `tablet' for absolute mouse)
usbdevice='mouse'
usbdevice='tablet'
設(shè)定支持的USB的設(shè)備。(一般無需特別指定配置)
# Set keyboard layout, default is en-us keyboard.
keymap='ja'
設(shè)定鍵盤設(shè)備,默認是英美式鍵盤。(一般無需特別指定配置)