On Sun, Apr 11, 2010 at 11:17:38PM +0100, Jamie Lokier wrote:
Richard W.M. Jones wrote:
> On Fri, Apr 09, 2010 at 10:06:51PM +0100, Jamie Lokier wrote:
> > Daniel P. Berrange wrote:
> > > I think this alteration of existing args is faaaar too complex &
fragile,
> > > and way overkill.
> >
> > Would it not be simpler, for the target audience, for the config to
> > contain a one-line shell script to transform particular matched
> > arguments in any way that's wanted?
>
> I might be missing something but I thought you could already do this
> in current libvirt. ie. Change the <emulator> element [1] to point to
> your shell script:
>
> <emulator>/usr/local/bin/my-qemu-wrapper.sh</emulator>
>
> The wrapper should get called with the command line arguments and you
> can alter them however you like.
>
> Isn't that right, Dan?
That forces the shell script to be relatively complicated and
recognise all qemu arguments (including version specific ones) to skip
the ones with parameters - and to know where to look for the real
target executable is.
It's not a very friendly way to add or change parts of specific
subsystems, for example modifying a blockdev parameter, but it can be
done that way if necessary.
It's not that hard to write this for trivial extra options:
<emulator>/bin/sh -c 'qemu "$0" "$@"
-extra-flag'</emulator>
(if that works).
That won't work because we expect the emulator to be a path to
the emulator program, so yes that has to be done in the wrapper script.
Parsing libvirt output and having to guess which option corresponds
to
what from the libvirt config sounds very fragile and also a rather
large amount of effort for something which should be easy.
it's not that easy because we change the way we build the command line
for qemu as qemu evolves. for example before and after the support for
-device there have been a lot of changes.
And then there's modifying how network tap devices are set up
and
other networking, outside qemu, but requested by libvirt. Doing that
in <emulator> sounds like a bad idea, but script hooks are the only
sane way to make networking fit every environment and requirement.
Ideally without forcing the hook writer to reimplement the normal
network setup from scratch just to tweak it a bit. I apologise if
libvirt already provides such hooks - I haven't looked at that part of
it.
Well it's very new, and I still didn't wrote the documentation for it
so that's notmal, not your fault :-)
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit
http://xmlsoft.org/
daniel(a)veillard.com | Rpmfind RPM search engine
http://rpmfind.net/
http://veillard.com/ | virtualization library
http://libvirt.org/