[master 8/9] Implement the support for resizing internal metadata LVs of thin pools

vpodzime installerbot-noreply at redhat.com
Mon Jun 8 14:13:41 UTC 2015


From: Vratislav Podzimek <vpodzime at redhat.com>

Internal metadata LVs of thin pools can be resized so our representation should
also allow it.

This needs a change in the LVMLogicalVolumeDevice.resize() method so that it
doesn't blindly rely on having self.format and self.originalFormat set to
non-None values because that's exactly what internal LVs do/have.
---
 blivet/devices/lvm.py | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/blivet/devices/lvm.py b/blivet/devices/lvm.py
index a7c8eb0..875ad4e 100644
--- a/blivet/devices/lvm.py
+++ b/blivet/devices/lvm.py
@@ -730,9 +730,9 @@ def resize(self):
         # Setup VG parents (in case they are dmraid partitions for example)
         self.vg.setupParents(orig=True)
 
-        if self.originalFormat.exists:
+        if self.originalFormat and self.originalFormat.exists:
             self.originalFormat.teardown()
-        if self.format.exists:
+        if self.format and self.format.exists:
             self.format.teardown()
 
         udev.settle()
@@ -1038,7 +1038,15 @@ class LVMMetadataLogicalVolumeDevice(LVMInternalLogicalVolumeDevice):
     name_suffix = r"_[trc]meta(_[0-9]+)?"
     takes_extra_space = True
 
-    # TODO: override and allow resize()
+    # (only) thin pool metadata LVs can be resized directly
+    def resize(self):
+        if re.search(r'_[rc]meta', self.lvname):
+            raise errors.DeviceError("RAID and cache pool metadata LVs cannot be resized directly")
+
+        # skip the generic LVMInternalLogicalVolumeDevice class and call the
+        # resize() method of the LVMLogicalVolumeDevice
+        super(LVMInternalLogicalVolumeDevice, self).resize()
+
 _INTERNAL_LV_CLASSES.append(LVMMetadataLogicalVolumeDevice)
 
 class LVMLogLogicalVolumeDevice(LVMInternalLogicalVolumeDevice):


-- 
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/6c72c566f710eb7ccf7633223e6fb090b488a5ef


More information about the anaconda-patches mailing list