feat(growpart): add LVM resize support #6586
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes GH-3265
This change integrates LVM logical volume resizing into the existing growpart flow. When the target block device is an LVM LV, cloud-init now performs:
Filesystem resizing is intentionally omitted because resizefs is handled by a separate module.
Unit tests have been added under test_cc_growpart.py to validate:
This change does not affect existing non-LVM growpart behaviour.
Redhat Jira ticket: [RFE][Azure]growpart fails to resize a root partition on LVM
https://issues.redhat.com/browse/RHEL-107485
Test Steps
I tested it on Azure and AWS with rhel image, for example,
Boot up a VM on Azure and change the os disk to bigger than 64G
Check the rootlv partition size, the root partition size is extended after VM boot up.
[Before changes]
The root partition size is not extended.
[After changes]
The root partition size is extended.
I’ve added three unit tests. Please let me know if further coverage is needed.
The integration test case is copied from #887, however I did not test it because that I failed to set up the local integration test environment, I will run it later.