Skip to content

Commit

Permalink
blueprint/customization:filesystem customizations for raw
Browse files Browse the repository at this point in the history
Filesystem customizations is enabled for edge-raw-image
relevent testing config is added.

Signed-off-by: Sayan Paul <[email protected]>
  • Loading branch information
say-paul committed Dec 1, 2023
1 parent b33771b commit 2733adf
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
14 changes: 8 additions & 6 deletions pkg/distro/rhel9/imagetype.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,6 @@ func (t *imageType) getPartitionTable(
// Edge supports only LVM, force it.
// Raw is not supported, return an error if it is requested
// TODO Need a central location for logic like this
if partitioningMode == disk.RawPartitioningMode {
return nil, fmt.Errorf("partitioning mode raw not supported for %s on %s", t.Name(), t.arch.Name())
}

partitioningMode = disk.LVMPartitioningMode
}
Expand Down Expand Up @@ -355,8 +352,10 @@ func (t *imageType) checkOptions(bp *blueprint.Blueprint, options distro.ImageOp
if options.OSTree == nil || options.OSTree.URL == "" {
return warnings, fmt.Errorf("%q images require specifying a URL from which to retrieve the OSTree commit", t.name)
}

allowed := []string{"Ignition", "Kernel", "User", "Group", "FIPS"}
if t.name == "edge-raw-image" {
allowed = append(allowed, "Filesystem")
}
if err := customizations.CheckAllowed(allowed...); err != nil {
return warnings, fmt.Errorf("unsupported blueprint customizations found for image type %q: (allowed: %s)", t.name, strings.Join(allowed, ", "))
}
Expand All @@ -383,12 +382,15 @@ func (t *imageType) checkOptions(bp *blueprint.Blueprint, options distro.ImageOp
}

mountpoints := customizations.GetFilesystems()
mountPointPolicies := pathpolicy.MountpointPolicies

if mountpoints != nil && t.rpmOstree {
if mountpoints != nil && t.rpmOstree && t.name != "edge-raw-image" {
return warnings, fmt.Errorf("Custom mountpoints are not supported for ostree types")
} else if t.name == "edge-raw-image" {
mountPointPolicies = pathpolicy.OstreeMountpointPolicies
}

err := blueprint.CheckMountpointsPolicy(mountpoints, pathpolicy.MountpointPolicies)
err := blueprint.CheckMountpointsPolicy(mountpoints, mountPointPolicies)
if err != nil {
return warnings, err
}
Expand Down
16 changes: 16 additions & 0 deletions test/configs/filesystem-customizations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "filesystem-customizations",
"ostree": {
"url": "http://example.com/repo"
},
"blueprint": {
"customizations": {
"filesystem": [
{
"mountpoint": "/foo",
"minsize": "2147483648"
}
]
}
}
}

0 comments on commit 2733adf

Please sign in to comment.