Commit Graph

8 Commits

Author SHA1 Message Date
Steve Baker
420fb14e8f growvols: reserve space for spare metadata volume
Currently space is reserved for the metadata volume, but there is also a
spare metadata volume which is used for metadata check and restore.

This change reserves space for the spare. It also changes the volume
reference in the lvextend call to vg/lv_thinpool, the path based
reference results in the spare not growing.

Resolves: rhbz#2232632
Change-Id: If78743bb37f24756c049939645db202261df6775
2023-08-23 08:29:20 +12:00
Steve Baker
9fa139511e Check and grow the GPT structure to the end of the volume
In the baremetal case this isn't required because it is done by
ironic-python-agent when writing the image to the volume[1].

But when using the image directly (such as in a nova VM) the GPT
structure needs to be extended first. This change does that, along
with the detection for whether extending is required, using the same
approach as [1].

[1] https://github.com/openstack/ironic-lib/blob/master/ironic_lib/disk_utils.py#L670-L674

Co-Authored-By: rminishev@itkey.com
Co-Authored-By: sbaker@redhat.com

Change-Id: I3240eb0ef4dbbb41557985f0129ae4998a846417
2023-03-23 22:14:44 +00:00
Steve Baker
7e2a2aa027 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
2022-12-22 17:24:03 +13:00
Steve Baker
00ca126287 Grow thin pool metadata by 1GiB
An LVM thin pool has an associated metadata volume, and it can be
assumed that the size of this volume on the image is minimized for
distribution.

This change grows the metadata volume by 1GiB, which is recommended[1] as
a reasonable default. This fixes a specific issue with the metadata
volume being exausted when growing into a 2TB drive.

Other minor changes include:
- Human readable printed values have switched to GiB, MiB, KiB, B
- Growth percentage volumes are adjusted down to not over-provision
  the thin volume

[1] https://access.redhat.com/solutions/6318131

Change-Id: I1dd6dd932bb5f5d9adac9b78a026569165bd4ea9
Resolves: rhbz#2149586
2022-12-19 13:40:04 +13:00
Steve Baker
f61548d863 Add thin provisioning support to growvols
This change enhances the growvols script to support all volumes being
backed by one thin provisioning pool.

If a pool is detected, the following occurs:
- validation to confirm every volume is backed by the pool
- only the pool is extended into the new partition
- volumes are extended by the same amount as the non thin-provisioned
  case

This results in no volumes being over-provisioned, so
out-of-space behaviour will be the same as the non thin-provisioned
case.

This change also switches to using /dev/mapper device mapper paths for
volume block devices, since that is the only path the thin pool is
mapped to.

Change-Id: I96085fc889e72c942cfef7e3acb6f6cd73f606dd
2022-08-24 10:14:26 +12:00
Ramil Minishev
a27de3f8a2 Make growvols config path platform independent
Change-Id: I9b8fdf96c8543bff92019fb82f10493de7728a26
2022-02-04 00:23:13 +03:00
likui
7a57da8cee Replace deprecated assertEquals
The assertEquals method has been deprecated since it was renamed
to assertEqual in Python 3.2.

https://docs.python.org/3/library/unittest.html#deprecated-aliases

Change-Id: I559ad57c2d96a3bb51080c72816f39d3baa4c9dd
2021-11-12 09:46:14 +08:00
Steve Baker
a6e0bf83db Add a growvols utility for growing LVM volumes
There is currently no automated way of growing LVM volumes on boot
like single partition images do with their growroot mechanism. This
lack likely contributes to LVM not being widely used on VM and
baremetal workloads, since growing to the full disk requires workload
knowledge to determine which volumes to grow and by what amount.

The growvols element contributes a growvols python script which can be
run on firstboot (via systemd or cloud-init) or manually via
automation such as ansible. It is also an interactive script which
displays the full list of modifying commands before prompting for
confirmation to run them all.

By default the script will grow the root volume, but arguments allow
any volume to grow by a specified amount, or a percentage of the
available disk space.

Blueprint: whole-disk-default
Change-Id: Idcf774384e56cce03e56c0e19c7d08a768606399
2021-07-01 11:16:31 +12:00