libvirt 개발 관련 정보
http://libvirt.org/hacking.html
git clone git://libvirt.org/libvirt.git
domain xml 예제 (/storage/controller.xml)
<domain type="kvm">
<name>controller</name>
<memory>2097152</memory>
<vcpu>4</vcpu>
<sysinfo type="smbios">
<system>
<entry name="manufacturer">sunshout</entry>
<entry name="product">OpenStack Controller</entry>
<entry name="version">2013.4</entry>
</system>
</sysinfo>
<os>
<type>hvm</type>
<boot dev="hd"/>
<smbios mode="sysinfo"/>
</os>
<features>
<acpi/>
<apic/>
</features>
<clock offset="utc">
<timer name="pit" tickpolicy="delay"/>
<timer name="rtc" tickpolicy="catchup"/>
</clock>
<cpu mode="host-model" match="exact"/>
<devices>
<disk type="file" device="disk">
<driver name="qemu" type="qcow2" cache="none"/>
<source file="/storage/controller.img"/>
<target bus="virtio" dev="vda"/>
</disk>
<interface type='bridge'>
<mac address='52:54:00:23:76:00'/>
<model type="virtio"/>
<source bridge="br1"/>
</interface>
<interface type='bridge'>
<mac address='52:55:00:23:76:00'/>
<model type="virtio"/>
<source bridge="p2p2_br"/>
</interface>
<serial type="pty"/>
<input type="tablet" bus="usb"/>
<graphics type="vnc" autoport="yes" keymap="en-us" listen="127.0.0.1"/>
</devices>
</domain>
CPU Pinning을 쓰고 싶을 때
<vcpu>4</vcpu>
<cputune>
<vcpupin vcpu="0" cpuset="4"/>
<vcpupin vcpu="1" cpuset="5"/>
<vcpupin vcpu="2" cpuset="6"/>
<vcpupin vcpu="3" cpuset="7"/>
</cputune>
virsh 사용법
ㅇ domain 생성 (format: virsh create <xml file>)
virsh create /storage/controller.xml
Libvirt에 command line parameter를 전달하는 방법이 존재
<disk type='file' device='disk'> <driver name='qemu' type='raw' cache='none' io='native'/> <source file='path/to/disk.img'/> <target dev='vda' bus='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/> </disk> ... </devices> <qemu:commandline> <qemu:arg value='-set'/> <qemu:arg value='device.virtio-disk0.scsi=off'/> </qemu:commandline> <!-- config-wce=off is not needed in RHEL 6.4 --> <qemu:commandline> <qemu:arg value='-set'/> <qemu:arg value='device.virtio-disk0.config-wce=off'/> </qemu:commandline> <qemu:commandline> <qemu:arg value='-set'/> <qemu:arg value='device.virtio-disk0.x-data-plane=on'/> </qemu:commandline> <domain>
Note that <qemu:commandline> must be added directly inside <domain> and not inside a child tag like<devices>.
If you do not use libvirt the QEMU command-line is:
qemu -drive if=none,id=drive0,cache=none,aio=native,format=raw,file=path/to/disk.img \ -device virtio-blk,drive=drive0,scsi=off,config-wce=off,x-data-plane=on
CDROM attach
<os> <type arch='i686' machine='pc'>hvm</type> <boot dev='cdrom'/> </os>
<disk type='file' device='cdrom'> <source file='/home/user/boot.iso'/> <target dev='hdc'/> <readonly/> </disk>
virtio multiqueue
<interface type='bridge'> <mac address='52:54:00:43:6e:3f'/> <source bridge='clients'/> <model type='virtio'/> <driver name='vhost' queues='5'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </interface>
ovs NIC attach
<interface type='bridge'> <mac address='52:54:00:71:b1:b6'/> <source bridge='ovsbr'/> <virtualport type='openvswitch'/> </interface>