您的位置:首页 > 其它

libvirt 启动虚拟机xml配置文件

2013-05-08 20:20 344 查看
<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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐