File s390-tools-sles11-lszfcp-P-option of Package s390-tools

Description: lszfcp: Fix lszfcp -P after removal of a port
Symptom:     Port shown after removal, error in displaying
Problem:     zfcp saves scsi bindings. lszfcp iterates over these bindings
             and reads information found to these bindings via fc_remote_ports
             in another branch of /sys/bus/ccw/devices branch. There the port
             information is no longer available.
Solution:    Check port_state attribute of a port under fc_remote_ports
             branch in sysfs before adding the port to lszfcps port list.
---
 zconf/lszfcp |    8 ++++++++
 1 file changed, 8 insertions(+)

Index: s390-tools-sles11/zconf/lszfcp
===================================================================
--- s390-tools-sles11.orig/zconf/lszfcp
+++ s390-tools-sles11/zconf/lszfcp
@@ -193,6 +193,14 @@ show_ports()
 
 	for FC_PORT_PATH in $PORT_LIST; do
 		PORT=`basename $FC_PORT_PATH`
+		read PORT_STATE < $FC_PORT_PATH/port_state
+		if [ "$PORT_STATE" == "Online" ];
+		then
+			read WWPN < $FC_PORT_PATH/port_name
+		else
+			continue
+		fi
+
 		read WWPN < $FC_PORT_PATH/port_name
 
 		[ $WWPN != ${PAR_WWPN:-$WWPN} ] && continue
openSUSE Build Service is sponsored by