libvirt domain XML配置实例

kvmla测试kvm虚拟化有一个多月了,现在已经开始公测了. 这里记录一下virsh管理下的kvm配置文件实例大全

<domain type='vbox'>
 <name>vbox</name>
 <uuid>4dab22b31d52d8f32516782e98ab3fa0</uuid>

 <os>
<type>hvm</type>
<boot dev='cdrom'/>
<boot dev='hd'/>
<boot dev='fd'/>
<boot dev='network'/>
 </os>

 <memory>654321</memory>
 <vcpu>1</vcpu>

 <features>
<pae/>
<acpi/>
<apic/>
 </features>

 <devices>
<!--Set IDE controller model to PIIX4 (default PIIX3)-->
<controller type='ide' model='piix4'/>

<controller type='scsi' index='0'/>

<!--VirtualBox SAS Controller-->
<controller type='scsi' index='1' model='lsisas1068'/>

<disk type='file' device='cdrom'>
 <source file='/home/user/Downloads/slax-6.0.9.iso'/>
 <target dev='hdc'/>
 <readonly/>
</disk>

<disk type='file' device='disk'>
 <source file='/home/user/tmp/vbox.vdi'/>
 <target dev='hdd'/>
</disk>

<!--Attach to the SCSI controller (index=0, default)-->
<disk type='file' device='disk'>
 <source file='/home/user/tmp/vbox2.vdi'/>
 <target dev='sda' bus='scsi'/>
</disk>

<!--Attach to the SAS controller (index=1)-->
<disk type='file' device='disk'>
 <source file='/home/user/tmp/vbox3.vdi'/>
 <target dev='sda' bus='scsi'/>
 <address type='drive' controller='1' bus='0' target='0' unit='0'/>
</disk>

<disk type='file' device='floppy'>
 <source file='/home/user/tmp/WIN98C.IMG'/>
 <target dev='fda'/>
</disk>

<filesystem type='mount'>
 <source dir='/home/user/stuff'/>
 <target dir='my-shared-folder'/>
</filesystem>

<!--BRIDGE-->
<interface type='bridge'>
 <source bridge='eth0'/>
 <mac address='00:16:3e:5d:c7:9e'/>
 <model type='am79c973'/>
</interface>

<!--NAT-->
<interface type='user'>
 <mac address='56:16:3e:5d:c7:9e'/>
 <model type='82540eM'/>
</interface>

<graphics type='desktop'/>

<!--Activate the VRDE server with a port in 3389-3689 range-->
<graphics type='rdp' autoport='yes' multiUser='yes'/>

<sound model='sb16'/>

<parallel type='dev'>
 <source path='/dev/pts/1'/>
 <target port='0'/>
</parallel>

<parallel type='dev'>
 <source path='/dev/pts/2'/>
 <target port='1'/>
</parallel>

<serial type="dev">
 <source path="/dev/ttyS0"/>
 <target port="0"/>
</serial>

<serial type="pipe">
 <source path="/tmp/serial.txt"/>
 <target port="1"/>
</serial>

<hostdev mode='subsystem' type='usb'>
 <source>
<vendor id='0x1234'/>
<product id='0xbeef'/>
 </source>
</hostdev>
<hostdev mode='subsystem' type='usb'>
 <source>
<vendor id='0x4321'/>
<product id='0xfeeb'/>
 </source>
</hostdev>
 </devices>
</domain>

本文摘自:

http://libvirt.org/drvvbox.html





添加新评论 »