DomU就是guest domain,安裝一個domU基本上是個體力活,我自己好久不做了幾乎都忘了,最近要測試幾個系統所以又撿起來,這裡把流程記錄下,以後用臉滾鍵盤就行了。。。DomU分為兩種:para-virtualization 和 hardware-virtualization,具體的解釋去xen.org上看去。這兩種DomU安裝方法是不同的。
Para-Virtualization(類虛擬化):
pvm的啟動目前需要pvgrub的支援(http://wiki.xen.org/wiki/PVGrub_HowTo),在設定檔裡指定為
kernel=/usr/lib/xen/boot/pv-grub-x86_64.gz
extra=(hd0,0)/boot/grub/menu.lst
Hardware-Virtualization(硬體輔助虛擬化):
hvm的domU需要通過hvmloader啟動(http://wiki.xen.org/wiki/Hvmloader),如果你安裝了xen,可以好好看下/etc/xen/xmexample.hvm的設定檔
下面是xen wiki摘錄下來的一個例子
Example HVM guest configuration file for PVHVM use
Example configuration file ("/etc/xen/f16hvm") for Xen 4.x HVM guest VM using Linux PVHVM paravirtualized optimized drivers for disks and network:
kernel = "hvmloader"builder='hvm'device_model = 'qemu-dm'name = "f16pvhvm"memory = 1024vcpus=1pae=1acpi=1apic=1vif = [ 'mac=00:16:4f:02:02:15, bridge=virbr0, model=e1000' ]disk = [ 'phy:/dev/vg01/f16pvhvm-disk0,hda,w', 'file:/root/iso/Fedora-16-x86_64-DVD.iso,hdc:cdrom,r' ]boot='cd'xen_platform_pci=1on_poweroff = 'destroy'on_reboot = 'restart'on_crash = 'restart'sdl=0vnc=1vncpasswd=''stdvga=0serial='pty'tsc_mode=0usb=1usbdevice='tablet'keymap='en'
This example has been tested and is working on Fedora 16 Xen dom0 host using the included Xen 4.1.2 and Linux 3.1 kernel in dom0, and Fedora 16 Xen PVHVM guest VM, also using the stock F16 Linux 3.1 kernel with the out-of-the-box included PVHVM drivers.
pvm安裝還有個注意的地方是pv driver的安裝,請參考xen wiki
http://wiki.xen.org/wiki/Using_Xen_PV_Drivers_on_HVM_Guest
http://wiki.xen.org/wiki/XenLinuxPVonHVMdrivers
比如看如下一個配置
disk = [ 'file:/system.img,hda,w', 'file:/disk1.img,sda,w', 'file:/disk2.img,xvda,w', ]
對於hda,比如要在啟動dom0時指定ide0=noprobe,這樣就不會用qemu-dm來類比hda;對於sda一般不指定,不然qemu會把sda用sym53c8xx的驅動來類比;而xvda這類裝置是不會用qemu-dm來類比的,如果使用pv driver,指定xvda, xvdb這類裝置是最好的選擇
202 blockXen Virtual Block Device 0 = /dev/xvda First Xen VBD whole disk 16 = /dev/xvdb Second Xen VBD whole disk 32 = /dev/xvdc Third Xen VBD whole disk ... 240 = /dev/xvdp Sixteenth Xen VBD whole disk Partitions are handled in the same way as for IDE disks (see major number 3) except that the limit on partitions is 15.
如果pv driver正確安裝,dmesg | egrep -i 'xen|front'可以看到如下資訊
[ 0.000000] Xen Platform PCI: I/O protocol version 1[ 0.000000] Netfront and the Xen platform PCI driver have been compiled for this kernel: unplug emulated NICs.[ 0.000000] Blkfront and the Xen platform PCI driver have been compiled for this kernel: unplug emulated disks[ 0.000000] Xen HVM callback vector for event delivery is enabled[ 2.377167] vbd vbd-5632: 19 xenbus_dev_probe on device/vbd/5632[ 2.378134] blkfront: xvda: flush diskcache: enabled[ 6.266448] Initialising Xen virtual ethernet driver.