<domain type='kvm'> <name>centos_x86_6.4</name>
#由字母和數字組成,不能包含空格 <uuid>b9dcdd92-9b9b-14d6-3938-1982a9746a12</uuid> <memory unit='KiB'>2097152</memory>
#由字母和數字組成,不能包含空格 <currentMemory unit='KiB'>2097152</currentMemory> <vcpu placement='static'>1</vcpu> <os> <type arch='x86_64' machine='pc-1.2'>hvm</type>
#type 表示全虛擬化還是半虛擬化,hvm表示全虛擬化 <boot dev='hd'/>
#boot 怎么啟動的,如"fd"表示從文件啟動, "hd"從硬盤啟動, "cdrom"從光驅啟動 和 "network"從網絡啟動 #可以重復多行,指定不同的值,作為一個啟動設備列表。 #The dev attribute takes one of the values "fd", "hd", "cdrom" or "network" </os>
#處理器特性 <features> <acpi/> <apic/> <pae/> </features> <clock offset='localtime'> <timer name='pit' tickpolicy='delay'/> <timer name='rtc' tickpolicy='catchup'/> </clock> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices>
#Guest需要的設備
<emulator>/bin/qemu-kvm</emulator>
<disk type='file' device='disk'> <driver name='qemu' type='qcow2'/>
#目的鏡像路徑 在這個例子中,在guest中顯示為IDE設備。 <source file='/home/template_make/centos_x86_6.4.img'> <seclabel model='selinux' relabel='no'/> </source> <target dev='hda' bus='ide'/> <alias name='ide0-0-0'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> <disk type='file' device='cdrom'> <driver name='qemu' type='raw'/> <source file='/home/template_make/CentOS-6.4-x86_64-bin-DVD1.iso'/> <target dev='hdc' bus='ide'/> <readonly/> <alias name='ide0-1-0'/> <address type='drive' controller='0' bus='1' target='0' unit='0'/> </disk> <controller type='usb' index='0'> <alias name='usb0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> <controller type='ide' index='0'> <alias name='ide0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> </controller> <interface type='bridge'>
#虛擬機網絡連接方式 <mac address='52:54:00:78:f9:5a'/> <source bridge='br0'/> <target dev='vnet27'/>
## 使用virtio: 采用普通的驅動,即硬盤和網卡都采用默認配置情況下,硬盤是 ide 模式, 而網卡工作在 模擬的rtl 8139 網卡下,速度為100M 全雙工。 采用 virtio 驅動后,網卡工作在 1000M 的模式下,硬盤工作是SCSI模式下 <model type='virtio'/> <alias name='net0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </interface> <input type='mouse' bus='ps2'/>
#vnc方式登錄,端口號自動分配 可以通過virsh vncdisplay來查詢[vncdisplay domainId] <graphics type='vnc' port='5915' autoport='yes' listen='0.0.0.0'> <listen type='address' address='0.0.0.0'/> </graphics> <video> <model type='cirrus' vram='9216' heads='1'/> <alias name='video0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> <alias name='balloon0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </memballoon> </devices> <seclabel type='dynamic' model='selinux' relabel='yes'> <label>unconfined_u:system_r:svirt_t:s0:c362,c396</label> <imagelabel>unconfined_u:object_r:svirt_image_t:s0:c362,c396</imagelabel> </seclabel> </domain>