Skip to content

Move root partition resizing logic to VM.grow_root_partition() - #542

Merged
glehmann merged 5 commits into
masterfrom
gln/refactor-root-partition-resizing-vyxq
Jul 28, 2026
Merged

Move root partition resizing logic to VM.grow_root_partition()#542
glehmann merged 5 commits into
masterfrom
gln/refactor-root-partition-resizing-vyxq

Conversation

@glehmann

@glehmann glehmann commented May 20, 2026

Copy link
Copy Markdown
Member

And make it a bit more robust, by fetching the actual partition mounted on /

Also add support for other Linux distributions than Alpine.

Signed-off-by: Gaëtan Lehmann gaetan.lehmann@vates.tech

This PR is part of a stack containing 2 PRs:

  1. master
  2. Use vm.detect_package_manager() to check if apk is available #540
  3. "Move root partition resizing logic to VM.grow_root_partition()" (this PR)

@glehmann
glehmann requested review from a team as code owners May 20, 2026 14:46
@glehmann
glehmann force-pushed the gln/detect-package-manager-apk-zysx branch from 757ef63 to eef0398 Compare May 20, 2026 14:47
@glehmann
glehmann force-pushed the gln/refactor-root-partition-resizing-vyxq branch 3 times, most recently from 58bac05 to e5d048c Compare May 20, 2026 14:50

@ydirson ydirson left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to add more context, not everyone is expected to know what this partition resizing is about

Comment thread lib/vm.py Outdated
Comment on lines +513 to +519
# growpart is not available in alpine 3.12
# vm.ssh('apk add cloud-utils-growpart e2fsprogs-extra')
self.ssh('apk add gawk util-linux e2fsprogs-extra')
self.ssh(
'wget https://raw.githubusercontent.com/canonical/cloud-utils/main/bin/growpart -O /usr/bin/growpart'
)
self.ssh('chmod +x /usr/bin/growpart')

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still gives an external dependency on known-flaky github, I'm not sure we want to have more of them.
Is there any particular reason to use such an external tool? Wouldn't parted just avoid this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't add a dependency, it's already there.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed growpart and used sfdisk and partx instead, which were already dependencies

@glehmann
glehmann force-pushed the gln/detect-package-manager-apk-zysx branch from eef0398 to 2b44b30 Compare May 20, 2026 19:02
@glehmann
glehmann force-pushed the gln/refactor-root-partition-resizing-vyxq branch from e5d048c to 2dfde42 Compare May 20, 2026 19:02
@glehmann
glehmann force-pushed the gln/detect-package-manager-apk-zysx branch from 2b44b30 to c643b60 Compare May 21, 2026 21:29
@glehmann
glehmann force-pushed the gln/refactor-root-partition-resizing-vyxq branch 4 times, most recently from a6d89bc to bd9fc0e Compare May 22, 2026 15:29
@glehmann
glehmann force-pushed the gln/detect-package-manager-apk-zysx branch from c643b60 to 6738a0e Compare May 22, 2026 15:29
@glehmann
glehmann requested a review from ydirson May 22, 2026 17:40
@glehmann
glehmann force-pushed the gln/refactor-root-partition-resizing-vyxq branch from bd9fc0e to 227d3fc Compare May 29, 2026 11:37
@glehmann
glehmann force-pushed the gln/detect-package-manager-apk-zysx branch from 6738a0e to 0b91aaa Compare May 29, 2026 11:37
@glehmann
glehmann force-pushed the gln/refactor-root-partition-resizing-vyxq branch from 227d3fc to 23beb66 Compare June 4, 2026 20:29
@glehmann
glehmann force-pushed the gln/detect-package-manager-apk-zysx branch 2 times, most recently from 022f4bf to a10e49e Compare June 8, 2026 09:43
@glehmann
glehmann force-pushed the gln/refactor-root-partition-resizing-vyxq branch 2 times, most recently from 13c905d to 96153b6 Compare June 10, 2026 08:57
@glehmann
glehmann force-pushed the gln/detect-package-manager-apk-zysx branch from a10e49e to 972c6af Compare June 10, 2026 08:57
Base automatically changed from gln/detect-package-manager-apk-zysx to master June 10, 2026 09:05

@olivierh-pro olivierh-pro left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Comment thread lib/vm.py Outdated
Comment thread lib/vm.py
Comment thread lib/vm.py Outdated
Comment thread lib/vm.py
@glehmann
glehmann force-pushed the gln/refactor-root-partition-resizing-vyxq branch 3 times, most recently from 30750b4 to d87c336 Compare July 7, 2026 16:59
@glehmann
glehmann requested a review from Millefeuille42 July 7, 2026 16:59

@Millefeuille42 Millefeuille42 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The two of my remaining comments aren't blocking, but must be resolved either way (applying the suggestion or not) before merging.

glehmann added 5 commits July 28, 2026 17:16
And make it a bit more robust, by:
- fetching the actual partition mounted on /
- checking if the filesystem is ext*

Signed-off-by: Gaëtan Lehmann <gaetan.lehmann@vates.tech>
github is not exactly reliable these days.
use sfdisk, which is also used by growpart internally

Signed-off-by: Gaëtan Lehmann <gaetan.lehmann@vates.tech>
Signed-off-by: Gaëtan Lehmann <gaetan.lehmann@vates.tech>
Signed-off-by: Gaëtan Lehmann <gaetan.lehmann@vates.tech>
and implement missing command for opensuse

Signed-off-by: Gaëtan Lehmann <gaetan.lehmann@vates.tech>
@glehmann
glehmann force-pushed the gln/refactor-root-partition-resizing-vyxq branch from d87c336 to 686b749 Compare July 28, 2026 15:16
@glehmann
glehmann merged commit 2be0026 into master Jul 28, 2026
11 checks passed
@glehmann
glehmann deleted the gln/refactor-root-partition-resizing-vyxq branch July 28, 2026 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants