前面讲到了PV guest的配置,那么这篇再简单说一下Xen中HVM guest的配置吧。以下配置适用于Xen4.1及以上版本,xlexample.hvm如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# ===================================================================== # Example HVM guest configuration # ===================================================================== # # This is a fairly minimal example of what is required for an # HVM guest. For a more complete guide see xl.cfg(5) # This configures an HVM rather than PV guest builder = "hvm" # Guest name name = "Jay's HVM" # Initial memory allocation (MB) memory = 1024 # Maximum memory (MB) # If this is greater than `memory' then the slack will start ballooned # (this assumes guest kernel support for ballooning) #maxmem = 512 # Number of VCPUS vcpus = 2 # Network devices # A list of 'vifspec' entries as described in # docs/misc/xl-network-configuration.markdown vif = [ '' ] # Disk Devices # A list of `diskspec' entries as described in # docs/misc/xl-disk-configuration.txt disk = [ '/root/jay/rhel6u2.qcow,qcow2,xvda,rw' ] |
其中值得注意是网络配置vif=[''],它其实都主要用了xl的默认配置,相当如下:
vif = [ 'type=ioemu, bridge=xenbr0' ]
type指明了guest中网卡设备的类型;有两个值:ioemu 和 vif。 其中ioemu表示使用qemu模拟的网络设备,而当Guest中有支持网络设备的PV driver时,‘ioemu'的配置依然会让hvm guest使用PV driver;而vif则只提供PV driver的方式让hvm guest使用。
Specifies the type of device to valid values are:
ioemu (default) -- this device will be provided as an emulate device to the guest and also as a paravirtualised device which the guest may choose to use instead if it has suitable drivers available.
vif -- this device will be provided as a paravirtualised device only.
用xl create xlexample.hvm 来创建一个hvm guest。