
On Wed, Oct 21, 2015 at 10:48:13 +0200, Michal Privoznik wrote:
So, consider following scenario:
virsh # migrate --help
In this case migrate help is printed out. So far so good. However, you start writing this long migrate command (I bet you know the arguments there can get quite long), but then, at some point you need to print out the help. Something like this:
virsh # migrate --copy-storage-all --migrate-disks --help
In this specific case you just want to see the format that --migrate-disks accepts. So you append --help and expect help to be printed out. Well, it will not, because "--help" is taken as data to --migrate-disks. Therefore we will get this error instead:
virsh # migrate --copy-storage-all --migrate-disks --help error: command 'migrate' requires <domain> option error: command 'migrate' requires <desturi> option
Teach our parsing code, that --help may occur even in argument data, and therefore anywhere on the command line.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- tools/vsh.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
The following then won't be possible: $ virsh start --domain --help Domain --help started $ virsh list Id Name State ---------------------------------------------------- 2 --help running $ virsh destroy --domain --help Domain --help destroyed If you are curious whether such config is actually valid ... # virt-xml-validate /etc/libvirt/qemu/--help.xml /etc/libvirt/qemu/--help.xml validates Since the schema looks like: <define name="domainName"> <data type="string"> <!-- Use literal newline instead of \n for bug in libxml2 2.7.6 --> <param name="pattern">[^ ]+</param> </data> </define> Peter