From a92ee5ba8df60acb3b8cc785f8392a74fadb0a42 Mon Sep 17 00:00:00 2001 From: Fedor Loshakov Date: Thu, 9 Mar 2023 13:51:20 +0100 Subject: [PATCH] ziomon/ziorep_config: fix for SCSI devices of type disk without block dev MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If system configuration contains zfcp-attached SCSI devices of Peripheral Device Type disk, but without block device, e.g. because the storage reports Peripheral Qualifier 1 in INQUIRY, ziorep_config tool issue the following type of errors during generation of .config file from .cfg file: $ ziorep_config -I -i test.cfg Unpacking configuration ...Done. Use of uninitialized value in subroutine entry at /usr/sbin/ziorep_config line 36. Use of uninitialized value in subroutine entry at /usr/sbin/ziorep_config line 36. Use of uninitialized value in subroutine entry at /usr/sbin/ziorep_config line 54. Use of uninitialized value in subroutine entry at /usr/sbin/ziorep_config line 135. ... Such errors can also be seen during printing of adapter, device and map reports: $ ziorep_config -ADM -i test.cfg Unpacking configuration ...Done. Use of uninitialized value in subroutine entry at /usr/sbin/ziorep_config line 36. Use of uninitialized value in subroutine entry at /usr/sbin/ziorep_config line 36. Use of uninitialized value in subroutine entry at /usr/sbin/ziorep_config line 54. Use of uninitialized value in subroutine entry at /usr/sbin/ziorep_config line 135. ... This is because ziorep_config reads block device parameters from non-existent block device subdirectory. And therefore ziorep_config leaves block device major:minor number column empty in .config file instead of filling it with 0:0 preset value afterwards. As a consequence, ziorep_traffic tool, which is using .config file to get information about devices, reports the following error: $ ziorep_traffic test Extracting config data...done ziorep_traffic: Could not parse line 1 - configuration file broken? To fix this, skip reading the block device parameters for such devices, and use the preset values that have been set before instead. Signed-off-by: Fedor Loshakov Suggested-by: Steffen Maier Reviewed-by: Benjamin Block Reviewed-by: Steffen Maier Signed-off-by: Jan Höppner --- ziomon/ziorep_config | 1 + 1 file changed, 1 insertion(+) diff --git a/ziomon/ziorep_config b/ziomon/ziorep_config index abf3865d..47154a0a 100755 --- a/ziomon/ziorep_config +++ b/ziomon/ziorep_config @@ -124,6 +124,7 @@ sub get_device_data $devices{$hctl}{dev} = glob_last("block\:sd*"); } $devices{$hctl}{sg_mm} = get_line("generic", "dev"); + next if !defined $devices{$hctl}{dev}; $c_src = $devices{$hctl}{dev}; $devices{$hctl}{dev} =~ s/.*(sd[a-z0-9]+)\Z/$1/ unless(!$devices{$hctl}{dev});