Honor FCP_* lines passed at boot time as well as runtime additions of zFCP devices by the user. Call zfcp_cio_free to free the device from the cio_ignore facility and then set the remaining values necessary for the device as we used to do. Record all devices freed during installation in the /etc/zfcp.conf file and make sure that file is copied to the target system during installation. --- loader/linuxrc.s390 | 4 +- storage/zfcp.py | 67 +++++++++++++++++++-------------------------------- 2 files changed, 27 insertions(+), 44 deletions(-) diff --git a/loader/linuxrc.s390 b/loader/linuxrc.s390 index 814dd32..99e5192 100644 --- a/loader/linuxrc.s390 +++ b/loader/linuxrc.s390 @@ -2962,9 +2962,9 @@ fi # testing syntax_check_fcp # currently we ignore failed syntax checks since FCP parms are non-interactive for i in ${!FCP_*}; do - echo "${!i}" >> /tmp/fcpconfig + echo "${!i}" >> /etc/zfcp.conf done -# cio_ignore handling for FCP should happen when the content of /tmp/fcpconfig +# cio_ignore handling for FCP should happen when the content of /etc/zfcp.conf # will actually be processed which is in anaconda's zfcp.py ZFCP::readConfig() # TODO/FIXME: also need to pass IPv6 decision to loader/anaconda diff --git a/storage/zfcp.py b/storage/zfcp.py index 7692cad..3c315e8 100644 --- a/storage/zfcp.py +++ b/storage/zfcp.py @@ -27,9 +27,9 @@ from udev import udev_settle import gettext _ = lambda x: gettext.ldgettext("anaconda", x) +import iutil import logging log = logging.getLogger("anaconda") -import warnings def loggedWriteLineToFile(fn, value): f = open(fn, "w") @@ -39,6 +39,7 @@ def loggedWriteLineToFile(fn, value): zfcpsysfs = "/sys/bus/ccw/drivers/zfcp" scsidevsysfs = "/sys/bus/scsi/devices" +zfcpconf = "/etc/zfcp.conf" class ZFCPDevice: def __init__(self, devnum, wwpn, fcplun): @@ -122,15 +123,10 @@ class ZFCPDevice: unitdir = "%s/%s" %(portdir, self.fcplun) failed = "%s/failed" %(unitdir) - try: - if not os.path.exists(online): - loggedWriteLineToFile("/proc/cio_ignore", - "free %s" %(self.devnum,)) - udev_settle() - except IOError as e: - raise ValueError, _("Could not free zFCP device %(devnum)s from " - "device ignore list (%(e)s).") \ - % {'devnum': self.devnum, 'e': e} + if not os.path.exists(online): + log.info("Freeing zFCP device %s" % (self.devnum,)) + iutil.execWithRedirect("zfcp_cio_free", ["-d", self.devnum], + stdout="/dev/tty5", stderr="/dev/tty5") if not os.path.exists(online): raise ValueError, _( @@ -143,8 +139,6 @@ class ZFCPDevice: f.close() if devonline != "1": loggedWriteLineToFile(online, "1") - else: - log.info("zFCP device %s already online." %(self.devnum,)) except IOError as e: raise ValueError, _("Could not set zFCP device %(devnum)s " "online (%(e)s).") \ @@ -335,7 +329,7 @@ class ZFCP: """ def __init__(self): - self.fcpdevs = [] + self.fcpdevs = set() self.hasReadConfig = False self.down = True @@ -345,45 +339,34 @@ class ZFCP: def readConfig(self): try: - f = open("/tmp/fcpconfig", "r") + f = open(zfcpconf, "r") except IOError: - log.info("no /tmp/fcpconfig; not configuring zfcp") + log.info("no %s; not configuring zfcp" % (zfcpconf,)) return - lines = f.readlines() + lines = map(lambda x: x.strip().lower(), f.readlines()) f.close() + for line in lines: - # each line is a string separated list of values to describe a dev - # there are two valid formats for the line: - # devnum scsiid wwpn scsilun fcplun (scsiid + scsilun ignored) - # devnum wwpn fcplun - line = string.strip(line).lower() - if line.startswith("#"): - continue - fcpconf = string.split(line) - if len(fcpconf) == 3: - devnum = fcpconf[0] - wwpn = fcpconf[1] - fcplun = fcpconf[2] - elif len(fcpconf) == 5: - warnings.warn("SCSI ID and SCSI LUN values for ZFCP devices are ignored and deprecated.", DeprecationWarning) - devnum = fcpconf[0] - wwpn = fcpconf[2] - fcplun = fcpconf[4] - else: - log.warn("Invalid line found in /tmp/fcpconfig!") + if line.startswith("#") or line == '': continue - try: - self.addFCP(devnum, wwpn, fcplun) - except ValueError, e: - log.warn(str(e)) + fields = line.split() + + if len(fields) == 3: + self.addFCP(fields[0], fields[1], fields[2]) + elif len(fields) == 5: + # support old syntax of: + # devno scsiid wwpn scsilun fcplun + self.addFCP(fields[0], fields[2], fields[4]) + else: + log.warn("Invalid line found in %s: %s" % (zfcpconf, line,)) continue def addFCP(self, devnum, wwpn, fcplun): d = ZFCPDevice(devnum, wwpn, fcplun) if d.onlineDevice(): - self.fcpdevs.append(d) + self.fcpdevs.add(d) def shutdown(self): if self.down: @@ -406,7 +389,7 @@ class ZFCP: self.hasReadConfig = True # readConfig calls addFCP which calls onlineDevice already return - + if len(self.fcpdevs) == 0: return for d in self.fcpdevs: @@ -426,7 +409,7 @@ class ZFCP: def write(self, instPath): if len(self.fcpdevs) == 0: return - f = open(instPath + "/etc/zfcp.conf", "w") + f = open(instPath + zfcpconf, "w") for d in self.fcpdevs: f.write("%s\n" %(d,)) f.close() -- 1.7.0.1 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list