[libvirt] [PATCH 4/4] virsh: concatenate qemu-monitor-command arguments

Daniel P. Berrange berrange at redhat.com
Mon Aug 8 09:40:26 UTC 2011


On Fri, Aug 05, 2011 at 06:00:08PM -0600, Eric Blake wrote:
> Call me lazy, but:
> 
> virsh qemu-monitor-command dom --hmp info status
> 
> is nicer than:
> 
> virsh qemu-monitor-command dom --hmp 'info status'

This does introduce a quoting problem though. eg consider

   virsh qemu-monitor-command dom --hmp 'foo  "Hello World"'

vs what you'd now allow:

   virsh qemu-monitor-command dom --hmp foo "Hello World"

but....

> @@ -12402,10 +12405,17 @@ cmdQemuMonitorCommand(vshControl *ctl, const vshCmd *cmd)
>      if (dom == NULL)
>          goto cleanup;
> 
> -    if (vshCommandOptString(cmd, "cmd", &monitor_cmd) <= 0) {
> -        vshError(ctl, "%s", _("missing monitor command"));
> +    while ((opt = vshCommandOptArgv(cmd, opt))) {
> +        virBufferAdd(&buf, opt->data, -1);
> +        if (pad)
> +            virBufferAddChar(&buf, ' ');
> +        pad = true;
> +    }

...this loop will loose the quoting on 'Hello World' I believe.


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list