def _add_advanced_clicked(self, button): from advanced_storage import addDrive if not addDrive(self.anaconda): return udev_trigger(subsystem="block", action="change") new_disks = filter(udev_device_is_disk, udev_get_block_devices()) (new_singlepaths, new_mpaths, new_partitions) = identifyMultipaths(new_disks) (new_raids, new_nonraids) = self.split_list( lambda d: isRAID(d) and not isCCISS(d), new_singlepaths) nonraids = filter(lambda d: d not in self._cachedDevices, new_nonraids) mpaths = filter(lambda d: d not in self._cachedMPaths, new_mpaths) raids = filter(lambda d: d not in self._cachedRaidDevices, new_raids) self.populate(nonraids, mpaths, raids, activeByDefault=True) # Make sure to update the size label at the bottom. self.pages[0].cb.update() self._cachedDevices.extend(nonraids) self._cachedMPaths.extend(mpaths) self._cachedRaidDevices.extend(raids)
def _add_advanced_clicked(self, button): from advanced_storage import addDrive if not addDrive(self.anaconda): return udev_trigger(subsystem="block") new_disks = filter(lambda d: udev_device_is_disk(d) and \ not udev_device_is_dm(d) and \ not udev_device_is_md(d) and \ not udev_device_get_md_container(d), udev_get_block_devices()) writeMultipathConf(friendly_names=True) if os.path.exists("/etc/multipath.conf"): (new_singlepaths, new_mpaths, new_partitions) = identifyMultipaths(new_disks) else: new_singlepaths = new_disks new_mpaths = [] (new_raids, new_nonraids) = self.split_list( lambda d: isRAID(d) and not isCCISS(d), new_singlepaths) # The end result of the loop below is that mpaths is a list of lists of # components, just like new_mpaths. That's what populate expects. mpaths = [] for mp in new_mpaths: for d in mp: # If any of the multipath components are in the nonraids cache, # remove them from the UI store. if d in self._cachedDevices: self.depopulate(d) # If all components of this multipath device are in the # cache, skip it. Otherwise, it's a new device and needs to # be populated into the UI. if d not in self._cachedMPaths: mpaths.append(mp) break nonraids = filter(lambda d: d not in self._cachedDevices, new_nonraids) raids = filter(lambda d: d not in self._cachedRaidDevices, new_raids) self.populate(nonraids, mpaths, raids, activeByDefault=True) # Make sure to update the size label at the bottom. self.pages[0].cb.update() self._cachedDevices.extend(nonraids) self._cachedRaidDevices.extend(raids) # And then we need to do the same list flattening trick here as in # getScreen. lst = list(itertools.chain(*mpaths)) self._cachedMPaths.extend(lst)
def _add_advanced_clicked(self, button): from advanced_storage import addDrive if not addDrive(self.anaconda): return udev_trigger(subsystem="block") new_disks = filter(lambda d: udev_device_is_disk(d) and \ not udev_device_is_dm(d) and \ not udev_device_is_md(d) and \ not udev_device_get_md_container(d), udev_get_block_devices()) writeMultipathConf(friendly_names=True) if os.path.exists("/etc/multipath.conf"): (new_singlepaths, new_mpaths, new_partitions) = identifyMultipaths(new_disks) else: new_singlepaths = new_disks new_mpaths = [] (new_raids, new_nonraids) = self.split_list(lambda d: isRAID(d) and not isCCISS(d), new_singlepaths) # The end result of the loop below is that mpaths is a list of lists of # components, just like new_mpaths. That's what populate expects. mpaths = [] for mp in new_mpaths: for d in mp: # If any of the multipath components are in the nonraids cache, # remove them from the UI store. if d in self._cachedDevices: self.depopulate(d) # If all components of this multipath device are in the # cache, skip it. Otherwise, it's a new device and needs to # be populated into the UI. if d not in self._cachedMPaths: mpaths.append(mp) break nonraids = filter(lambda d: d not in self._cachedDevices, new_nonraids) raids = filter(lambda d: d not in self._cachedRaidDevices, new_raids) self.populate(nonraids, mpaths, raids, activeByDefault=True) # Make sure to update the size label at the bottom. self.pages[0].cb.update() self._cachedDevices.extend(nonraids) self._cachedRaidDevices.extend(raids) # And then we need to do the same list flattening trick here as in # getScreen. lst = list(itertools.chain(*mpaths)) self._cachedMPaths.extend(lst)
def _add_advanced_clicked(self, button): from advanced_storage import addDrive if not addDrive(self.anaconda): return udev_trigger(subsystem="block", action="change") new_disks = self._getFilterDisks() mcw = MultipathConfigWriter() cfg = mcw.write() open("/etc/multipath.conf", "w+").write(cfg) del cfg del mcw (new_singlepaths, new_mpaths, new_partitions) = identifyMultipaths(new_disks) (new_raids, new_nonraids) = self.split_list( lambda d: isRAID(d) and not isCCISS(d), new_singlepaths) nonraids = filter(lambda d: d not in self._cachedDevices, new_nonraids) raids = filter(lambda d: d not in self._cachedRaidDevices, new_raids) # The end result of the loop below is that mpaths is a list of lists of # components, just like new_mpaths. That's what populate expects. mpaths = [] for mp in new_mpaths: for d in mp: # If all components of this multipath device are in the # cache, skip it. Otherwise, it's a new device and needs to # be populated into the UI. if d not in self._cachedMPaths: mpaths.append(mp) break self.populate(nonraids, mpaths, raids, activeByDefault=True) # Make sure to update the size label at the bottom. self.pages[0].cb.update() self._cachedDevices.extend(nonraids) self._cachedRaidDevices.extend(raids) # And then we need to do the same list flattening trick here as in # getScreen. lst = list(itertools.chain(*mpaths)) self._cachedMPaths.extend(lst)
def _add_advanced_clicked(self, button): from advanced_storage import addDrive if not addDrive(self.anaconda): return udev_trigger(subsystem="block", action="change") new_disks = self._getFilterDisks() mcw = MultipathConfigWriter() cfg = mcw.write() open("/etc/multipath.conf", "w+").write(cfg) del cfg del mcw topology = MultipathTopology(new_disks) (new_raids, new_nonraids) = self.split_list(lambda d: isRAID(d) and not isCCISS(d), topology.singlepaths_iter()) nonraids = filter(lambda d: d not in self._cachedDevices, new_nonraids) raids = filter(lambda d: d not in self._cachedRaidDevices, new_raids) # The end result of the loop below is that mpaths is a list of lists of # components. That's what populate expects. mpaths = [] for mp in topology.multipaths_iter(): for d in mp: # If all components of this multipath device are in the # cache, skip it. Otherwise, it's a new device and needs to # be populated into the UI. if d not in self._cachedMPaths: mpaths.append(mp) break self.populate(nonraids, mpaths, raids, activeByDefault=True) # Make sure to update the size label at the bottom. self.pages[0].cb.update() self._cachedDevices.extend(nonraids) self._cachedRaidDevices.extend(raids) # And then we need to do the same list flattening trick here as in # getScreen. lst = list(itertools.chain(*mpaths)) self._cachedMPaths.extend(lst)
def _add_advanced_clicked(self, button): from advanced_storage import addDrive if not addDrive(self.anaconda): return udev_trigger(subsystem="block", action="change") new_disks = filter(udev_device_is_disk, udev_get_block_devices()) (new_singlepaths, new_mpaths, new_partitions) = identifyMultipaths(new_disks) (new_raids, new_nonraids) = self.split_list(lambda d: isRAID(d) and not isCCISS(d), new_singlepaths) nonraids = filter(lambda d: d not in self._cachedDevices, new_nonraids) mpaths = filter(lambda d: d not in self._cachedMPaths, new_mpaths) raids = filter(lambda d: d not in self._cachedRaidDevices, new_raids) self.populate(nonraids, mpaths, raids, activeByDefault=True) # Make sure to update the size label at the bottom. self.pages[0].cb.update() self._cachedDevices.extend(nonraids) self._cachedMPaths.extend(mpaths) self._cachedRaidDevices.extend(raids)
def _add_advanced_clicked(self, button): from advanced_storage import addDrive if not addDrive(self.anaconda): return udev_trigger(subsystem="block") new_disks = filter(lambda d: udev_device_is_disk(d) and \ not udev_device_is_dm(d) and \ not udev_device_is_md(d) and \ not udev_device_get_md_container(d), udev_get_block_devices()) writeMultipathConf(friendly_names=True) if os.path.exists("/etc/multipath.conf"): (new_singlepaths, new_mpaths, new_partitions) = identifyMultipaths(new_disks) else: new_singlepaths = new_disks new_mpaths = [] (new_raids, new_nonraids) = self.split_list(lambda d: isRAID(d) and not isCCISS(d), new_singlepaths) # The end result of the loop below is that mpaths is a list of lists of # components, just like new_mpaths. That's what populate expects. mpaths = [] for mp in new_mpaths: old_mpaths = [] is_new_multipath = False for d in mp: # If any of the multipath components are in the nonraids cache, # remove them from the UI store. if d in self._cachedDevices: self.depopulate(d) # Check whether this device is part of an existing multipath, # but as part of a different set of members if d in self._cachedMPathMembers and hasattr(self._cachedMPaths, d["name"]): if self._cachedMPaths[d["name"]] != mp: old_mpaths.append(mp) is_new_multipath = True # Check whether this is a new device if d not in self._cachedMPathMembers: is_new_multipath = True for omp in old_mpaths: # Clean up the caches for d in omp: del self._cachedMPathMembers[self._cachedMPathMembers.index(d)] del self._cachedMPaths[d["name"]] self.depopulate(d) if is_new_multipath: mpaths.append(mp) # Add the multipath to the cache for d in mp: self._cachedMPaths[d["name"]] = mp nonraids = filter(lambda d: d not in self._cachedDevices, new_nonraids) raids = filter(lambda d: d not in self._cachedRaidDevices, new_raids) self.populate(nonraids, mpaths, raids, activeByDefault=True) # Make sure to update the size label at the bottom. self.pages[0].cb.update() self._cachedDevices.extend(nonraids) self._cachedRaidDevices.extend(raids) # And then we need to do the same list flattening trick here as in # getScreen. lst = list(itertools.chain(*mpaths)) self._cachedMPathMembers.extend(lst)
def _add_advanced_clicked(self, button): from advanced_storage import addDrive if not addDrive(self.anaconda): return udev_trigger(subsystem="block") new_disks = filter(lambda d: udev_device_is_disk(d) and \ not udev_device_is_dm(d) and \ not udev_device_is_md(d) and \ not udev_device_get_md_container(d), udev_get_block_devices()) writeMultipathConf(friendly_names=True) if os.path.exists("/etc/multipath.conf"): (new_singlepaths, new_mpaths, new_partitions) = identifyMultipaths(new_disks) else: new_singlepaths = new_disks new_mpaths = [] (new_raids, new_nonraids) = self.split_list( lambda d: isRAID(d) and not isCCISS(d), new_singlepaths) # The end result of the loop below is that mpaths is a list of lists of # components, just like new_mpaths. That's what populate expects. mpaths = [] for mp in new_mpaths: old_mpaths = [] is_new_multipath = False for d in mp: # If any of the multipath components are in the nonraids cache, # remove them from the UI store. if d in self._cachedDevices: self.depopulate(d) # Check whether this device is part of an existing multipath, # but as part of a different set of members if d in self._cachedMPathMembers and hasattr( self._cachedMPaths, d["name"]): if self._cachedMPaths[d["name"]] != mp: old_mpaths.append(mp) is_new_multipath = True # Check whether this is a new device if d not in self._cachedMPathMembers: is_new_multipath = True for omp in old_mpaths: # Clean up the caches for d in omp: del self._cachedMPathMembers[ self._cachedMPathMembers.index(d)] del self._cachedMPaths[d["name"]] self.depopulate(d) if is_new_multipath: mpaths.append(mp) # Add the multipath to the cache for d in mp: self._cachedMPaths[d["name"]] = mp nonraids = filter(lambda d: d not in self._cachedDevices, new_nonraids) raids = filter(lambda d: d not in self._cachedRaidDevices, new_raids) self.populate(nonraids, mpaths, raids, activeByDefault=True) # Make sure to update the size label at the bottom. self.pages[0].cb.update() self._cachedDevices.extend(nonraids) self._cachedRaidDevices.extend(raids) # And then we need to do the same list flattening trick here as in # getScreen. lst = list(itertools.chain(*mpaths)) self._cachedMPathMembers.extend(lst)