Skip to content

Commit

Permalink
blivet/zfcp: remove no longer used read_config functionality (#180248…
Browse files Browse the repository at this point in the history
…2,#1937049)

Implements the zfcp part, but not any other required parts, of referenced bugs.

Since anaconda commit 87ab1ab2a3aa ("Support cio_ignore functionality for
zFCP devices (#533492)"), /etc/zfcp.conf replaced /tmp/fcpconfig.

Since anaconda commit 011ea0a17794 ("Remove linuxrc.s390"), /etc/zfcp.conf
only exists if the user specified dracut cmdline parameter rd.zfcp=.

https://github.com/ibm-s390-linux/s390-tools/tree/master/zdev/
handles parsing of rd.zfcp= without /etc/zfcp.conf as of commit
("zdev/dracut: prepare to remove dracut module 95zfcp and 95zfcp_rules").

https://src.fedoraproject.org/rpms/s390utils.git
no longer writes /etc/zfcp.conf during deprecated parsing of rd.zfcp=
as of commit
("zfcp: migrate to consolidated persistent device config with zdev")

Hence, nothing populates /etc/zfcp.conf during installer boot anymore.

Anaconda imports configuration for all s390 device types as of
commit ("write persistent config of any (dasd,zfcp,znet) s390 devices to
sysroot"). The only remaining import source is from dracut boot parameters.

Signed-off-by: Steffen Maier <[email protected]>
  • Loading branch information
steffen-maier committed Oct 13, 2023
1 parent f89787d commit 2bf4c37
Showing 1 changed file with 9 additions and 51 deletions.
60 changes: 9 additions & 51 deletions blivet/zfcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ def logged_write_line_to_file(fn, value):

zfcpsysfs = "/sys/bus/ccw/drivers/zfcp"
scsidevsysfs = "/sys/bus/scsi/devices"
zfcpconf = "/etc/zfcp.conf"


def _is_lun_scan_allowed():
Expand Down Expand Up @@ -328,18 +327,22 @@ class zFCP:

""" ZFCP utility class.
This class will automatically online to ZFCP drives configured in
/tmp/fcpconfig when the startup() method gets called. It can also be
used to manually configure ZFCP devices through the add_fcp() method.
This class is used to manually configure ZFCP devices through the
add_fcp() method, which is used by the anaconda GUI or by kickstart.
As this class needs to make sure that /tmp/fcpconfig configured
As this class needs to make sure that configured
drives are only onlined once and as it keeps a global list of all ZFCP
devices it is implemented as a Singleton.
In particular, this class does not create objects for any other method
that enables ZFCP devices such as rd.zfcp= or any device auto
configuration. These methods make zfcp-attached SCSI disk block devices
available, which ZFCPDiskDevice [devices/disk.py] can directly
discover.
"""

def __init__(self):
self.fcpdevs = set()
self.has_read_config = False
self.down = True

# So that users can write zfcp() to get the singleton instance
Expand All @@ -350,46 +353,6 @@ def __deepcopy__(self, memo_dict):
# pylint: disable=unused-argument
return self

def read_config(self):
try:
f = open(zfcpconf, "r")
except OSError:
log.info("no %s; not configuring zfcp", zfcpconf)
return

lines = [x.strip().lower() for x in f.readlines()]
f.close()

for line in lines:
if line.startswith("#") or line == '':
continue

fields = line.split()

# zFCP auto LUN scan available
if len(fields) == 1:
devnum = fields[0]
wwpn = None
fcplun = None
elif len(fields) == 3:
devnum = fields[0]
wwpn = fields[1]
fcplun = fields[2]
elif len(fields) == 5:
# support old syntax of:
# devno scsiid wwpn scsilun fcplun
devnum = fields[0]
wwpn = fields[2]
fcplun = fields[4]
else:
log.warning("Invalid line found in %s: %s", zfcpconf, line)
continue

try:
self.add_fcp(devnum, wwpn, fcplun)
except ValueError as e:
log.warning("%s", str(e))

def add_fcp(self, devnum, wwpn=None, fcplun=None):
if wwpn and fcplun:
d = ZFCPDeviceFullPath(devnum, wwpn, fcplun)
Expand All @@ -415,11 +378,6 @@ def startup(self):
if not self.down:
return
self.down = False
if not self.has_read_config:
self.read_config()
self.has_read_config = True
# read_config calls add_fcp which calls online_device already
return

if len(self.fcpdevs) == 0:
return
Expand Down

0 comments on commit 2bf4c37

Please sign in to comment.