From 41eb7d076f5c53eca1e3ef82c77876b117d333ef Mon Sep 17 00:00:00 2001 From: Nihar Panda Date: Sun, 28 Jul 2024 14:55:47 +0530 Subject: [PATCH] ziomon/ziorep_config: fix warning when multipath device is not there MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Perl logs warning message if a variable is not initialized. get_device_data() set mp_dev with multipath device for a scsi disk device. mp_dev remain uninitialized if there is no multipath device. This can happen if a scsi device is not managed by dm multipath driver. Warning message: "Use of uninitialized value in subroutine entry at /usr/sbin/ziorep_config line 136" Fix it by skipping the code dealing with mp_dev and continue with next scsi device in the loop. To reproduce, remove a scsi device from dm multipath. $multipathd -k'del path sdh' Then run `ziorep_config -D`. Signed-off-by: Nihar Panda Reviewed-by: Fedor Loshakov Reviewed-by: Benjamin Block Signed-off-by: Jan Höppner --- ziomon/ziorep_config | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ziomon/ziorep_config b/ziomon/ziorep_config index 47154a0a..980a59a9 100755 --- a/ziomon/ziorep_config +++ b/ziomon/ziorep_config @@ -5,7 +5,7 @@ # # Script to list the FCP, SCSI and multipath configuration # -# Copyright IBM Corp. 2008, 2017 +# Copyright IBM Corp. 2008, 2024 # # s390-tools is free software; you can redistribute it and/or modify # it under the terms of the MIT license. See LICENSE for details. @@ -130,8 +130,8 @@ sub get_device_data unless(!$devices{$hctl}{dev}); $devices{$hctl}{mm} = get_line("dev"); $devices{$hctl}{mp_dev} = glob_last("holders", "dm*"); - $devices{$hctl}{mp_dev} =~ s/.*\/(.+)\Z/$1/ - unless (!$devices{$hctl}{mp_dev}); + next if !defined $devices{$hctl}{mp_dev}; + $devices{$hctl}{mp_dev} =~ s/.*\/(.+)\Z/$1/; $c_src = catdir($base_dir, "sys", "block", $devices{$hctl}{mp_dev}); $devices{$hctl}{mp_dev_mm} = get_line("dev"); @@ -297,7 +297,7 @@ sub mapper_report "=====================================================\n"; } foreach my $hctl (sort keys %devices) { - next if (! $devices{$hctl}{mp_dev}); + 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 (@$s_devs && "@$s_devs" !~ /\b$devices{$hctl}{dev}\b/); @@ -391,7 +391,7 @@ MSG sub version { print "$PROGRAM_NAME: version %S390_TOOLS_VERSION%\n"; - print "Copyright IBM Corp. 2008, 2017\n"; + print "Copyright IBM Corp. 2008, 2024\n"; } sub unpack_config