FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.

» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

LinkBack Thread Tools
Old 07-12-2010, 02:01 PM
Chris Lumens
Default Don't crash when putting mpath devices into the filter name cache (#597223).

The big problem here is that identifyMultipaths returns a list of lists of
components, whereas the name cache stuff expects just a regular list.
Therefore, I need to first flatten the component structure when creating
the cache and also check every component of an mpath device to see if it's
in the cache before deciding a device is new or not.
iw/filter_gui.py | 27 +++++++++++++++++++++++++--
1 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/iw/filter_gui.py b/iw/filter_gui.py
index 4552491..50346c9 100644
--- a/iw/filter_gui.py
+++ b/iw/filter_gui.py
@@ -23,6 +23,7 @@ import collections
import gtk, gobject
import gtk.glade
import gui
+import itertools
import iutil
import parted
import _ped
@@ -445,9 +446,20 @@ class FilterWindow(InstallWindow):

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)

+ # 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.
@@ -457,6 +469,11 @@ class FilterWindow(InstallWindow):

+ # 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 _makeBasic(self):
np = NotebookPage(self.store, "basic", self.xml, Callbacks(self.xml))

@@ -610,9 +627,15 @@ class FilterWindow(InstallWindow):
# can just add the new devices to the UI. This is going to be slow,
# but the user has to click a button to get to the slow part.
self._cachedDevices = NameCache(singlepaths)
- self._cachedMPaths = NameCache(mpaths)
self._cachedRaidDevices = NameCache(raids)

+ # Multipath is a little more complicated. Since mpaths is a list of
+ # lists, we can't directly store that into the cache. Instead we want
+ # to flatten it into a single list of all components of all multipaths
+ # and store that.
+ lst = list(itertools.chain(*mpaths))
+ self._cachedMPaths = NameCache(lst)
# Switch to the first notebook page that displays any devices.
i = 0
for pg in self.pages:

Anaconda-devel-list mailing list

Thread Tools

All times are GMT. The time now is 04:54 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org