[master/rhel7] kickstart: check for correct format (#1014545)

Brian C. Lane bcl at redhat.com
Wed Oct 9 18:21:12 UTC 2013


From: "Brian C. Lane" <bcl at redhat.com>

When using raid, btrfs or volgroup make sure the members have the
correct format before continuing.

Resolves: rhbz#1014545

-- Note that this will still TB, unless the patch for 1013482 to
-- catch and display KickstartValueError has been applied.
---
 pyanaconda/kickstart.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index fd9ec1f..fd9b90a 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -320,6 +320,10 @@ class BTRFSData(commands.btrfs.F17_BTRFSData):
                     dev = devicetree.getChildren(dev)[0]
                 except IndexError:
                     dev = None
+
+            if dev and dev.format.type != "btrfs":
+                raise KickstartValueError, formatErrorMsg(self.lineno, msg="BTRFS partition %s has incorrect format (%s)" % (member, dev.format.type))
+
             if not dev:
                 raise KickstartValueError, formatErrorMsg(self.lineno, msg="Tried to use undefined partition %s in BTRFS volume specification" % member)
 
@@ -1149,6 +1153,10 @@ class RaidData(commands.raid.F18_RaidData):
                     dev = devicetree.getChildren(dev)[0]
                 except IndexError:
                     dev = None
+
+            if dev and dev.format.type != "mdmember":
+                raise KickstartValueError, formatErrorMsg(self.lineno, msg="RAID member %s has incorrect format (%s)" % (mem, dev.format.type))
+
             if not dev:
                 raise KickstartValueError, formatErrorMsg(self.lineno, msg="Tried to use undefined partition %s in RAID specification" % mem)
 
@@ -1366,6 +1374,10 @@ class VolGroupData(commands.volgroup.FC16_VolGroupData):
                     dev = devicetree.getChildren(dev)[0]
                 except IndexError:
                     dev = None
+
+            if dev and dev.format.type != "lvmpv":
+                raise KickstartValueError, formatErrorMsg(self.lineno, msg="Physical Volume %s has incorrect format (%s)" % (pv, dev.format.type))
+
             if not dev:
                 raise KickstartValueError, formatErrorMsg(self.lineno, msg="Tried to use undefined partition %s in Volume Group specification" % pv)
 
-- 
1.8.3.1



More information about the anaconda-patches mailing list