-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for the new partitioning customizations to RHEL and CentOS #1077
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
d524c2f
fedora: read and validate the Partitioning only once
achilleas-k c47e5c9
distro/rhel: pass customizations to GetPartitionTable()
achilleas-k f8cde68
distro/rhel: support new partitioning customizations on RHEL 9 and 10
achilleas-k 4e5f0c1
test: test custom partitioning on RHEL and CentOS 9 and 10
achilleas-k File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,12 @@ const ( | |
BlueprintPkgsKey = "blueprint" | ||
) | ||
|
||
// Default directory size minimums for all image types. | ||
var requiredDirectorySizes = map[string]uint64{ | ||
"/": 1 * datasizes.GiB, | ||
"/usr": 2 * datasizes.GiB, | ||
} | ||
|
||
type ImageFunc func(workload workload.Workload, t *ImageType, customizations *blueprint.Customizations, options distro.ImageOptions, packageSets map[string]rpmmd.PackageSet, containers []container.SourceSpec, rng *rand.Rand) (image.ImageKind, error) | ||
|
||
type PackageSetFunc func(t *ImageType) rpmmd.PackageSet | ||
|
@@ -180,7 +186,7 @@ func (t *ImageType) BootMode() platform.BootMode { | |
} | ||
|
||
func (t *ImageType) GetPartitionTable( | ||
mountpoints []blueprint.FilesystemCustomization, | ||
customizations *blueprint.Customizations, | ||
options distro.ImageOptions, | ||
rng *rand.Rand, | ||
) (*disk.PartitionTable, error) { | ||
|
@@ -193,8 +199,29 @@ func (t *ImageType) GetPartitionTable( | |
} | ||
|
||
imageSize := t.Size(options.Size) | ||
partitioning, err := customizations.GetPartitioning() | ||
if err != nil { | ||
return nil, err | ||
} | ||
if partitioning != nil { | ||
// Use the new custom partition table to create a PT fully based on the user's customizations. | ||
// This overrides FilesystemCustomizations, but we should never have both defined. | ||
if options.Size > 0 { | ||
// user specified a size on the command line, so let's override the | ||
// customization with the calculated/rounded imageSize | ||
partitioning.MinSize = imageSize | ||
} | ||
|
||
partOptions := &disk.CustomPartitionTableOptions{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess the fact that this is duplicated with fedor/imagetype.go is unavoidable currently (and consistent with the rest of the code)(?) |
||
PartitionTableType: basePartitionTable.Type, // PT type is not customizable, it is determined by the base PT for an image type or architecture | ||
BootMode: t.BootMode(), | ||
DefaultFSType: disk.FS_XFS, // default fs type for RHEL | ||
RequiredMinSizes: requiredDirectorySizes, | ||
} | ||
return disk.NewCustomPartitionTable(partitioning, partOptions, rng) | ||
} | ||
|
||
return disk.NewPartitionTable(&basePartitionTable, mountpoints, imageSize, options.PartitioningMode, nil, rng) | ||
return disk.NewPartitionTable(&basePartitionTable, customizations.GetFilesystems(), imageSize, options.PartitioningMode, nil, rng) | ||
} | ||
|
||
func (t *ImageType) getDefaultImageConfig() *distro.ImageConfig { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could be defensive here and double check that customizations.Filesystem and partitioning is never both non-nil and raise an internal error. But maybe overkill.