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
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.
Regards,
Dan
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list