[PATCH] Warn when ignoring BIOS RAID members (#560932)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch adds a warning when ignoring BIOS RAID members because no complete
set using them could be found.

This patch also introduces a much needed InstallInterfaceBase class, as I
didn't feel like adding the exact same code to all of cmdline.py, gui.py and
text.py .

Note that the ignoring of BIOS RAID members is checked in 2 places, as
the filter UI can be skipped under certain circumstances (kickstart). The
interface code checks for disks it has already warned about.
---
 cmdline.py              |    4 +++-
 gui.py                  |    4 +++-
 installinterfacebase.py |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 iw/filter_gui.py        |    9 +++++++++
 storage/devicetree.py   |   13 ++++++++++++-
 text.py                 |    4 +++-
 6 files changed, 77 insertions(+), 4 deletions(-)
 create mode 100644 installinterfacebase.py

diff --git a/cmdline.py b/cmdline.py
index 86816be..a3fbf23 100644
--- a/cmdline.py
+++ b/cmdline.py
@@ -26,6 +26,7 @@ import parted
 from constants import *
 from flags import flags
 from iutil import strip_markup
+from installinterfacebase import InstallInterfaceBase
 
 import gettext
 _ = lambda x: gettext.ldgettext("anaconda", x)
@@ -62,8 +63,9 @@ class ProgressWindow:
         print(text)
         print(_("In progress"))
 
-class InstallInterface:
+class InstallInterface(InstallInterfaceBase):
     def __init__(self):
+        InstallInterfaceBase.__init__(self)
 #        signal.signal(signal.SIGINT, signal.SIG_IGN)
         signal.signal(signal.SIGTSTP, signal.SIG_DFL)
         self.instProgress = None
diff --git a/gui.py b/gui.py
index a7f2d3d..6673888 100755
--- a/gui.py
+++ b/gui.py
@@ -42,6 +42,7 @@ from language import expandLangs
 from constants import *
 from product import *
 from network import hasActiveNetDev
+from installinterfacebase import InstallInterfaceBase
 import xutils
 import imputil
 
@@ -974,8 +975,9 @@ class EntryWindow(MessageWindow):
     def destroy(self):
         self.dialog.destroy()
 
-class InstallInterface:
+class InstallInterface(InstallInterfaceBase):
     def __init__ (self):
+        InstallInterfaceBase.__init__(self)
         self.icw = None
         self.installProgress = None
 
diff --git a/installinterfacebase.py b/installinterfacebase.py
new file mode 100644
index 0000000..986bc2a
--- /dev/null
+++ b/installinterfacebase.py
@@ -0,0 +1,47 @@
+#
+# installinterfacebase.py: a baseclass for anaconda interface classes
+#
+# Copyright (C) 2010  Red Hat, Inc.  All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+# Author(s): Hans de Goede <hdegoede@xxxxxxxxxx>
+
+import gettext
+_ = lambda x: gettext.ldgettext("anaconda", x)
+P_ = lambda x, y, z: gettext.ldngettext("anaconda", x, y, z)
+
+class InstallInterfaceBase(object):
+    def __init__(self):
+        self._warnedUnusedRaidMembers = []
+
+    def unusedRaidMembersWarning(self, unusedRaidMembers):
+        """Warn about unused BIOS RAID members"""
+        unusedRaidMembers = \
+            filter(lambda m: m not in self._warnedUnusedRaidMembers,
+                   unusedRaidMembers)
+        if unusedRaidMembers:
+            self._warnedUnusedRaidMembers.extend(unusedRaidMembers)
+            unusedRaidMembers.sort()
+            self.messageWindow(_("Warning"),
+                P_("Disk %s contains BIOS RAID metadata, but is not part of "
+                   "any recognized BIOS RAID sets. Ignoring disk %s." %
+                   (", ".join(unusedRaidMembers),
+                    ", ".join(unusedRaidMembers)),
+                   "Disks %s contain BIOS RAID metadata, but are not part of "
+                   "any recognized BIOS RAID sets. Ignoring disks %s." %
+                   (", ".join(unusedRaidMembers),
+                    ", ".join(unusedRaidMembers)),
+                   len(unusedRaidMembers)),
+                custom_icon="warning")
diff --git a/iw/filter_gui.py b/iw/filter_gui.py
index 00ec5c9..672f052 100644
--- a/iw/filter_gui.py
+++ b/iw/filter_gui.py
@@ -648,6 +648,7 @@ class FilterWindow(InstallWindow):
                      udev_device_get_serial(d), ident, "", "", "", "")
             _addTuple(tuple)
 
+        used_raidmembers = []
         for rs in block.getRaidSets():
             rs.activate(mknod=True, mkparts=False)
             udev_settle()
@@ -661,6 +662,7 @@ class FilterWindow(InstallWindow):
             members = filter(lambda m: isinstance(m, block.device.RaidDev),
                              list(rs.get_members()))
             members = map(lambda m: m.get_devpath(), members)
+            used_raidmembers.extend(members)
             for d in raids:
                 if udev_device_get_name(d) in members:
                     fstype = udev_device_get_format(d)
@@ -679,6 +681,13 @@ class FilterWindow(InstallWindow):
 
             rs.deactivate()
 
+        unused_raidmembers = []
+        for d in raids:
+            if udev_device_get_name(d) not in used_raidmembers:
+                unused_raidmembers.append(udev_device_get_name(d))
+
+        self.anaconda.intf.unusedRaidMembersWarning(unused_raidmembers)
+
         for mpath in mpaths:
             # We only need to grab information from the first device in the set.
             name = udev_device_get_name(mpath[0])
diff --git a/storage/devicetree.py b/storage/devicetree.py
index d304b38..386d23f 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -173,6 +173,8 @@ class DeviceTree(object):
         # names of protected devices at the time of tree population
         self.protectedDevNames = []
 
+        self.unusedRaidMembers = []
+
         self.__multipaths = {}
         self.__multipathConfigWriter = devicelibs.mpath.MultipathConfigWriter()
 
@@ -1630,7 +1632,7 @@ class DeviceTree(object):
         if len(rss) == 0:
             # we ignore the device in the hope that all the devices
             # from this set will be ignored.
-            # FIXME: Can we reformat a raid device?
+            self.unusedRaidMembers.append(device.name)
             self.addIgnoredDisk(device.name)
             return
 
@@ -1879,6 +1881,15 @@ class DeviceTree(object):
         for leaf in self.leaves:
             leafInconsistencies(leaf)
 
+        # Check for unused BIOS raid members, unused dmraid members are added
+        # to self.unusedRaidMembers as they are processed, extend this list
+        # with unused mdraid BIOS raid members
+        for c in self.getDevicesByType("mdcontainer"):
+            if c.kids == 0:
+                self.unusedRaidMembers.extend(map(lambda m: m.name, c.devices))
+
+        self.intf.unusedRaidMembersWarning(self.unusedRaidMembers)
+
     def populate(self):
         """ Locate all storage devices. """
 
diff --git a/text.py b/text.py
index a59b114..898bc26 100644
--- a/text.py
+++ b/text.py
@@ -36,6 +36,7 @@ from flags import flags
 from constants_text import *
 from constants import *
 from network import hasActiveNetDev
+from installinterfacebase import InstallInterfaceBase
 import imputil
 
 import gettext
@@ -257,7 +258,7 @@ class PassphraseEntryWindow:
     def pop(self):
         self.screen.popWindow()
 
-class InstallInterface:
+class InstallInterface(InstallInterfaceBase):
     def progressWindow(self, title, text, total, updpct = 0.05, pulse = False):
         return ProgressWindow(self.screen, title, text, total, updpct, pulse)
 
@@ -437,6 +438,7 @@ class InstallInterface:
         self.screen.resume()
 
     def __init__(self):
+	InstallInterfaceBase.__init__(self)
 	signal.signal(signal.SIGINT, signal.SIG_IGN)
 	signal.signal(signal.SIGTSTP, signal.SIG_IGN)
 	self.screen = SnackScreen()
-- 
1.6.6.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux