Re: [PATCH] scsi: target: core: Add a way to hide a port group

Konstantin Shelekhin
2022-09-09T11:32:41Z

On Fri, Sep 09, 2022 at 02:22:35PM +0300, Dmitry Bogdanov wrote:
> On Wed, Sep 07, 2022 at 03:01:00PM -0500, Mike Christie wrote:
> >
> > On 9/6/22 2:49 AM, Dmitry Bogdanov wrote:
> > > From: Roman Bolshakov <r.bolshakov@yadro.com>
> > >
> > > Default target port group is always returned in the list of port groups,
> > > even if the behaviour is unwanted, i.e. it has no members and
> > > non-default port groups are primary port groups.
> > >
> > > A new port group attribute - "hidden" can be used to hide empty port
> > > groups with no ports in REPORT TARGET PORT GROUPS, including default
> > > target port group:
> > >
> > > echo 1 > $DEVICE/alua/default_tg_pt_gp/hidden
> > >
> >
> > How about "enable"? I think that fits how we handle other objects like
> > targets that are setup automatically but are not yet usable (can't login
> > or reported in discovery commands) and devices we have setup but are not
> > reported in commands like REPORT_LUNs (technically you need to enable and
> > map them but you get the idea I'm going for).
> There is already an enable semantic. It is pg_pt_gp_id field. Until it
> (id) is not set the port group is treated as disabled and it is not
> reported in RTPG. But the default_tg_pt_gp is enabled by default and can
> not be deleted.
>
> The patch solves the presence of non-deletable empty default_tg_pt_gp
> in RTPG.
> May be, a global attribute like target/core/alua/hide_emtpy_tpg would
> fit better than an attribute per each port group?
>
> I would always hide the empty default_lu_gp (not configurable) but I am
> afraid that it will be considered as not backward compatible change. :(

A module parameter perhaps? Or a CONFIG definition.