[blivet:master 10/16] Check for required methods in MDRaidLevels.isRaidLevel.
David Lehman
dlehman at redhat.com
Tue May 6 18:23:14 UTC 2014
On 05/06/2014 11:42 AM, mulhern wrote:
> Signed-off-by: mulhern <amulhern at redhat.com>
> ---
> blivet/devicelibs/mdraid.py | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/blivet/devicelibs/mdraid.py b/blivet/devicelibs/mdraid.py
> index 715f5df..1859f59 100644
> --- a/blivet/devicelibs/mdraid.py
> +++ b/blivet/devicelibs/mdraid.py
> @@ -37,7 +37,11 @@ MD_CHUNK_SIZE = Size(spec="512 KiB")
> class MDRaidLevels(raid.RAIDLevels):
> @classmethod
> def isRaidLevel(cls, level):
> - return super(MDRaidLevels, cls).isRaidLevel(level)
> + return super(MDRaidLevels, cls).isRaidLevel(level) and \
> + hasattr(level, 'get_max_spares') and \
> + hasattr(level, 'get_base_member_size') and \
> + hasattr(level, 'get_recommended_stride') and \
> + hasattr(level, 'get_size')
Are these not enforced/required by the RAIDLevel class hierarchy itself?
>
> _RAID_levels = MDRaidLevels(["raid0", "raid1", "raid4", "raid5", "raid6", "raid10", "container"])
>
>
More information about the anaconda-patches
mailing list