From 798bd752cf204a7ebd655420ce39d8a40e0cfc1b Mon Sep 17 00:00:00 2001 From: Fedor Loshakov Date: Mon, 9 Dec 2024 14:50:34 +0100 Subject: [PATCH] ziomon/ziorep_config: extract PCHID and add to internal report MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Steffen Maier Reviewed-by: Benjamin Block Reviewed-by: Sakshi Singh <005c7w@linux.ibm.com> Reviewed-by: M Nikhil Signed-off-by: Jan Höppner --- ziomon/ziorep_config | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ziomon/ziorep_config b/ziomon/ziorep_config index 980a59a9..39d9cce9 100755 --- a/ziomon/ziorep_config +++ b/ziomon/ziorep_config @@ -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";