Reduce thin pool by one more extent

The previous commit was tested on 2TB without issue, but testing on a
very small volume (80GB) resulted in the thin pool lvextend failing
for being one extent too large.

This change reduces the pool size by one extent.

Change-Id: I7ca002783f8f15946bc84af95eecaa097e70aaf1
Related: rhbz#2149586
This commit is contained in:
Steve Baker 2022-12-22 17:13:08 +13:00
parent 4a161d0cde
commit 7e2a2aa027
2 changed files with 7 additions and 5 deletions

View File

@ -512,9 +512,11 @@ def main(argv):
thin_pool = find_thin_pool(devices, group)
if thin_pool:
# total size available, reduced by POOL_METADATA_SIZE
# rounded down to whole extent
# rounded down to whole extent and reduced by 1 extent
# for metadata overhead
size_bytes -= POOL_METADATA_SIZE
size_bytes -= size_bytes % PHYSICAL_EXTENT_BYTES
size_bytes -= PHYSICAL_EXTENT_BYTES
dev_path = '/dev/%s' % devname
grow_vols = find_grow_vols(opts, devices, group, size_bytes)

View File

@ -601,13 +601,13 @@ class TestGrowvols(base.BaseTestCase):
mock.call(['vgextend', 'vg', '/dev/sda5']),
mock.call(['lvextend', '--poolmetadatasize', '+1073741824B',
'/dev/mapper/vg-lv_thinpool', '/dev/sda5']),
mock.call(['lvextend', '-L+208331079680B',
mock.call(['lvextend', '-L+208326885376B',
'/dev/mapper/vg-lv_thinpool', '/dev/sda5']),
mock.call(['lvextend', '--size', '+41666215936B',
mock.call(['lvextend', '--size', '+41662021632B',
'/dev/mapper/vg-lv_home']),
mock.call(['lvextend', '--size', '+83332431872B',
mock.call(['lvextend', '--size', '+83328237568B',
'/dev/mapper/vg-lv_var']),
mock.call(['lvextend', '--size', '+83332431872B',
mock.call(['lvextend', '--size', '+83336626176B',
'/dev/mapper/vg-lv_root']),
mock.call(['xfs_growfs', '/dev/mapper/vg-lv_home']),
mock.call(['xfs_growfs', '/dev/mapper/vg-lv_var']),