[libvirt] [PATCH] virsh: introduce name-uuid for list command

John Ferlan jferlan at redhat.com
Mon Jun 20 18:02:40 UTC 2016



On 06/20/2016 10:51 AM, Chen Hanxiao wrote:
> 
> At 2016-06-20 21:38:42, "Peter Krempa" <pkrempa at redhat.com> wrote:
>> On Mon, Jun 20, 2016 at 19:22:45 +0800, Chen Hanxiao wrote:
>>>
>>> At 2016-06-15 17:36:05, "Chen Hanxiao" <chen_han_xiao at 126.com> wrote:
>>>> From: Chen Hanxiao <chenhanxiao at gmail.com>
>>>>
>>>> This patch will show both name and UUID of domain:
>>>>
>>>> Id    Name                           State      UUID
>>>> ---------------------------------------------------------------------------------------
>>>>  3     f23                            running    918f1dd6-b19f-412b-ba17-d113bad89af8
>>>>
>>>> Signed-off-by: Chen Hanxiao <chenhanxiao at gmail.com>
>>>> ---
>>>
>>> ping?
>>
>> Jan already provided a review. I agree with his view. Allowing both
>> --name --uuid is better than the new argument.
> 
> Hi,
> 
> My only concern is that why we forbid --uuid with --name at the same time at the begining.
> If we let them come together, does that bring some backcompat issues?
> 

you can research the history rather easily using gitk... I suggest
looking at commit id '419e5fb3' which implemented the --uuid and --name
switches and the commit message gives you more details.

In addition to what's already been posted - you're adding UUID but
making it an exclusive of optTitle, but I see no check for that. What if
someone wanted both?

Another way to "think" about this is that "by default" there are 3 items
displayed. Historically, if someone uses --uuid, then only uuid's are
displayed. Likewise, if someone uses --name, then only name's are
displayed.  Over time, we allowed --title to mean default (or optTable
in the code) plus title.

So now you're proposing to allow displaying the UUID. Since it's not a
"default" output, you can choose where/how to place it. Of course your
proposal can bring out various opinions - my would probably keep Name
and UUID closer together.  UUID is at least "sized" so that helps with
columnar output.

Perhaps using the VSH_EXCLUSIVE* macros may help you devise a way to
print out perhaps what someone wants. I don't think it would be
difficult to allow the default, but then allow someone to supply other
column names as switches to allow an "ordered" display of data (eg,
virsh --id --name, displays id and name.  virsh --name --uuid --state
displays name, uuid, and state).

John




More information about the libvir-list mailing list