On Fri, Jul 09, 2010 at 03:03:59PM -0400, Chris Lalancette wrote:
On 07/09/10 - 01:45:25PM, Charles Duffy wrote:
> On 07/07/2010 04:33 PM, Chris Lalancette wrote:
Now that 0.8.3 is out with all the patches except the problem of
access from virsh, it's time to look at this again :-)
> >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.
I think we need 2 command to try to solve it:
- one virsh command for non-interactive use, where the command is being
passed from a file, that way we can provide a garanteed way the
command won't get mangled by shell parsing or args.
- one virsh command for interractive use where the command is parsed
from the usual way (i.e. ether the result of shell parsing or what
the user typed in interractive mode).
Also as a convenience I think we should patch virsh to accept '-' as
reading from the stdin, for all commands where we use a filename, that's
very convenient I use it quite a bit for xmllint, and would be useful
there too I think.
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/