On Sun, 2009-04-05 at 07:49 -0700, Dan Williams wrote: > David Lehman wrote: > > --- > > storage/devices.py | 29 +++++++++++++++++++++++++---- > > 1 files changed, 25 insertions(+), 4 deletions(-) > > > > diff --git a/storage/devices.py b/storage/devices.py > > index d0b00b8..79a4bd5 100644 > > --- a/storage/devices.py > > +++ b/storage/devices.py > > @@ -2060,11 +2060,32 @@ class MDRaidArrayDevice(StorageDevice): > > % (self.path, self.uuid)) > > > > @property > > + def smallestMember(self): > > + try: > > + smallest = sorted(self.devices, key=lambda d: d.size)[0] > > + except IndexError: > > + smallest = None > > + return smallest > > + > > + @property > > def size(self): > > - size = None > > - for device in self.devices: > > - if size is None or device.size < size: > > - size = device.size > > + if not self.devices: > > + return 0 > > + > > + size = 0 > > + if not self.exists or not self.partedDevice: > > + if self.level == 0: > > + size = self.memberDevices * self.smallestMember.size > > + elif self.level == 1: > > + size = self.smallestMember.size > > + elif self.level == 5: > > + size = (self.memberDevices - 1) * self.smallestMember.size > > + elif self.level == 6: > > + size = (self.memberDevices - 2) * self.smallestMember.size > > + elif self.level == 10: > > + size = (self.memberDevices / 2.0) * self.smallestMember.size > > + else: > > + size = super(MDRaidArrayDevice, self).size > > Just curious, how accurate does this size need to be, because this The more accurate, the better. > calculation will almost always be bigger than the actual size? At a > minimum the non-raid1 raid levels will be rounded down to be a multiple > of the chunk size. Intel(R) Matrix arrays are a bit weird in that they > will be rounded down to the nearest 1MB boundary. Oh, great. What we need is more special cases. Currently, this class is only used to represent MD raid arrays, which does not include the Matrix (they are handled by dm-raid). However, it won't be long before we are also using MD for at least some of the Intel arrays. > > Regards, > Dan > > _______________________________________________ > Anaconda-devel-list mailing list > Anaconda-devel-list@xxxxxxxxxx > https://www.redhat.com/mailman/listinfo/anaconda-devel-list _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list