Code cleanup in initiator/linuxfc.py

Removed some functionally superfluous code in functions calling
LinuxFibreChannel.get_fc_hbas. Relies on said function to return
an iterable.

Change-Id: I404a3bda8bea42401b8f98d7685a176081267415
This commit is contained in:
Arne Recknagel 2016-12-01 13:30:38 +01:00
parent eca5a7f2e0
commit 2948c810f6
1 changed files with 8 additions and 16 deletions

View File

@ -139,8 +139,6 @@ class LinuxFibreChannel(linuxscsi.LinuxSCSI):
# Note(walter-boring) modern Linux kernels contain the FC HBA's in /sys
# and are obtainable via the systool app
hbas = self.get_fc_hbas()
if not hbas:
return []
hbas_info = []
for hba in hbas:
@ -162,11 +160,10 @@ class LinuxFibreChannel(linuxscsi.LinuxSCSI):
hbas = self.get_fc_hbas()
wwpns = []
if hbas:
for hba in hbas:
if hba['port_state'] == 'Online':
wwpn = hba['port_name'].replace('0x', '')
wwpns.append(wwpn)
for hba in hbas:
if hba['port_state'] == 'Online':
wwpn = hba['port_name'].replace('0x', '')
wwpns.append(wwpn)
return wwpns
@ -176,15 +173,12 @@ class LinuxFibreChannel(linuxscsi.LinuxSCSI):
# Note(walter-boring) modern Linux kernels contain the FC HBA's in /sys
# and are obtainable via the systool app
hbas = self.get_fc_hbas()
if not hbas:
return []
wwnns = []
if hbas:
for hba in hbas:
if hba['port_state'] == 'Online':
wwnn = hba['node_name'].replace('0x', '')
wwnns.append(wwnn)
for hba in hbas:
if hba['port_state'] == 'Online':
wwnn = hba['node_name'].replace('0x', '')
wwnns.append(wwnn)
return wwnns
@ -194,8 +188,6 @@ class LinuxFibreChannelS390X(LinuxFibreChannel):
"""Get Fibre Channel WWNs and device paths from the system, if any."""
hbas = self.get_fc_hbas()
if not hbas:
return []
hbas_info = []
for hba in hbas: