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

Vratislav Podzimek vpodzime at redhat.com
Thu Oct 10 10:23:09 UTC 2013


On Wed, 2013-10-09 at 11:21 -0700, Brian C. Lane wrote:
> 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)
>  
ACK.

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list