[blivet] Make sure createBitmap is updated when level changes (#960271)

Brian C. Lane bcl at redhat.com
Thu May 9 17:23:18 UTC 2013


From: "Brian C. Lane" <bcl at redhat.com>

---
 blivet/devices.py | 27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/blivet/devices.py b/blivet/devices.py
index 450dac0..ef5db99 100644
--- a/blivet/devices.py
+++ b/blivet/devices.py
@@ -2699,9 +2699,6 @@ class MDRaidArrayDevice(StorageDevice):
         else:
             self.metadataVersion = metadataVersion
 
-        # bitmaps are not meaningful on raid0 according to mdadm-3.0.3
-        self.createBitmap = self.level != 0
-
         # For container members probe size now, as we cannot determine it
         # when teared down.
         if self.parents and self.parents[0].type == "mdcontainer":
@@ -2721,6 +2718,30 @@ class MDRaidArrayDevice(StorageDevice):
                                                 % (self.path, self.uuid))
 
     @property
+    def level(self):
+        """ Return the raid level
+
+            :returns: raid level value
+            :rtype:   int
+        """
+        return self._level
+
+    @level.setter
+    def level(self, value):
+        """ Set the RAID level and enforce restrictions based on it.
+
+            :param value: new raid level
+            :param type:  int
+            :returns:     None
+
+            Sets createBitmap True unless level is 0
+        """
+        self._level = value
+
+        # bitmaps are not meaningful on raid0 according to mdadm-3.0.3
+        self.createBitmap = self._level != 0
+
+    @property
     def rawArraySize(self):
         """ Calculate the raw array size without taking into account space
         reserved for metadata or chunkSize alignment.
-- 
1.8.1.4



More information about the anaconda-patches mailing list