Linux Device Mapper development
 help / color / mirror / Atom feed
From: Benjamin Marzinski <bmarzins@redhat.com>
To: Steffen Maier <maier@linux.ibm.com>
Cc: dm-devel@redhat.com,
	ShivaKrishna Merla <shivakrishna.merla@netapp.com>,
	Martin Wilck <martin.wilck@suse.com>
Subject: Re: [dm-devel] [PATCH 2/2] libmultipath: add %L path wildcard for 64-bit hex LUN
Date: Thu, 10 Feb 2022 12:42:07 -0600	[thread overview]
Message-ID: <20220210184207.GF24684@octiron.msp.redhat.com> (raw)
In-Reply-To: <20220209194713.56556-3-maier@linux.ibm.com>

On Wed, Feb 09, 2022 at 08:47:13PM +0100, Steffen Maier wrote:
> Complements v0.6.0 commit
> 01ab2a468ea2 ("libmultipath: Add additional path wildcards") as well as
> ("libmultipath: support host adapter name lookup for s390x ccw bus").
> 
> With that we can easily get the full FCP addressing triplet
> (HBA, WWPN, FCPLUN) from multipath tools without additional tools
> and correlation:
> 
> $ multipathd -k'show paths format "%w|%a|%r|%L"'
> uuid                             |host adapter|target WWPN       |LUN hex
> 36005076400820293e8000000000000a0|0.0.5080    |0x500507680b25c449|0x00a0000000000000
> 36005076400820293e8000000000000a0|0.0.5080    |0x500507680b25c448|0x00a0000000000000
> 36005076400820293e8000000000000a0|0.0.50c0    |0x500507680b26c449|0x00a0000000000000
> 36005076400820293e8000000000000a0|0.0.50c0    |0x500507680b26c448|0x00a0000000000000
> 
> Likewise, add a field lun_hex for JSON path output.
> 
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
> Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
> Signed-off-by: Steffen Maier <maier@linux.ibm.com>
> ---
>  libmultipath/print.c | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/libmultipath/print.c b/libmultipath/print.c
> index 221b515f23d3..4f6146e85fc9 100644
> --- a/libmultipath/print.c
> +++ b/libmultipath/print.c
> @@ -96,6 +96,7 @@
>  			     "            \"host_wwpn\" : \"%R\",\n" \
>  			     "            \"target_wwpn\" : \"%r\",\n" \
>  			     "            \"host_adapter\" : \"%a\",\n" \
> +			     "            \"lun_hex\" : \"%L\",\n" \
>  			     "            \"marginal_st\" : \"%M\""
>  
>  #define PROGRESS_LEN  10
> @@ -451,6 +452,24 @@ snprint_hcil (struct strbuf *buff, const struct path * pp)
>  			pp->sg_id.lun);
>  }
>  
> +
> +static int
> +snprint_path_lunhex (struct strbuf *buff, const struct path * pp)
> +{
> +	uint64_t lunhex = SCSI_INVALID_LUN, scsilun;
> +
> +	if (!pp || pp->sg_id.host_no < 0)
> +		return print_strbuf(buff, "0x%016" PRIx64, lunhex);
> +
> +	scsilun = pp->sg_id.lun;
> +	/* cf. Linux kernel function int_to_scsilun() */
> +	lunhex = ((scsilun & 0x000000000000ffffULL) << 48) |
> +		((scsilun & 0x00000000ffff0000ULL) << 16) |
> +		((scsilun & 0x0000ffff00000000ULL) >> 16) |
> +		((scsilun & 0xffff000000000000ULL) >> 48);
> +	return print_strbuf(buff, "0x%016" PRIx64, lunhex);
> +}
> +
>  static int
>  snprint_dev (struct strbuf *buff, const struct path * pp)
>  {
> @@ -842,6 +861,7 @@ static const struct path_data pd[] = {
>  	{'0', "failures",      snprint_path_failures},
>  	{'P', "protocol",      snprint_path_protocol},
>  	{'I', "init_st",       snprint_initialized},
> +	{'L', "LUN hex",       snprint_path_lunhex},
>  };
>  
>  static const struct pathgroup_data pgd[] = {
> -- 
> 2.27.0

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


  reply	other threads:[~2022-02-10 18:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-09 19:47 [dm-devel] [PATCH 0/2] multipath-tools: FCP addressing display support (for s390x) Steffen Maier
2022-02-09 19:47 ` [dm-devel] [PATCH 1/2] libmultipath: support host adapter name lookup for s390x ccw bus Steffen Maier
2022-02-10 18:41   ` Benjamin Marzinski
2022-02-09 19:47 ` [dm-devel] [PATCH 2/2] libmultipath: add %L path wildcard for 64-bit hex LUN Steffen Maier
2022-02-10 18:42   ` Benjamin Marzinski [this message]
2022-02-10 19:54     ` Martin Wilck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220210184207.GF24684@octiron.msp.redhat.com \
    --to=bmarzins@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=maier@linux.ibm.com \
    --cc=martin.wilck@suse.com \
    --cc=shivakrishna.merla@netapp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox