Re: [PATCH] virsh: rework command parsing (was: Re: Question, how to use virDomainQemuMonitorCommand())

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 13, 2010 at 03:41:51PM +0800, Lai Jiangshan wrote:
> On 09/09/2010 09:07 PM, Daniel P. Berrange wrote:
> > 
> > While re-writing the command line mashing to not loose quotes would be
> > nice, the more obvious fix is to not mash all the args back into a
> > string at all. The virsh command ultimately wants char **argv, and we 
> > already have char **argv. So doing a char ** -> char * -> char **
> > conversion is just insanity.
> > 
> > Daniel
> 
> I did it as your suggested! Thanks a lot, see the following patch:
> 
> Subject: [PATCH] virsh: rework command parsing
> 
> Old virsh command parsing mashes all the args back into a string and
> miss the quotes, this patch fixes it. It is also needed for introducing
> qemu-monitor-command.
> 
> This patch split the command-parsing into 2 phrases:
> 1) parse command string and make it into <args, argv> style arguments.
> 2) parse <args, argv> style arguments and make it into vshCmd structure.

This sounds good, though I can barely understand the patch diff with
the hairy hand-crafted parser we have there :-)

> 
> Misc changes:
> 1) support escape '\'
> 2) a better quoting support, the following commands are now supported:
>      virsh # dumpxml --"update-cpu" vm1
>      virsh # dumpxml --update-cpu vm"1"
> 3) better handling the boolean options, in old code the following commands are equivalent: 
>      virsh # dumpxml --update-cpu=vm1
>      virsh # dumpxml --update-cpu vm1
>    after this patch applied, the first one will become illegal.

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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]