关于xen的杂七杂八 (DomU安装)

来源:互联网 发布:ubuntu 32位下载 编辑:程序博客网 时间:2024/05/18 10:49

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.






原创粉丝点击