[libvirt] [PATCH v4 0/8]: Add arbitrary qemu command-line and monitor commands

Chris Lalancette clalance at redhat.com
Fri Jul 9 19:03:59 UTC 2010

On 07/09/10 - 01:45:25PM, Charles Duffy wrote:
> On 07/07/2010 04:33 PM, Chris Lalancette wrote:
> >There is one bug left that I have not yet been able to fix.  Because of the
> >complicated way that virsh parses command-line arguments, it is not possible
> >to pass through spaces and quotes when using the qemu-monitor-command.
> >Unfortunately, the qemu monitor commands (and in particular when using QMP)
> >depend heavily on quoting and spacing, so using virsh to send through
> >command-lines is difficult.  I'll have to think about how to better resolve
> >this issue, but it should not hold up the rest of the series.
> Would URI-style quoting (' ' -> %20) make sense here?

We could keep that in mind as a last resort, though I'd prefer to try to fix
fix the problem before resorting to it.  It's been a while since I looked
at the problem in detail, but from what I remember virsh does this thing
where it looks at everything in argv, smashes it all together (whitespace
separated), and then re-parses it.  The problem with that is that if you do
some careful quoting to get around bash whitespace issues, virsh undoes this
for you.

However, I couldn't easily fix it to *not* do this because of another feature
that virsh has, which is the ability to specify multiple virsh sub-commands
in one command, something like:

virsh <guest> "attach-disk ; detach-disk"

The combination of these make it difficult to fix, though I can't say I've
exhausted all possibilities yet.

Anyway, thanks for the idea, I'll keep it in mind when I look at this again.

Chris Lalancette

More information about the libvir-list mailing list