diff options
author | Karsten Hopp <karsten@redhat.de> | 2004-08-23 15:43:55 +0000 |
---|---|---|
committer | Karsten Hopp <karsten@redhat.de> | 2004-08-23 15:43:55 +0000 |
commit | 00b96265652164d87166666f44155f03b3aecee2 (patch) | |
tree | 1aa1a7543f915119ecaae45257d9db4d6d09d116 /zfcp.py | |
parent | a4173d8c3eeda3cdecb7f8cd7e54d873d450f07a (diff) | |
download | anaconda-00b96265652164d87166666f44155f03b3aecee2.tar.gz anaconda-00b96265652164d87166666f44155f03b3aecee2.tar.xz anaconda-00b96265652164d87166666f44155f03b3aecee2.zip |
- add or remove scsi_hostadapter alias from modprobe.conf, if any fcp devices are configured/not configured. Untested, but at least survives pycheck.
Diffstat (limited to 'zfcp.py')
-rw-r--r-- | zfcp.py | 37 |
1 files changed, 32 insertions, 5 deletions
@@ -92,6 +92,38 @@ class ZFCP: except: continue + def writeModprobeConf(self, fcpdevices): + lines = [] + try: + f = open("/tmp/modprobe.conf", "r") + lines = f.readlines() + f.close() + except: + pass + foundalias = 0 + for line in lines: + if line == "alias scsi_hostadapter zfcp": + foundalias = 1 + break + if len(fcpdevices): + if not foundalias: + try: + f = open("/tmp/modprobe.conf", "a") + f.write("alias scsi_hostadapter zfcp") + f.close() + except: + pass + if not len(fcpdevices): + if foundalias: + try: + f = open("/tmp/modprobe.conf", "w") + for line in lines: + if line != "alias scsi_hostadapter zfcp": + f.write(line) + f.close() + except: + pass + def write(self, instPath): if not len(self.fcpdevices): return @@ -104,10 +136,6 @@ class ZFCP: for dev in self.fcpdevices: f.write("%s %s %s %s %s\n" % (dev[0], dev[1], dev[2], dev[3], dev[4],)) f.close() - fn = "%s/etc/modprobe.conf" % (instpath,) - f = open(fn, "a") - f.write("alias scsi_hostadapter zfcp") - f.close() def writeKS(self,fcpdevices): # FIXME KH not implemented yet @@ -146,7 +174,6 @@ class ZFCP: if lun[:2] == "0x": lun = lun[2:] lun = "0x" + "0" * (4 - len(lun)) + lun - length = len(lun) - 2 lun = lun + "0" * (16 - len(lun) + 2) return lun |