ziomon/ziorep_config: Add fcp-lun to -M option output

Update the ‘ziorep_config’ utility to print FCP-LUN details
when the ‘-M’ option is used.

Now, ‘ziorep_config -M' option prints FCP LUN(fcp-lun) ID along with the
existing FCP device bus-id and WWPN. This addition helps correlate the
output with command 'multipathd -k', subcommand 'show topo' output,
aiding in better visibility and mapping of FCP devices to their respective
LUNs in multipath environments.

$ ziorep_config -t -M
adapter  remote_port        LUN                scsi_dev multipath_device
========================================================================
0.0.1967 0x500507630704572c 0x405240f500000000 /dev/sda /dev/mapper/mpatha
0.0.1967 0x500507630704572c 0x405340f500000000 /dev/sdb /dev/mapper/mpathb
0.0.1927 0x500507630700572c 0x405240f500000000 /dev/sdc /dev/mapper/mpatha
0.0.1967 0x500507630704572c 0x405440f500000000 /dev/sdd /dev/mapper/mpathc
0.0.1927 0x500507630700572c 0x405340f500000000 /dev/sde /dev/mapper/mpathb
0.0.1927 0x500507630700572c 0x405440f500000000 /dev/sdf /dev/mapper/mpathc
0.0.1967 0x500507630704572c 0x405540f500000000 /dev/sdg /dev/mapper/mpathd
0.0.1927 0x500507630700572c 0x405540f500000000 /dev/sdh /dev/mapper/mpathd

The LUN IDs from the above output can be correlated with multipath's
H-C-T-L(LUN ID in decimal) of each FCP devices as shown below,
$ multipathd -k
multipathd > show topo
create: mpatha (36005076307ffd72c00000000000052f5) dm-0 IBM,2107900
size=40G features='1 queue_if_no_path' hwhandler='1 alua' wp=rw
`-+- policy='service-time 0' prio=50 status=active
  |- 0:0:0:1089814610 sdc 8:32  active ready running
  `- 1:0:0:1089814610 sda 8:0   active ready running
create: mpathb (36005076307ffd72c00000000000053f5) dm-1 IBM,2107900
size=40G features='1 queue_if_no_path' hwhandler='1 alua' wp=rw
`-+- policy='service-time 0' prio=50 status=active
  |- 0:0:0:1089814611 sde 8:64  active ready running
  `- 1:0:0:1089814611 sdb 8:16  active ready running
create: mpathc (36005076307ffd72c00000000000054f5) dm-4 IBM,2107900
size=20G features='1 queue_if_no_path' hwhandler='1 alua' wp=rw
`-+- policy='service-time 0' prio=50 status=active
  |- 0:0:0:1089814612 sdf 8:80  active ready running
  `- 1:0:0:1089814612 sdd 8:48  active ready running
create: mpathd (36005076307ffd72c00000000000055f5) dm-5 IBM,2107900
size=20G features='1 queue_if_no_path' hwhandler='1 alua' wp=rw
`-+- policy='service-time 0' prio=50 status=active
  |- 0:0:0:1089814613 sdh 8:112 active ready running
  `- 1:0:0:1089814613 sdg 8:96  active ready running

Signed-off-by: Ajaykumar Rajappa <ajaykr@linux.ibm.com>
Reviewed-by: Chinmaya Kajagar <chinmayk@linux.ibm.com>
Reviewed-by: Nihar Panda <niharp@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Ajaykumar Rajappa
2025-07-28 08:33:29 +02:00
committed by Jan Höppner
parent 095e5ee226
commit c333f91d4c

View File

@@ -303,6 +303,7 @@ sub mapper_report
{
my $adapters = shift;
my $ports = shift;
my $luns = shift;
my $s_devs = shift;
my $m_devs = shift;
my @out_str;
@@ -312,18 +313,20 @@ sub mapper_report
return;
}
if ($_[0]) {
print "adapter remote_port scsi_dev multipath_device\n",
"=====================================================\n";
print "adapter remote_port LUN scsi_dev multipath_device\n",
"========================================================================\n";
}
foreach my $hctl (sort keys %devices) {
next if (!defined $devices{$hctl}{mp_dev});
next if (@$adapters && "@$adapters" !~ /\b$devices{$hctl}{hba_id}\b/);
next if (@$ports && "@$ports" !~ /\b$devices{$hctl}{wwpn}\b/);
next if (@$luns && "@$luns" !~ /\b$devices{$hctl}{lun}\b/);
next if (@$s_devs && "@$s_devs" !~ /\b$devices{$hctl}{dev}\b/);
next if (@$m_devs && "@$m_devs" !~ /\b$mapper_dev{$devices{$hctl}{mp_dev_mm}}\b/);
my @line_str;
push @line_str, $devices{$hctl}{hba_id};
push @line_str, $devices{$hctl}{wwpn};
push @line_str, $devices{$hctl}{lun};
push @line_str, "/dev/".$devices{$hctl}{dev};
push @line_str, "/dev/mapper/".$mapper_dev{$devices{$hctl}{mp_dev_mm}};
push @out_str, "@line_str\n";
@@ -510,6 +513,6 @@ if ($device_rep) {
}
if ($map_rep) {
mapper_report(\@adapter, \@port, \@s_dev, \@m_dev, $header);
mapper_report(\@adapter, \@port, \@lun, \@s_dev, \@m_dev, $header);
}