[rhel7-branch 2/6] Don't raise an exception for failure to scan an ignored disk.

dwlehman installerbot-noreply at redhat.com
Fri May 29 17:35:11 UTC 2015


From: David Lehman <dlehman at redhat.com>

The disk will be ignored anyway, so it should not matter if there are
active devices on it since we won't be trying to write to it.

(cherry picked from commit f0ee1ccc5224cb5193c3034696f303e1ee190979)

Related: rhbz#1123450
---
 blivet/devicetree.py | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/blivet/devicetree.py b/blivet/devicetree.py
index 360155f..c08b1c3 100644
--- a/blivet/devicetree.py
+++ b/blivet/devicetree.py
@@ -940,8 +940,10 @@ def addUdevPartitionDevice(self, info, disk=None):
             #  - devices that do not have a usable disklabel
             #  - devices that contain disklabels made by isohybrid
             #
-            if (disk.partitionable and not
-                (disk.format.type == "iso9660" or disk.format.hidden)):
+            if disk.partitionable and \
+               disk.format.type != "iso9660" and \
+               not disk.format.hidden and \
+               not self._isIgnoredDisk(disk):
                 raise DeviceTreeError("failed to scan disk %s" % disk.name)
 
             # there's no need to filter partitions on members of multipaths or
@@ -2182,22 +2184,22 @@ def _populate(self):
         if flags.installer_mode:
             self.teardownAll()
 
-    def _hideIgnoredDisks(self):
-        def _is_ignored(disk):
-            return ((self.ignoredDisks and disk.name in self.ignoredDisks) or
-                    (self.exclusiveDisks and
-                     disk.name not in self.exclusiveDisks))
+    def _isIgnoredDisk(self, disk):
+        return ((self.ignoredDisks and disk.name in self.ignoredDisks) or
+                (self.exclusiveDisks and
+                 disk.name not in self.exclusiveDisks))
 
+    def _hideIgnoredDisks(self):
         # hide any subtrees that begin with an ignored disk
         for disk in [d for d in self._devices if d.isDisk]:
-            if _is_ignored(disk):
+            if self._isIgnoredDisk(disk):
                 ignored = True
                 # If the filter allows all members of a fwraid or mpath, the
                 # fwraid or mpath itself is implicitly allowed as well. I don't
                 # like this very much but we have supported this usage in the
                 # past, so I guess we will support it forever.
                 if disk.parents and all(p.format.hidden for p in disk.parents):
-                    ignored = any(_is_ignored(d) for d in disk.parents)
+                    ignored = any(self._isIgnoredDisk(d) for d in disk.parents)
 
                 if ignored:
                     self.hide(disk)


-- 
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/a337374807a8abd237d7c03b26db06f1a1a40890


More information about the anaconda-patches mailing list