[libvirt] [PATCH v2 2/2] virsh: enable --table with --name or --uuid

Chen Hanxiao chen_han_xiao at 126.com
Mon Jul 4 12:07:03 UTC 2016


At 2016-06-29 05:36:30, "John Ferlan" <jferlan at redhat.com> wrote:
>
>
>On 06/24/2016 12:44 PM, Chen Hanxiao wrote:
>> From: Chen Hanxiao <chenhanxiao at gmail.com>
>> 
>>  remove restrictions of --table with --name or --uid.
>
>I think what you're trying to do is allow --uuid to be printed in the
>--table output.  I don't htink --name should be mentioned/modified.

Yes, I want to remove that restrictions.

>
>> 
>> Signed-off-by: Chen Hanxiao <chenhanxiao at gmail.com>
>> ---
>>  tools/virsh-domain-monitor.c | 46 +++++++++++++++++++++++++++++++++++++++-----
>>  1 file changed, 41 insertions(+), 5 deletions(-)
>
>again, no virsh.pod change.  But how exactly it changes depends on the
>final result here, so no suggestions yet.
>
>Adding UUID easily goes beyond 80 columns (e.g. normal screen width).
>Although it wouldn't be the first...

--title may easily goes beyond that limit too :)

>
>Another option for display is using 2 columns, e.g.:
>
>Id:    -
>Name:  dom1
>UUID:  56c1f811-3ffc-4363-b2d9-06bdc9fbbe2b
>State: shut off
>Title:
>
>But that's a lot like {vol|pool}-info command output and probably should
>be reserved for a similarly verbose dom-info type output.
>
>> 
>> diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c
>> index c712fa5..2596504 100644
>> --- a/tools/virsh-domain-monitor.c
>> +++ b/tools/virsh-domain-monitor.c
>> @@ -1844,22 +1844,33 @@ cmdList(vshControl *ctl, const vshCmd *cmd)
>>      FILTER("state-shutoff", VIR_CONNECT_LIST_DOMAINS_SHUTOFF);
>>      FILTER("state-other",   VIR_CONNECT_LIST_DOMAINS_OTHER);
>>  
>> -    VSH_EXCLUSIVE_OPTIONS("table", "name");
>
>This one is unrelated and I think stays; otherwise, one could get the
>impression that --name is optional, which it's not.
>
>> -    VSH_EXCLUSIVE_OPTIONS("table", "uuid");
>> -
>>      if (!optUUID && !optName)
>>          optTable = true;
>> +    if (optUUID && optTitle)
>> +        optTable = true;
>
>The rest works, but is really repetitive... let's see what/if anyone
>else has comments on this. Maybe there's someone else with "thoughts" on
>how to print out the headers "nicer" or "more cleanly".
>

The movitvation of 2/2 is to remove the restrictions of:
 if (optTable + optName + optUUID > 1) 

Comments are welcome.

Regards,
- Chen




More information about the libvir-list mailing list