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 Nov 30, 2023
1 parent 50ac269 commit dc3549c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
15 changes: 7 additions & 8 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,12 @@ func (t *imageType) checkOptions(bp *blueprint.Blueprint, options distro.ImageOp
}

mountpoints := customizations.GetFilesystems()

if mountpoints != nil && t.rpmOstree {
return warnings, fmt.Errorf("Custom mountpoints are not supported for ostree types")
mountPointPolicies := pathpolicy.MountpointPolicies
if t.rpmOstree {
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 dc3549c

Please sign in to comment.