[libvirt] how to pass qemu options?

Daniel P. Berrange berrange at redhat.com
Thu May 15 12:00:47 UTC 2008


On Thu, May 15, 2008 at 09:10:31AM +0200, Gerd Hoffmann wrote:
> David Abrahams wrote:
> > I normally launch my kvm VM from the command line with "-redir tcp:3389:3389"
> > but have been unable to find a way to set up virt-manager to launch it the same
> > way.  Ditto for other qemu options such as "-soundhw all".  Is there a way?
> 
> Not directly in the config.  Usual trick is to create a wrapper script
> like this (for a serial console in that case) ...
> 
>   [root at xeni f8-32]# cat /root/bin/qemu-serial
>   #!/bin/sh
>   exec /usr/bin/qemu-kvm "$@" -serial telnet::9999,server,nowait,nodelay
> 
> ... then edit the xml config to make the <emulator> tag point to the
> wrapper script instead of /usr/bin/qemu-kvm.
> 
> Hmm, maybe the emulator tag should get a args attribute, so one can do
> that kind of stuff without wrapper scripts, like this:
> 
>   <domain type='kvm'>
>     [ ... ]
>     <devices>
>       <emulator args="-redir ...">/usr/bin/qemu-kvm</emulator>
>   [ ... ]
> 
> The usual ones should be supported by libvirt directly of course.
> Serial console is in cvs meanwhile, I've seen also sound support
> patches.  But for unusual configurations and debugging purposes it would
> be quite handy to have the additional args directly in the config and
> not hidden somewhere in a separate script ...

We explicitly do not support passing arbitrary arguments to QEMU. The libvirt
XML format has to be portable & have clearly defined semantics. Adding QEMU
specifics args clearly violates that requirement. Furthermore we cannot 
guarentee the behaviour of QEMU when adding extra arguments, since one arg
may change / override the behaviour of another. We've hit this problem in
the past with -nographics overriding the monitor device setup & thus breaking
our control of QEMU. There's similar issues with the various ways to specify
disks overriding each other

While you are free to define a wrapper around QEMU to pass extra args, be
aware that this is completely unsupportable & we can make no guarentees that
your wrapper will continue to run with the same semantics in future libvirt
releases. 

Regards,
Dan.
-- 
|: Red Hat, Engineering, Boston   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list