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

[PATCH][rhel6-branch] Check all PV ancestor devices for growable partitions.



We were already checking the pvs themselves, but were not taking into
account the possibility of a pv on an md whose members are growable
partitions.

Resolves: rhbz#677915
---
 storage/devices.py |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/storage/devices.py b/storage/devices.py
index e6b7087..7b9613d 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -798,6 +798,18 @@ class StorageDevice(Device):
     def vendor(self):
         return self._vendor
 
+    @property
+    def growable(self):
+        """ True if this device or it's component devices are growable. """
+        grow = getattr(self, "req_grow", False)
+        if not grow:
+            for parent in self.parents:
+                grow = parent.growable
+                if grow:
+                    break
+        return grow
+
+
 class DiskDevice(StorageDevice):
     """ A disk """
     _type = "disk"
@@ -1737,10 +1749,6 @@ class LUKSDevice(DMCryptDevice):
         self.teardown()
 
     @property
-    def req_grow(self):
-        return getattr(self.slave, "req_grow", None)
-
-    @property
     def slave(self):
         """ This device's backing device. """
         return self.parents[0]
@@ -2062,9 +2070,7 @@ class LVMVolumeGroupDevice(DMDevice):
 
         # verify we have the space, then add it
         # do not verify for growing vg (because of ks)
-        if not lv.exists and \
-           not [pv for pv in self.pvs if getattr(pv, "req_grow", None)] and \
-           lv.size > self.freeSpace:
+        if not lv.exists and not self.growable and lv.size > self.freeSpace:
             raise DeviceError("new lv is too large to fit in free space", self.name)
 
         log.debug("Adding %s/%dMB to %s" % (lv.name, lv.size, self.name))
-- 
1.7.3.5


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