[libvirt] [PATCH V3 0/8] virsh: rework command parsing

2010-10-12 Thread Lai Jiangshan


Old virsh command parsing mashes all the args back into a string and
miss the quotes, this patches fix it. It is also needed for introducing
qemu-monitor-command which is very useful.

This patches add vrshCommandParser abstraction to parser the args.
For command string, we use vshCommandStringParse()
For command argument vector, we use vshCommandArgvParse()

And the usage was changed:
old:
virsh [options] [commands]

new:
virsh [options]... [command_string]
virsh [options]... command [args...]

So we still support commands like:
# virsh define D.xml; dumpxml D
define D.xml; dumpxml D was parsed as a commands-string.

and support commands like:
# virsh qemu-monitor-command f13guest info cpus
we will not mash them into a string, we use new argv parser for it.

But we don't support the command like:
# virsh define D.xml; dumpxml D
define D.xml; dumpxml was parsed as a command-name, but we have no such 
command-name.

Misc changed behavior:
1) support single quote
2) support escape '\'
3) a better double quoting support, the following commands are now supported:
 virsh # dumpxml --update-cpu vm1
 virsh # dumpxml --update-cpu vm1
4) 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.
5) support --

The idea of this patch is from Daniel P. Berrange.

changed from V1:
changed the usage as Eric Blake suggested.
changed from V2
new vrshCommandParser abstraction
apply Eric Blake's comments.

Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com
---
 virsh.c |  259 +---
 1 file changed, 152 insertions(+), 107 deletions(-)

---
I was preparing for linuxcon japan and attended it and took a long vacation
after it, very late for V3.

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


Re: [libvirt] [PATCH V3 0/8] virsh: rework command parsing

2010-10-12 Thread Eric Blake

On 10/12/2010 01:13 AM, Lai Jiangshan wrote:



Old virsh command parsing mashes all the args back into a string and
miss the quotes, this patches fix it. It is also needed for introducing
qemu-monitor-command which is very useful.

This patches add vrshCommandParser abstraction to parser the args.


Thanks for splitting it up!  It will make reviews easier.  However, in 
the future, you should try and convince 'git send-email' or whatever 
mechanism you use to send patches to do shallow threading (all 8 of the 
n/8 patches should be in-reply-to the 0/8 cover letter), as it makes 
reviewing easier when the series is a single thread.


--
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org

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


Re: [libvirt] [PATCH V3 0/8] virsh: rework command parsing

2010-10-12 Thread Eric Blake

On 10/12/2010 09:50 AM, Eric Blake wrote:

On 10/12/2010 01:13 AM, Lai Jiangshan wrote:



Old virsh command parsing mashes all the args back into a string and
miss the quotes, this patches fix it. It is also needed for introducing
qemu-monitor-command which is very useful.

This patches add vrshCommandParser abstraction to parser the args.


Thanks for splitting it up! It will make reviews easier. However, in the
future, you should try and convince 'git send-email' or whatever
mechanism you use to send patches to do shallow threading (all 8 of the
n/8 patches should be in-reply-to the 0/8 cover letter), as it makes
reviewing easier when the series is a single thread.


Now that I've done a bit more research; here's the results, to make it 
easier for others to do:


git config sendemail.chainreplyto false
git config sendemail.thread false
git config format.thread shallow

Then:

git send-email -8 --cover-letter

will automatically send 8 messages all in reply to the cover letter, 
creating a single thread.


--
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org

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


Re: [libvirt] [PATCH V3 0/8] virsh: rework command parsing

2010-10-12 Thread Laine Stump

 On 10/12/2010 12:26 PM, Eric Blake wrote:


Now that I've done a bit more research; here's the results, to make it 
easier for others to do:


git config sendemail.chainreplyto false
git config sendemail.thread false
git config format.thread shallow

Then:

git send-email -8 --cover-letter

will automatically send 8 messages all in reply to the cover letter, 
creating a single thread.




Odd that it should require any configuring - mine has just always worked 
that way when I do, eg:


   git send-email -8 --compose

(I hadn't seen --cover-letter before. The man page for git-send-email 
only lists --compose, and I see the man page for git-format-patch only 
lists --cover-letter, but git send-email accepts both; I assume they're 
synonyms)


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