Re: [PATCH 4/4] Add a description attribute to MDRaidArrayDevice

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

 



> This stops us from backtracing when trying to formulate the question if
> we need to init the label on the array.

If it's ever possible for MDRaidArrayDevice.model to be called on a
container, you should probably also fix that method up.  What's there
right now is not going to work:

    @property
    def model(self):
        return "RAID%d Array" % self.level

There are a couple other places where "%d" % self.level is used that may
need to be checked.  I don't know when this could happen and when it's
safe.

> diff --git a/storage/devices.py b/storage/devices.py
> index fcefb2b..e76029b 100644
> --- a/storage/devices.py
> +++ b/storage/devices.py
> @@ -2415,6 +2415,22 @@ class MDRaidArrayDevice(StorageDevice):
>  
>          return size
>  
> +    @property
> +    def description(self):
> +        if self.level == mdraid.RAID0:
> +            levelstr = "striped"
> +        elif self.level == mdraid.RAID1:
> +            levelstr = "mirrored"
> +        else:
> +            levelstr = "level: %s" % self.level
> +
> +        if self.type == "mdcontainer":
> +            return "BIOS RAID container"
> +        elif self.devices and self.devices[0].type == "mdcontainer":
> +            return "BIOS RAID set (%s)" % levelstr
> +        else:
> +            return "MDRAID set (%s)" % levelstr
> +
>      def __str__(self):
>          s = StorageDevice.__str__(self)
>          s += ("  level = %(level)s  bitmap = %(bitmap)s  spares = %(spares)s\n"

Looks fine.

- Chris

_______________________________________________
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