ziomon/ziorep_config: extract PCHID and add to internal report

The ziomon_fcpconf saves a lot of information about adapter into .cfg file.
With this patch ziorep_config tool will extract PCHID additional adapter
parameter from .cfg file and put it into .config file for future evaluation by
ziorep_* tools group.

This patch also adds notification for cases, when chid sysfs entry does not
exist for specified CHPID, for example for old kernels.

Before patch application typical line example from .config file looked like:
... 253:0 /dev/sde 8388672 8:64 Disk

After application of the patch typical line example from .config file
looks like:
... 253:0 /dev/sde 8388672 8:64 Disk 01c0

On older distros, which do not contain pchid sysfs entry, typical line
example from .config file looks like:
... 253:0 /dev/sde 8388672 8:64 Disk n/a

As PCHID value of FCP adapter can now be extracted from .config file,
add PCHID field to report of ziorep_config tool.

If there was no PCHID sysfs entry on the system, print following message into
ziorep_config command output:
...
PCHID:   there is no PCHID entry in data source
...

Signed-off-by: Fedor Loshakov <loshakov@linux.ibm.com>
Reviewed-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Reviewed-by: Sakshi Singh <005c7w@linux.ibm.com>
Reviewed-by: M Nikhil <nikh1092@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Fedor Loshakov
2024-12-09 14:50:34 +01:00
committed by Jan Höppner
parent 638f0aa4f9
commit 798bd752cf

View File

@@ -70,6 +70,7 @@ sub get_sub_ch_data
$c_src = catdir($base_dir, S_DIR1, $host);
my $sub_ch;
my $adapter;
my $chp;
if (-l $c_src) {
$sub_ch = (split("/", readlink($c_src)))[-5];
$adapter = (split("/", readlink($c_src)))[-4];
@@ -90,6 +91,13 @@ sub get_sub_ch_data
"Offline";
$c_src = catdir($base_dir, S_DIR2, $sub_ch);
$sub_ch{$adapter}{chpid} = substr(get_line("chpids"), 0, 2);
$chp = "chp0." . $sub_ch{$adapter}{chpid};
$c_src = catdir($base_dir, S_DIR2, $chp);
if (-e catdir($base_dir, S_DIR2, $chp, "chid")) {
$sub_ch{$adapter}{pchid} = get_line("chid");
} else {
$sub_ch{$adapter}{pchid} = "n/a"
}
}
}
@@ -215,6 +223,7 @@ sub mapping_table
push @out_str, $devices{$line}{mm};
}
push @out_str, $devices{$line}{type};
push @out_str, $sub_ch{$devices{$line}{hba_id}}{pchid};
print "@out_str\n";
}
}
@@ -227,6 +236,11 @@ sub adapter_report
next if (@adapters && "@adapters" !~ /\b$a\b/);
my @out_str;
push @out_str, "Host: $sub_ch{$a}{host}\n";
if ($sub_ch{$a}{pchid} eq "n/a") {
push @out_str, "PCHID: there is no PCHID entry in data source\n";
} else {
push @out_str, "PCHID: $sub_ch{$a}{pchid}\n";
}
push @out_str, "CHPID: $sub_ch{$a}{chpid}\n";
push @out_str, "Adapter: $a\n";
push @out_str, "Sub-Ch.: $sub_ch{$a}{sub_ch}\n";