[blivet:master 04/26] Extract selection of members in complete() into a separate method.

Vratislav Podzimek vpodzime at redhat.com
Fri May 30 13:20:44 UTC 2014


On Fri, 2014-05-30 at 08:41 -0400, mulhern wrote:
> Use it in complete().
> 
> Signed-off-by: mulhern <amulhern at redhat.com>
> ---
>  blivet/devices.py | 22 ++++++++++++++++++----
>  1 file changed, 18 insertions(+), 4 deletions(-)
> 
> diff --git a/blivet/devices.py b/blivet/devices.py
> index f13ba8a..3246565 100644
> --- a/blivet/devices.py
> +++ b/blivet/devices.py
> @@ -3605,13 +3605,27 @@ class MDRaidArrayDevice(ContainerDevice):
>          return rc
>  
>      @property
> -    def complete(self):
> +    def members(self):
> +        """ Returns this array's members.
> +
> +            If the array is a BIOS RAID array then its unique parent
> +            is a container and its actual member devices are the
> +            container's parents.
> +
> +            :rtype: list of :class:`StorageDevice`
> +        """
>          if self.type == "mdbiosraidarray":
> -            members = len(self.parents[0].parents)
> +            members = self.parents[0].parents
>          else:
> -            members = len(self.parents)
> +            members = self.parents
> +        return list(members)
>  
> -        return (self.memberDevices <= members) or not self.exists
> +    @property
> +    def complete(self):
> +        """ An MDRaidArrayDevice is complete if it has at least as many
> +            component devices as its count of active devices.
> +        """
> +        return (self.memberDevices <= len(self.members)) or not self.exists
>  
>      @property
>      def devices(self):
This looks good.

-- 
Vratislav Podzimek

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



More information about the anaconda-patches mailing list