Re: [PATCH] vsh: print help more often

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

 



On 21.10.2015 13:19, Peter Krempa wrote:
> 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@xxxxxxxxxx>
>> ---
>>  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
> 


Well, I'd say <not_personal>if you are that stupid to call your domain
like that, you should suffer</not_personal>, but I don't care that much
if this patch goes in or not.

Michal

--
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]