Revamp this since multipath is now writing our rules for us. Use device.serial/device.vendor/device.model where appropriate, and don't give the device a braindead mode. Also change /when/ we write the files out. --- storage/__init__.py | 11 + storage/devicelibs/mpath.py | 517 +++---------------------------------------- storage/devices.py | 11 +- storage/devicetree.py | 27 ++- 4 files changed, 66 insertions(+), 500 deletions(-) diff --git a/storage/__init__.py b/storage/__init__.py index 3b3f6d6..ef3d9d8 100644 --- a/storage/__init__.py +++ b/storage/__init__.py @@ -2033,6 +2033,7 @@ class FSSet(object): if mdadm_conf: open(mdadm_path, "w").write(mdadm_conf) + # /etc/multipath.conf multipath_path = os.path.normpath("%s/etc/multipath.conf" % instPath) multipath_conf = self.multipathConf() if multipath_conf: @@ -2099,8 +2100,18 @@ class FSSet(object): return None mpaths.sort(key=lambda d: d.name) config = MultipathConfigWriter() + whitelist = [] for mpath in mpaths: config.addMultipathDevice(mpath) + whitelist.append(mpath.name) + whitelist.extend([d.name for d in mpath.parents]) + + # blacklist everything we're not using and let the + # sysadmin sort it out. + for d in self.devicetree.devices: + if not d.name in whitelist: + config.addBlacklistDevice(d) + return config.write() def fstab (self): diff --git a/storage/devicelibs/mpath.py b/storage/devicelibs/mpath.py index 67c60f0..733437d 100644 --- a/storage/devicelibs/mpath.py +++ b/storage/devicelibs/mpath.py @@ -82,24 +82,26 @@ def identifyMultipaths(devices): class MultipathConfigWriter: def __init__(self): - self.blacklist_exceptions = [] + self.blacklist_devices = [] self.mpaths = [] + def addBlacklistDevice(self, device): + self.blacklist_devices.append(device) + def addMultipathDevice(self, mpath): - for parent in mpath.parents: - self.blacklist_exceptions.append(parent.name) self.mpaths.append(mpath) def write(self): - ret = "" + # if you add anything here, be sure and also add it to anaconda's + # multipath.conf + ret = '' ret += """\ # multipath.conf written by anaconda defaults { - verbosity 2 + user_friendly_names yes } blacklist { - devnode "*" devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*" devnode "^hd[a-z]" devnode "^dcssblk[0-9]*" @@ -111,498 +113,37 @@ blacklist { vendor "IBM" product "S/390.*" } + # don't count normal SATA devices as multipaths device { - vendor "IBM" - product "S/390.*" - } -} -devices { - device { - vendor "COMPELNT" - product "Compellent Vol" - path_grouping_policy multibus - path_checker tur - checker tur - failback immediate - no_path_retry queue - } - device { - vendor "APPLE*" - product "Xserve RAID " - path_grouping_policy multibus - } - device { - vendor "3PARdata" - product "VV" - path_grouping_policy multibus - } - device { - vendor "DEC" - product "HSG80" - path_grouping_policy group_by_prio - path_checker hp_sw - checker hp_sw - features "1 queue_if_no_path" - hardware_handler "1 hp-sw" - prio hp_sw - } - device { - vendor "HP" - product "A6189A" - path_grouping_policy multibus - no_path_retry 12 - } - device { - vendor "(COMPAQ|HP)" - product "(MSA|HSV)1.0.*" - path_grouping_policy group_by_prio - path_checker hp_sw - checker hp_sw - features "1 queue_if_no_path" - hardware_handler "1 hp-sw" - prio hp_sw - no_path_retry 12 - rr_min_io 100 + vendor "ATA" } + # don't count 3ware devices as multipaths device { - vendor "HP" - product "MSA VOLUME" - path_grouping_policy group_by_prio - path_checker tur - checker tur - prio alua - failback immediate - no_path_retry 12 - rr_min_io 100 + vendor "3ware" } device { - vendor "(COMPAQ|HP)" - product "HSV1[01]1|HSV2[01]0|HSV300|HSV4[05]0" - path_grouping_policy group_by_prio - path_checker tur - checker tur - prio alua - failback immediate - no_path_retry 12 - rr_min_io 100 + vendor "AMCC" } + # nor highpoint devices device { - vendor "HP" - product "MSA2[02]12fc|MSA2012i" - path_grouping_policy multibus - path_checker tur - checker tur - failback immediate - no_path_retry 18 - rr_min_io 100 + vendor "HPT" } - device { - vendor "HP" - product "MSA2012sa|MSA23(12|24)(fc|i|sa)|MSA2000s VOLUME" - path_grouping_policy group_by_prio - path_checker tur - checker tur - prio alua - failback immediate - no_path_retry 18 - rr_min_io 100 - } - device { - vendor "HP" - product "HSVX700" - path_grouping_policy group_by_prio - path_checker tur - checker tur - hardware_handler "1 alua" - prio alua - failback immediate - no_path_retry 12 - rr_min_io 100 - } - device { - vendor "HP" - product "LOGICAL VOLUME.*" - path_grouping_policy multibus - path_checker cciss_tur - checker cciss_tur - no_path_retry 12 - } - device { - vendor "DDN" - product "SAN DataDirector" - path_grouping_policy multibus - } - device { - vendor "EMC" - product "SYMMETRIX" - path_grouping_policy multibus - getuid_callout "/lib/udev/scsi_id --page=pre-spc3-83 --whitelisted --device=/dev/%n" - } - device { - vendor "DGC" - product ".*" - product_blacklist "LUNZ" - path_grouping_policy group_by_prio - path_checker emc_clariion - checker emc_clariion - features "1 queue_if_no_path" - hardware_handler "1 emc" - prio emc - failback immediate - no_path_retry 60 - } - device { - vendor "FSC" - product "CentricStor" - path_grouping_policy group_by_serial - } - device { - vendor "(HITACHI|HP)" - product "OPEN-.*" - path_grouping_policy multibus - path_checker tur - checker tur - } - device { - vendor "HITACHI" - product "DF.*" - path_grouping_policy group_by_prio - path_checker tur - checker tur - features "1 queue_if_no_path" - prio hds - failback immediate - } - device { - vendor "IBM" - product "ProFibre 4000R" - path_grouping_policy multibus - } - device { - vendor "IBM" - product "1722-600" - path_grouping_policy group_by_prio - path_checker rdac - checker rdac - features "1 queue_if_no_path" - hardware_handler "1 rdac" - prio rdac - failback immediate - no_path_retry 300 - } - device { - vendor "IBM" - product "1724" - path_grouping_policy group_by_prio - path_checker rdac - checker rdac - features "1 queue_if_no_path" - hardware_handler "1 rdac" - prio rdac - failback immediate - no_path_retry 300 - } - device { - vendor "IBM" - product "1726" - path_grouping_policy group_by_prio - path_checker rdac - checker rdac - features "1 queue_if_no_path" - hardware_handler "1 rdac" - prio rdac - failback immediate - no_path_retry 300 - } - device { - vendor "IBM" - product "1742" - path_grouping_policy group_by_prio - path_checker rdac - checker rdac - hardware_handler "1 rdac" - prio rdac - failback immediate - no_path_retry queue - } - device { - vendor "IBM" - product "1814" - path_grouping_policy group_by_prio - path_checker rdac - checker rdac - hardware_handler "1 rdac" - prio rdac - failback immediate - no_path_retry queue - } - device { - vendor "IBM" - product "1815" - path_grouping_policy group_by_prio - path_checker rdac - checker rdac - hardware_handler "1 rdac" - prio rdac - failback immediate - no_path_retry queue - } - device { - vendor "IBM" - product "1818" - path_grouping_policy group_by_prio - path_checker rdac - checker rdac - hardware_handler "1 rdac" - prio rdac - failback immediate - no_path_retry queue - } - device { - vendor "IBM" - product "3526" - path_grouping_policy group_by_prio - path_checker rdac - checker rdac - hardware_handler "1 rdac" - prio rdac - failback immediate - no_path_retry queue - } - device { - vendor "IBM" - product "3542" - path_grouping_policy group_by_serial - path_checker tur - checker tur - } - device { - vendor "IBM" - product "2105800" - path_grouping_policy group_by_serial - path_checker tur - checker tur - features "1 queue_if_no_path" - } - device { - vendor "IBM" - product "2105F20" - path_grouping_policy group_by_serial - path_checker tur - checker tur - features "1 queue_if_no_path" - } - device { - vendor "IBM" - product "1750500" - path_grouping_policy group_by_prio - path_checker tur - checker tur - features "1 queue_if_no_path" - prio alua - failback immediate - } - device { - vendor "IBM" - product "2107900" - path_grouping_policy multibus - path_checker tur - checker tur - features "1 queue_if_no_path" - } - device { - vendor "IBM" - product "2145" - path_grouping_policy group_by_prio - path_checker tur - checker tur - features "1 queue_if_no_path" - prio alua - failback immediate - } - device { - vendor "IBM" - product "S/390 DASD ECKD" - product_blacklist "S/390.*" - path_grouping_policy multibus - getuid_callout "/sbin/dasd_id /dev/%n" - features "1 queue_if_no_path" - } - device { - vendor "IBM" - product "S/390 DASD FBA" - product_blacklist "S/390.*" - path_grouping_policy multibus - getuid_callout "/sbin/dasdinfo -u -b %n" - features "1 queue_if_no_path" - } - device { - vendor "IBM" - product "IPR.*" - path_grouping_policy group_by_prio - path_checker tur - checker tur - features "1 queue_if_no_path" - hardware_handler "1 alua" - prio alua - failback immediate - } - device { - vendor "AIX" - product "VDASD" - path_grouping_policy multibus - failback immediate - no_path_retry 60 - } - device { - vendor "DELL" - product "MD3000" - path_grouping_policy group_by_prio - path_checker rdac - checker rdac - features "1 queue_if_no_path" - hardware_handler "1 rdac" - prio rdac - failback immediate - } - device { - vendor "DELL" - product "MD3000i" - path_grouping_policy group_by_prio - path_checker rdac - checker rdac - features "1 queue_if_no_path" - hardware_handler "1 rdac" - prio rdac - failback immediate - } - device { - vendor "NETAPP" - product "LUN.*" - path_grouping_policy group_by_prio - features "1 queue_if_no_path" - prio netapp - failback immediate - rr_min_io 128 - } - device { - vendor "IBM" - product "Nseries.*" - path_grouping_policy group_by_prio - features "1 queue_if_no_path" - prio netapp - failback immediate - rr_min_io 128 - } - device { - vendor "Pillar" - product "Axiom.*" - path_grouping_policy group_by_prio - path_checker tur - checker tur - prio alua - } - device { - vendor "SGI" - product "TP9[13]00" - path_grouping_policy multibus - } - device { - vendor "SGI" - product "TP9[45]00" - path_grouping_policy group_by_prio - path_checker rdac - checker rdac - hardware_handler "1 rdac" - prio rdac - failback immediate - no_path_retry queue - } - device { - vendor "SGI" - product "IS.*" - path_grouping_policy group_by_prio - path_checker rdac - checker rdac - hardware_handler "1 rdac" - prio rdac - failback immediate - no_path_retry queue - } - device { - vendor "STK" - product "OPENstorage D280" - path_grouping_policy group_by_prio - path_checker tur - checker tur - hardware_handler "1 rdac" - prio rdac - failback immediate - } - device { - vendor "SUN" - product "(StorEdge 3510|T4)" - path_grouping_policy multibus - } - device { - vendor "PIVOT3" - product "RAIGE VOLUME" - path_grouping_policy multibus - getuid_callout "/lib/udev/scsi_id --page=0x80 --whitelisted --device=/dev/%n" - path_checker tur - checker tur - features "1 queue_if_no_path" - rr_min_io 100 - } - device { - vendor "SUN" - product "CSM200_R" - path_grouping_policy group_by_prio - path_checker rdac - checker rdac - hardware_handler "1 rdac" - prio rdac - failback immediate - no_path_retry queue - } - device { - vendor "SUN" - product "LCSM100_[IF]" - path_grouping_policy group_by_prio - path_checker rdac - checker rdac - hardware_handler "1 rdac" - prio rdac - failback immediate - no_path_retry queue - } - device { - vendor "(LSI|ENGENIO)" - product "INF-01-00" - path_grouping_policy group_by_prio - path_checker rdac - checker rdac - features "2 pg_init_retries 50" - hardware_handler "1 rdac" - prio rdac - failback immediate - no_path_retry 15 - } -} -blacklist_exceptions { -""" - for device in self.blacklist_exceptions: - ret += "\tdevnode \"^%s$\"\n" % (device,) - ret += """\ -} - -multipaths { """ + for device in self.blacklist_devices: + if device.serial: + ret += '\twwid %s\n' % device.serial + elif device.vendor and device.model: + ret += '\tdevice {\n' + ret += '\t\tvendor %s\n' % device.vendor + ret += '\t\tproduct %s\n' % device.model + ret += '\t}\n' + ret += '}\n' + ret += 'multipaths {\n' for mpath in self.mpaths: - ret += "\tmultipath {\n" + ret += '\tmultipath {\n' for k,v in mpath.config.items(): - ret += "\t\t%s %s\n" % (k, v) - ret += "\t}\n\n" - ret += "}\n" + ret += '\t\t%s %s\n' % (k, v) + ret += '\t}\n' + ret += '}\n' return ret diff --git a/storage/devices.py b/storage/devices.py index e350053..d5081b4 100644 --- a/storage/devices.py +++ b/storage/devices.py @@ -2936,19 +2936,12 @@ class MultipathDevice(DMDevice): self.setupIdentity() DMDevice.__init__(self, name, format=format, size=size, parents=parents, sysfsPath=sysfsPath) + self.setupIdentity() - # PJTODO: these need better setup self.config = { 'wwid' : self.identity, 'alias' : self.name, - #'path_grouping_policy' : 'failover', - #'path_selector' : '\"round-robin 0\"', - #'failback' : 'manual', - #'rr_weight' : 'priorities', - #'no_path_retry' : 'queue', - #'rr_min_io' : '100', - #'flush_on_last_del' : 'yes', - 'mode' : '0644', + 'mode' : '0600', 'uid' : '0', 'gid' : '0', } diff --git a/storage/devicetree.py b/storage/devicetree.py index 82f6686..d3c4501 100644 --- a/storage/devicetree.py +++ b/storage/devicetree.py @@ -34,6 +34,7 @@ import formats import devicelibs.mdraid import devicelibs.dm import devicelibs.lvm +import devicelibs.mpath from udev import * from .storage_log import log_method_call @@ -172,9 +173,11 @@ class DeviceTree(object): # names of protected devices at the time of tree population self.protectedDevNames = [] + self.__multipaths = {} + self.__multipathConfigWriter = devicelibs.mpath.MultipathConfigWriter() + self.__passphrase = passphrase self.__luksDevs = {} - self.__multipaths = {} if luksDict and isinstance(luksDict, dict): self.__luksDevs = luksDict self._ignoredDisks = [] @@ -1601,7 +1604,7 @@ class DeviceTree(object): else: name = generateMultipathDeviceName() mp = MultipathDevice(name, info, parents=[device]) - self.__multipaths[serial] = mp + self.__multipaths[name] = mp def handleUdevDMRaidMemberFormat(self, info, device): log_method_call(self, name=device.name, type=device.format.type) @@ -1904,6 +1907,10 @@ class DeviceTree(object): for dev in devices: old_devices[dev['name']] = dev + cfg = self.__multipathConfigWriter.write() + open("/etc/multipath.conf", "w+").write(cfg) + del cfg + (singles, mpaths, partitions) = devicelibs.mpath.identifyMultipaths(devices) devices = singles + reduce(list.__add__, mpaths, []) + partitions log.info("devices to scan: %s" % [d['name'] for d in devices]) @@ -1912,10 +1919,24 @@ class DeviceTree(object): # Having found all the disks, we can now find all the multipaths built # upon them. - for mp in self.__multipaths.values(): + whitelist = [] + mpaths = self.__multipaths.values() + mpaths.sort(key=lambda d: d.name) + for mp in mpaths: log.info("adding mpath device %s" % mp.name) mp.create() + whitelist.append(mp.name) + for p in mp.parents: + self.addIgnoredDisk(p) + whitelist.append(p.name) + self.__multipathConfigWriter.addMultipathDevice(mp) self._addDevice(mp) + for d in self.devices: + if not d.name in whitelist: + self.__multipathConfigWriter.addBlacklistDevice(d) + cfg = self.__multipathConfigWriter.write() + open("/etc/multipath.conf", "w+").write(cfg) + del cfg # Now, loop and scan for devices that have appeared since the two above # blocks or since previous iterations. -- 1.6.5.2 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list