创建虚机xm create命令的选项
- --config (-F) 配置文件的路径
- -n (--dryrun) config_file 显示python配置文件对应的SXP格式(该文件还会在/var/lib/xend/domains/UUID/config.sxp保存一份,而且/var/lib/xend/domains/UUID/config.sxp保存的配置更为全面。
- -s (--skipdtd) 忽略XML DTD检测,启动后可减少虚机的创建时间
- -p (--paused) 创建后不自动启动
- --vncviewer 自动连接vnc display
- -c (--console_autoconnect)自动连接控制台
- --vncviewer-autopass 通过stdin传入VNC的密码
配置文件的选项列表
'vncpasswd'='NAME', # 传入HVM虚机的VNC密码
one,
说明:"Password for VNC console on HVM domain."
'vncviewer'='no|yes', #是否启动vnc
one,
说明:"Spawn a vncviewer listening for a vnc server in the domain.\n"
"The address of the vncviewer is passed to the domain on the "
"kernel command line using 'VNC_SERVER=<host>:<port>'. The port "
"used by vnc is 5500 + DISPLAY. A display value with a free port "
"is chosen if possible.\nOnly valid when vnc=1.\nDEPRECATED"
'vncconsole'='no|yes',
one,
说明:"Spawn a vncviewer process for the domain's graphical console.\n"
"Only valid when vnc=1."
'name'='NAME', # 设置虚机名字
one,
说明:"Domain name. Must be unique."
'bootloader'='FILE', # 设置bootloader文件
one,
说明:"Path to bootloader."
'bootargs'='NAME', # boot loader参数
one,
说明:"Arguments to pass to boot loader"
'bootentry'='NAME',
one,
说明:"DEPRECATED. Entry to boot via boot loader. Use bootargs."
'kernel'='FILE', # 设置kernel路径
one,
说明:"Path to kernel image."
HVM虚机使用kernel = "/usr/lib/xen/boot/hvmloader"
'ramdisk'='FILE', # 设置ramdisk路径
default='',
说明:"Path to ramdisk."
'loader'='FILE', # HVM firmware路径
default='',
说明:"Path to HVM firmware."
'features'='FEATURES', # Features to enable in guest kernel
default='',
说明:"Features to enable in guest kernel"
'builder'='FUNCTION', # 默认linux,HVM虚机为hvm
default='linux',
说明:"Function to use to build the domain."
'memory'='MEMORY', # 内存 单位MB
default=128,
说明:"Domain memory in MB."
'maxmem'='MEMORY', # 最大内存 单位MB
one,
说明:"Maximum domain memory in MB."
'shadow_memory'='MEMORY', # shadow_
default=0,
说明:"Domain shadow memory in MB."
'cpu'='CPU', # 物理CPU
one,
说明:"CPU to run the VCPU0 on."
'cpus'='CPUS', # 物理CPU
one,
说明:"CPUS to run the domain on."
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。
'rtc_timeoffset'='RTC_TIMEOFFSET', # rtc_ Set RTC offset
default=0,
说明:"Set RTC offset."
'pae'='PAE', # pae=1 使能HVM虚机PAE
default=1,
说明:"Disable or enable PAE of HVM domain."
'hpet'='HPET', # hpet=0 Enable virtual high-precision event timer
default=0,
说明:"Enable virtual high-precision event timer."
'timer_mode'='TIMER_MODE', # timer_
default=1,
说明:Timer mode (0=delay virtual time when ticks are missed;
1=virtual time is always wallclock time.
'vpt_align'='VPT_ALIGN', # vpt_
default=1,
说明:"Enable aligning all periodic vpt to reduce timer interrupts."
'viridian'='VIRIDIAN', # viridian=0
default=0,
说明:Expose Viridian interface to x86 HVM guest?
(Default is 0).
'acpi'='ACPI', # acpi=1 enbale HVM ACPI
default=1,
说明:"Disable or enable ACPI of HVM domain."
'apic'='APIC', # apic=1 enable APIC mode
default=1,
说明:"Disable or enable APIC mode."
'vcpus'='VCPUS', # 虚机CPU的个数上限
default=1,
说明:"# of Virtual CPUS in domain."
'vcpu_avail'='VCPUS', # vcpu_ 可用vcpu
one,
说明:"Bitmask for virtual CPUs to make available immediately."
'vhpt'='VHPT', # for IA64
default=0,
说明:"Log2 of domain VHPT size for IA64."
'cpu_cap'='CAP', # cpu_ 可用物理CPU的最大百分比
one,
说明:Set the maximum amount of cpu.
CAP is a percentage that fixes the maximum amount of cpu.
'cpu_weight'='WEIGHT', # cpu_ 物理CPU分配的权值
one,
说明:Set the cpu time ratio to be allocated to the domain.
'restart'='onreboot|always|never',
one,
说明:Deprecated. Use on_poweroff, on_reboot, and on_crash
instead.
Whether the domain should be restarted on exit.
- onreboot: restart on exit with shutdown code reboot
- always: always restart on exit, ignore exit code
- never: never restart on exit, ignore exit code
'on_poweroff'='destroy|restart|preserve|rename-restart', # on_|restart|preserve|rename-restart 虚机关机时的动作
one,
说明:Behaviour when a domain exits with reason 'poweroff'.
- destroy: the domain is cleaned up as normal;
- restart: a new domain is started in place of the old one;
- preserve: no clean-up is done until the domain is manually
destroyed (using xm destroy, for example);
- rename-restart: the old domain is not cleaned up, but is
renamed and a new domain started in its place.
'on_reboot'='destroy|restart|preserve|rename-restart', # 虚机重启的动作
one,
说明:Behaviour when a domain exits with reason 'reboot'.
- destroy: the domain is cleaned up as normal;
- restart: a new domain is started in place of the old one;
- preserve: no clean-up is done until the domain is manually
destroyed (using xm destroy, for example);
- rename-restart: the old domain is not cleaned up, but is
renamed and a new domain started in its place.
'on_crash'='destroy|restart|preserve|rename-restart|coredump-destroy|coredump-restart',
one, #虚机崩溃时的动作
说明:Behaviour when a domain exits with reason 'crash'.
- destroy: the domain is cleaned up as normal;
- restart: a new domain is started in place of the old one;
- preserve: no clean-up is done until the domain is manually
destroyed (using xm destroy, for example);
- rename-restart: the old domain is not cleaned up, but is
renamed and a new domain started in its place.
- coredump-destroy: dump the domain's core, followed by destroy
- coredump-restart: dump the domain's core, followed by restart
'blkif'='no|yes', # Make the domain a block device backend
default=0,
说明:"Make the domain a block device backend."
'netif'='no|yes',
default=0, # ake the domain a network interface backend
说明:"Make the domain a network interface backend."
'tpmif'='no|yes', # Make the domain a TPM interface backend
default=0,
说明:"Make the domain a TPM interface backend."
'disk'='phy:DEV,VDEV,MODE[,DOM]', # 块设备
default=[],
说明:Add a disk device to a domain. The physical device is DEV,
which is exported to the domain as VDEV. The disk is read-only if MODE
is 'r', read-write if MODE is 'w'. If DOM is specified it defines the
backend driver domain to use for the disk.
The option may be repeated to add more than one disk.
示例:
disk = [ 'phy:hda1,hda1,r' ]
disk = [ 'file:/var/images/min-el3-i386.img,hda,w', ',hdc:cdrom,r' ]
'pci'='BUS:DEV.FUNC[@VSLOT][,msitranslate=0|1][,power_mgmt=0|1]',
default=[], # pci设备
说明:Add a PCI device to a domain, using given params (in hex).
For example '0:02.1'.
If VSLOT is supplied the device will be inserted into that
virtual slot in the guest, else a free slot is selected.
If msitranslate is set, MSI-INTx translation is enabled if possible.
Guest that doesn't support MSI will get IO-APIC type IRQs
translated from physical MSI, HVM only. Default is 1.
The option may be repeated to add more than one pci device.
If power_mgmt is set, the guest OS will be able to program the power
states D0-D3hot of the device, HVM only. Default=0.
'vscsi'='PDEV,VDEV[,DOM]', # SCSI设备
default=[],
说明:Add a SCSI device to a domain. The physical device is PDEV,
which is exported to the domain as VDEV(X:X:X:X).
'ioports'='FROM[-TO]', #
default=[],
说明:Add a legacy I/O range to a domain, using given params (in hex).
For example 'ioports=02f8-02ff'.
The option may be repeated to add more than one i/o range.
'irq'='IRQ',
default=[],
说明:Add an IRQ (interrupt line) to a domain.
For example 'irq=7'.
This option may be repeated to add more than one IRQ.
'vfb'="vnc=1,sdl=1,vncunused=1,vncdisplay=N,vnclisten=ADDR,display=DISPLAY,xauthority=XAUTHORITY,vncpasswd=PASSWORD,opengl=1,keymap=FILE"
default=[],
说明:Make the domain a framebuffer backend.
Both sdl=1 and vnc=1 can be enabled at the same time.
For vnc=1, connect an external vncviewer. The server will listen
on ADDR (default 127.0.0.1) on port N+5900. N defaults to the
domain id. If vncunused=1, the server will try to find an arbitrary
unused port above 5900. vncpasswd overrides the XenD configured
default password.
For sdl=1, a viewer will be started automatically using the
given DISPLAY and XAUTHORITY, which default to the current user's
ones. OpenGL will be used by default unless opengl is set to 0.
keymap overrides the XendD configured default layout file.
'vif'="type=TYPE,mac=MAC,bridge=BRIDGE,ip=IPADDR,script=SCRIPT, "backend=DOM,vifname=NAME,rate=RATE,model=MODEL,accel=ACCEL"
default=[],
说明:Add a network interface with the given MAC address and bridge.
The vif is configured by calling the given configuration script.
If type is not specified, default is netfront.
If mac is not specified a random MAC address is used.
If not specified then the network backend chooses it's own MAC address.
If bridge is not specified the first bridge found is used.
If script is not specified the default script is used.
If backend is not specified the default backend driver domain is used.
If vifname is not specified the backend virtual interface will have name vifD.N
where D is the domain id and N is the interface id.
If rate is not specified the default rate is used.
If model is not specified the default model is used.
If accel is not specified an accelerator plugin module is not used.
This option may be repeated to add more than one vif.
Specifying vifs will increase the number of interfaces as needed.
'vtpm'="instance=INSTANCE,backend=DOM,type=TYPE"
default=[],
说明:Add a TPM interface. On the backend side use the given
instance as virtual TPM instance. The given number is merely the
preferred instance number. The hotplug script will determine
which instance number will actually be assigned to the domain.
The associtation between virtual machine and the TPM instance
number can be found in /etc/xen/vtpm.db. Use the backend in the
given domain.
The type parameter can be used to select a specific driver type
that the VM can use. To prevent a fully virtualized domain (HVM)
from being able to access an emulated device model, you may specify
'paravirtualized' here.
'access_control'=",",
default=[],
说明:Add a security label and the security policy reference that defines it.
The local ssid reference is calculated when starting/resuming the domain. At
this time, the policy is checked against the active policy as well. This way,
migrating through save/restore is covered and local labels are automatically
created correctly on the system where a domain is started / resumed.
'nics'="NUM",
default=-1,
说明:DEPRECATED. Use empty vif entries instead.
Set the number of network interfaces.
Use the vif option to define interface parameters, otherwise
defaults are used. Specifying vifs will increase the
number of interfaces as needed.
'root'='DEVICE',
default='',
说明:Set the root= parameter on the kernel command line.
Use a device, e.g. /dev/sda1, or /dev/nfs for NFS root.
'extra'="ARGS",
default='',
说明:"Set extra arguments to append to the kernel command line."
'ip'='IPADDR',
default='',
说明:"Set the kernel IP interface address."
'gateway'="IPADDR",
default='',
说明:"Set the kernel IP gateway."
'netmask'="MASK",
default = '',
说明:"Set the kernel IP netmask."
'hostname'="NAME",
default='',
说明:"Set the kernel IP hostname."
'interface'="INTF",
default="eth0",
说明:"Set the kernel IP interface name."
'dhcp'="off|dhcp",
default='off',
说明:"Set the kernel dhcp option."
'nfs_server'="IPADDR",
one,
说明:"Set the address of the NFS server for NFS root."
'nfs_root'="PATH",
one,
说明:"Set the path of the root NFS directory."
'device_model'='FILE',
one,
说明:"Path to device model program."
HVM虚机可以设置为device_model = '/usr/' + arch_libdir + '/xen/bin/qemu-dm'
'fda'='FILE',
default='',
说明:"Path to fda"
'fdb'='FILE',
default='',
说明:"Path to fdb"
'serial'='FILE',
default='',
说明:"Path to serial or pty or vc"
'monitor'='no|yes',
default=0,
说明:Should the device model use monitor?
'localtime'='no|yes',
default=0,
说明:"Is RTC set to localtime?"
'keymap'='FILE',
default='',
说明:"Set keyboard layout used"
'usb'='no|yes',
default=0,
说明:"Emulate USB devices?"
'usbdevice'='NAME',
default='',
说明:"Name of USB device to add?"
'guest_os_type'='NAME',
default='default',
说明:"Guest OS type running in HVM"
'stdvga'='no|yes',
default=0,
说明:"Use std vga or cirrhus logic graphics"
'isa'='no|yes',
default=0,
说明:"Simulate an ISA only system?"
'boot'="a|b|c|d",
default='c',
说明:"Default boot device"
'nographic'='no|yes',
default=0,
说明:"Should device models use graphics?"
'soundhw'='audiodev',
default='',
说明:"Should device models enable audio device?"
'vnc'='',
说明:Should the device model use VNC?
'vncdisplay'='',
说明:VNC display to use
'vnclisten'='',
说明:Address for VNC server to listen on.
'vncunused'='',
default=1,
说明:Try to find an unused port for the VNC server.
Only valid when vnc=1.
'videoram'='MEMORY',
default=4,
说明:Maximum amount of videoram a guest can allocate
for frame buffer.
'sdl'='',
说明:Should the device model use SDL?
'opengl'='',
说明:Enable\Disable OpenGL
'display'='DISPLAY',
说明:"X11 display to use"
'xauthority'='XAUTHORITY',
说明:"X11 Authority to use"
'uuid'='',
说明:xenstore UUID (universally unique identifier) to use. One
will be randomly generated if this option is not set, just like MAC
addresses for virtual network interfaces. This must be a unique
value across the entire cluster.
'on_xend_start'='ignore|start',
default='ignore',
说明:'Action to perform when xend starts')
'on_xend_stop'='ignore|shutdown|suspend',
default="ignore",
说明:Behaviour when Xend stops:
- ignore: Domain continues to run;
- shutdown: Domain is shutdown;
- suspend: Domain is suspended;
'target'='TARGET',
default=0,
说明:"Set domain target."
'hap'='HAP',
default=1,
说明:Hap status (0=hap is disabled;
1=hap is enabled.
's3_integrity'='TBOOT_MEMORY_PROTECT',
default=1,
说明:Should domain memory integrity be verified during S3?
(0=protection is disabled; 1=protection is enabled.
'cpuid'="IN[,SIN]",
default=[],
说明:Cpuid description.
'cpuid_check'="IN[,SIN]",
default=[],
说明:Cpuid check description.
'machine_address_size'='BITS',
one,
说明:Maximum machine address size
'suppress_spurious_page_faults'='yes|no',
one,
说明:Do not inject spurious page faults into this guest
'pci_msitranslate'='TRANSLATE',
default=1,
说明:Global PCI MSI-INTx translation flag (0=disable;
1=enable.
'pci_power_mgmt'='POWERMGMT',
default=0,
说明:Global PCI Power Management flag (0=disable;1=enable).
'xen_platform_pci'='0|1',
default=1,
说明:"Is xen_platform_pci used?"
关于viridian interface
At the moment we provide MSR access to APIC registers, and the hypercall
to yield the CPU when waiting for a spinlock. We looked at a few others
(e.g. address-space-change hypercall) but found the benefits, if any,
were negligible.
The most important part of the interface is that we can use it to tell
Windows not to expect timer interrupt delivery to be as even across all
CPUs as it would be on bare metal. This gets rid of annoying STOP 0x101
bluescreens in multi-vcpu Windows from Vista on.
PAE
PAE,物理地址扩展,是基于x86 的服务器的一种功能,它使运行 Windows Server 2003, Enterprise Edition 和 Windows Server 2003,Datacenter Edition 的计算机可以支持4GB 以上物理内存。物理地址扩展 (PAE) 允许将最多64GB 的物理内存用作常规的4 KB 页面,并扩展内核能使用的位数以将物理内存地址从32扩展到36。
ACPI
ACPI就是Advanced Configuration and Power Interface的缩写,意思是“高级配置与电源接口”。这是英特尔、微软和东芝共同开发的一种电源管理标准。
ACPI可实现以下功能:
1、用户可以使外设在指定时间开关;
2、使用笔记本电脑的用户可以指定计算机在低电压的情况下进入低功耗状态,以保证重要的应用程序运行;
3、操作系统可以在应用程序对时间要求不高的情况下降低时钟频率;
4、操作系统可以根据外设和主板的具体需求为它分配能源;
5、在无人使用计算机时可以使计算机进入休眠状态,但保证一些通信设备打开;
6、即插即用设备在插入时能够由ACPI来控制。
不过,ACPI和其他的电源管理方式一样,要想享受到上面这些功能,必须要有软件和硬件的支持。在软件方面,Windows 98及其后续产品和Windows 2000都对ACPI给予了全面的支持;硬件方面比较麻烦,除了要求主板、显卡和网卡等外设要支持ACPI外,还需要机箱电源的配合。电源在提供5伏电压给主板的同时,还必须使电流稳定在720毫安以上才可以,这样它才能够实现电脑的“睡眠”和“唤醒”。
ACPI共有六种状态,分别是S0到S5,它们代表的含义分别是:
S0--实际上这就是我们平常的工作状态,所有设备全开,功耗一般会超过80W;
S1--也称为POS(Power on Suspend),这时除了通过CPU时钟控制器将CPU关闭之外,其他的部件仍然正常工作,这时的功耗一般在30W以下;(其实有些CPU降温软件就是利用这种工作原理)
S2--这时CPU处于停止运作状态,总线时钟也被关闭,但其余的设备仍然运转;
S3--这就是我们熟悉的STR(Suspend to RAM),这时的功耗不超过10W;
S4--也称为STD(Suspend to Disk),这时系统主电源关闭,但是硬盘仍然带电并可以被唤醒;
S5--这种状态是最干脆的,就是连电源在内的所有设备全部关闭,功耗为0。
我们最常用到的是S3状态,即Suspend to RAM(挂起到内存)状态,简称STR。顾名思义,STR就是把系统进入STR前的工作状态数据都存放到内存中去。在STR状态下,电源仍然继续为内存等最必要的设备供电,以确保数据不丢失,而其他设备均处于关闭状态,系统的耗电量极低。一旦我们按下Power按钮(主机电源开关),系统就被唤醒,马上从内存中读取数据并恢复到STR之前的工作状态。内存的读写速度极快,因此我们感到进入和离开STR状态所花费的时间不过是几秒钟而已;而S4状态,即STD(挂起到硬盘)与STR的原理是完全一样的,只不过数据是保存在硬盘中。由于硬盘的读写速度比内存要慢得多,因此用起来也就没有STR那么快了。STD的优点是只通过软件就能实现,比如Windows 2000就能在不支持STR的硬件上实现STD。
APIC
apic: Advanced Programmable Interrupt Controller高级可编程中断控制器. APIC 是装置的扩充组合用来驱动 Interrupt 控制器。在目前的建置中,系统的每一个部份都是经由 APIC Bus 连接的。"本机 APIC" 为系统的一部份,负责传递 Interrupt 至指定的处理器;举例来说,当一台机器上有三个处理器则它必须相对的要有三个本机 APIC。自 1994 年的 Pentium P54c 开始Intel 已经将本机 APIC 建置在它们的处理器中。实际建置了 Intel 处理器的电脑就已经包含了 APIC 系统的部份。 系统中另一个重要的部份为 I/O APIC。系统中最多可拥有 8 个 I/O APIC。它们会收集来自 I/O 装置的 Interrupt 讯号且在当那些装置需要 interrupt 时传送讯息至本机 APIC。每个 I/O APIC 有一个专有的 interrupt 输入 (或 IRQ) 号码。Intel 过去与目前的 I/O APIC 通常有 24 个输入 -- 其它的可能有多逹 64 个。而且有些机器拥有数个 I/O APIC,每一个分别有自己的输入号码,加起来一台机器上会有上百个 IRQ 可供装置 Interrupt 使用。 然而,系统中若没有 I/O APIC,那本机 APIC 就没有用处。像这样的状况下,Windows 2000 会还原使用 8259 PIC 。
VGA
VGA(Video Graphics Array)是IBM在1987年随PS/2机一起推出的一种视频传输标准,具有分辨率高、显示速率快、颜色丰富等优点,在彩色显示器领域得到了广泛的应用。