[libvirt] [Qemu-devel] Re: Supporting hypervisor specific APIs in libvirt

Gerd Hoffmann kraxel at redhat.com
Tue Mar 23 10:25:41 UTC 2010


On 03/23/10 09:54, Jes Sorensen wrote:
> On 03/22/10 22:53, Anthony Liguori wrote:
>> On 03/22/2010 04:33 PM, Gerd Hoffmann wrote:
>>> libvirt is very unfriendly to qemu hackers. There is no easy way to
>>> add command line switches. There is no easy way to get access to the
>>> monitor. I can get it done by pointing <emulator> to a wrapper script
>>> and mangle the qemu command line there. But this sucks big time. And
>>> it doesn't integrate with libvirt at all.
>>
>> It's not just developers. As we're doing deployments of qemu/kvm, we
>> keep running into the same problem. We realize that we need to use a
>> feature of qemu/kvm that isn't modelled by libvirt today. I've gone as
>> far as to temporarily pausing libvirtd, finding the pty fd from
>> /proc/<pid>, and hijacking the monitor session temporarily.
>
> One problem I have found, and I am not sure how to fix this in this
> context. Sometimes when hacking on qemu, I want to try out a new
> qemu binary on an existing image, without replacing the system wide
> one and may want to pass new command line flags for testing those, plus
> have access to the monitor.

Works with the wrapper script trick mentioned above.

virsh edit $domain
grep for <emulator>
make it point to a wrapper script.

My setup:

[root at xenb ~]# virsh dumpxml fedora | grep emulator
     <emulator>/root/bin/qemu-wrapper</emulator>
[root at xenb ~]# cat /root/bin/qemu-wrapper
#!/bin/sh

# distro qemu-kvm
REAL_QEMU="/usr/bin/qemu-kvm"
MORE_ARGS="-boot menu=on -cpu host -enable-nesting"

# fresh build
#REAL_QEMU="/home/kraxel/git/kvm/x86_64-softmmu/qemu-system-x86_64"
#MORE_ARGS="-L /home/kraxel/git/kvm/pc-bios -boot menu=on"

# go!
case "$1" in
         "" | -h | -help | --help)
                 # libvirt capability check
                 exec $REAL_QEMU $1
                 ;;
         *)
                 # run qemu with additional args
                 exec $REAL_QEMU "$@" $MORE_ARGS
                 ;;
esac

# should never ever arrive here
echo "$0: exec $REAL_QEMU failed" >&2
exit 1

HTH,
   Gerd




More information about the libvir-list mailing list