Skip to content

Commit

Permalink
Implement the support for resizing internal metadata LVs of thin pools
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
vpodzime committed Jun 8, 2015
1 parent 5dd0f65 commit 6c72c56
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions blivet/devices/lvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 6c72c56

Please sign in to comment.