Building qemu & libvirt from scratch…


git clone git://
git clone git:// (4/12/12)
aptitude install libvdeplug2 libvdeplug2-dev libaio1 libaio-dev libcap-dev libattr1-dev libsdl-dev libxml2-dev



make && make install


./configure --enable-kvm --enable-vde --enable-virtfs --enable-linux-aio --enable-libiscsi --enable-sdl --target-list=i386-softmmu,x86_64-softmmu,i386-linux-user,x86_64-linux-user --audio-drv-list=alsa
make && make install


(maybe you should build libvirt with python < v3.2)

configure: Drivers
configure:       Xen: no
configure:      QEMU: yes
configure:       UML: yes
configure:    OpenVZ: yes
configure:    VMware: yes
configure:      VBox: yes
configure:    XenAPI: no
configure:  xenlight: no
configure:       LXC: yes
configure:      PHYP: yes
configure:       ESX: yes
configure:   Hyper-V: no
configure: Parallels: yes
configure:      Test: yes
configure:    Remote: yes
configure:   Network: yes
configure:  Libvirtd: yes
configure: Interface: yes
configure:   macvtap: yes
configure:  virtport: yes
configure: Storage Drivers
configure:      Dir: yes
configure:       FS: yes
configure:    NetFS: yes
configure:      LVM: yes
configure:    iSCSI: yes
configure:     SCSI: yes
configure:    mpath: yes
configure:     Disk: no
configure:      RBD: no
configure: Sheepdog: no
configure: Libraries
configure:   libxml: -I/usr/include/libxml2   -lxml2  
configure:   dlopen: -ldl
configure:  libcurl: -DCURL_DISABLE_TYPECHECK   -lcurl  
configure: openwsman: no
configure:  libssh2:   -lssh2  
configure:   gnutls: -I/usr/include/p11-kit-1   -lgnutls   -lgcrypt
configure:     sasl:   -lsasl2
configure:     yajl:   -lyajl
configure:  sanlock: no
configure: firewalld: yes
configure:    avahi: no
configure:   polkit: /usr/bin/pkcheck (version 1)
configure:    audit: no
configure:  selinux: no
configure: apparmor: no
configure:  numactl: no
configure:    capng:  -lcap-ng
configure:      xen: no
configure:   xenapi: no
configure: xenlight: no
configure:      hal: no
configure:     udev:   -ludev -lrt     -lpciaccess  
configure:    netcf: no
configure:     pcap: -I/usr/include -L/usr/lib64 -Wl,-rpath,/usr/lib64 -lpcap
configure:       nl: -I/usr/include/libnl3   -I/usr/include/libnl3   -lnl-3   -lnl-route-3 -lnl-3  
configure:    mscom: no
configure:      xdr: 
configure:      rbd: no
make && make install

If you getting errors like this one

make[3]: Entering directory `/home/rmichel/src/libvirt-1.0.0/python'
  File "./", line 21
    print "test"
SyntaxError: invalid syntax
make[3]: *** [] Error 1

you are using python 3.2.x (or newer) and should switch back to python 2.7.x!

The problem is the ‘print’ function. In python 2.7.x the syntax is print "foobar" but in 3.x that’s not valid anymore! Instead you should be use print("foobar") (which is also valid in 2.7.x) !!



qemu [...] -drive file=iscsi://,if=scsi,bus=0,unit=3


vde_switch -s /tmp/vdesock1 &
qemu [...] -net nic -net vde,vlan=0,sock=/tmp/vdesock1

“QEMU has two asynchronous I/O mechanisms: POSIX AIO emulation using a pool of worker threads and native Linux AIO.”

qemu [...] -drive file=foo.img,aio=[threads|native]

libvirt – QEMU Monitor Protocol (QMP)

Because libvirt self is using the qemu monitor to mange the guests, it is not available for the user. Since version 0.8.6 [1] its possbile to send a command throught libvirt to the monitor.

virsh qemu-monitor-command <domain> <command>

The problem is that you must use the QMP format to send a command like

$ virsh qemu-monitor-command <domain> \
    '{"execute":"human-monitor-command","arguments":{"command-line":"info kvm"}}'

The solution: Human Monitor Protocol / --hmp

With this nifty switch [2] its possible to use qemu monitor commands without the QMP format like

$ virsh qemu-monitor-command --hmp <domain> 'info kvm'
kvm support: enabled