diff --git a/blivet/devices/lvm.py b/blivet/devices/lvm.py index a7c8eb041..875ad4e72 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):