Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align sizes up for growable LVs #1309

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions blivet/devices/luks.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ def _get_size(self):

def _set_size(self, newsize):
if not self.exists and not self.raw_device.exists:
log.debug("adjusting size of %s to %s to accommodate LUKS metadata",
self.raw_device.name,
newsize + self.raw_device.format._header_size)
self.raw_device.size = newsize + self.raw_device.format._header_size

# just run the StorageDevice._set_size to make sure we are in the format limits
Expand Down
2 changes: 1 addition & 1 deletion blivet/devices/lvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -2673,7 +2673,7 @@ def _set_size(self, newsize):
if not isinstance(newsize, Size):
raise AttributeError("new size must be of type Size")

newsize = self.vg.align(newsize)
newsize = self.vg.align(newsize, roundup=self.growable)
log.debug("trying to set lv %s size to %s", self.name, newsize)
# Don't refuse to set size if we think there's not enough space in the
# VG for an existing LV, since it's existence proves there is enough
Expand Down
8 changes: 4 additions & 4 deletions blivet/devices/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -635,11 +635,11 @@ def _set_size(self, newsize):
max_size = self.format.max_size
min_size = self.format.min_size
if max_size and newsize > max_size:
raise errors.DeviceError("device cannot be larger than %s" %
max_size, self.name)
raise errors.DeviceError("device %s cannot be larger than %s" %
(self.name, max_size))
elif min_size and newsize < min_size:
raise errors.DeviceError("device cannot be smaller than %s" %
min_size, self.name)
raise errors.DeviceError("device %s cannot be smaller than %s" %
(self.name, min_size))

self._size = newsize

Expand Down