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@xxxxxxxxxx> > Reviewed-by: Benjamin Block <bblock@xxxxxxxxxxxxx> > Signed-off-by: Steffen Maier <maier@xxxxxxxxxxxxx> > --- > 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@xxxxxxxxxx https://listman.redhat.com/mailman/listinfo/dm-devel