Skip to content

Conversation

@davidcassany
Copy link
Contributor

This commit allows to set specific additional mount points for block devices in mount command. They can be set by label, partlabel, uuid and device path.

In addition this commit also introduces some logic to precompute initial fstab lines for sysroot and
other mounts done in previous stages.

@davidcassany davidcassany added the all-distros Runs CI for all available example images label Feb 6, 2024
@davidcassany davidcassany requested a review from a team as a code owner February 6, 2024 18:31
@codecov-commenter
Copy link

codecov-commenter commented Feb 6, 2024

Codecov Report

Attention: 111 lines in your changes are missing coverage. Please review.

Comparison is base (8955a78) 72.54% compared to head (8001e7e) 72.06%.

Files Patch % Lines
pkg/action/mount.go 25.19% 92 Missing and 6 partials ⚠️
cmd/config/config.go 18.75% 13 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1937      +/-   ##
==========================================
- Coverage   72.54%   72.06%   -0.48%     
==========================================
  Files          72       72              
  Lines        7930     8020      +90     
==========================================
+ Hits         5753     5780      +27     
- Misses       1710     1777      +67     
+ Partials      467      463       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

continue
}
if lineFields[2] == "btrfs" {
r := regexp.MustCompile(`(/.+)\[.*\]`)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

On btrfs mounted subvolume added in brackets something like /dev/sda1[/@/.snapshots/1/snapshot] hence we need to remove it from the SOURCE field, that's why there this extra parsing logic here.

Volumes: []*v1.VolumeMount{
{
Mountpoint: constants.PersistentDir,
Device: fmt.Sprintf("PARTLABEL=%s", constants.PersistentPartName),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

GPT partition labels are not configurable, only filesystem labels, so adding these here is fine, this is not does collision with eventual custom user labels.

In addition the user has the capability to completely rewrite this list in config.yaml if needed.

This commit allows to set specific additional mount
points for block devices in mount command. They can
be set by label, partlabel, uuid and device path.

In addition this commit also introduces some logic
to precompute initial fstab lines for sysroot and
other mounts done in previous stages.

Signed-off-by: David Cassany <[email protected]>
@davidcassany davidcassany force-pushed the update_mount_command branch 2 times, most recently from 82a521b to 8001e7e Compare February 7, 2024 12:46
keys = append(keys, v.Mountpoint)
}

sort.Strings(keys)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In case you are wondering this sorting keys logic to allow nested mountpoints such as having a volume mounted at /run/elemental and persistent mount point at /run/elemental/persistent. With this logic we make sure /run/elemental is mounted first.

Copy link
Contributor

@frelon frelon left a comment

Choose a reason for hiding this comment

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

Looks great!

@davidcassany davidcassany enabled auto-merge (rebase) February 7, 2024 15:53
@davidcassany davidcassany merged commit 8396170 into rancher:main Feb 7, 2024
@davidcassany davidcassany deleted the update_mount_command branch February 7, 2024 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

all-distros Runs CI for all available example images

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants