Skip to content

Commit

Permalink
distro/rhel: pass customizations to GetPartitionTable()
Browse files Browse the repository at this point in the history
Pass the whole customizations struct so we can then use the Disk
customization if it's set.
  • Loading branch information
achilleas-k committed Dec 3, 2024
1 parent d524c2f commit c47e5c9
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pkg/distro/rhel/distro_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestESP(t *testing.T) {

distro_test_common.TestESP(t, distros, func(i distro.ImageType) (*disk.PartitionTable, error) {
it := i.(*rhel.ImageType)
return it.GetPartitionTable([]blueprint.FilesystemCustomization{}, distro.ImageOptions{}, rng)
return it.GetPartitionTable(&blueprint.Customizations{}, distro.ImageOptions{}, rng)
})
}

Expand Down
6 changes: 3 additions & 3 deletions pkg/distro/rhel/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ func DiskImage(workload workload.Workload,
img.Workload = workload
img.Compression = t.Compression
// TODO: move generation into LiveImage
pt, err := t.GetPartitionTable(customizations.GetFilesystems(), options, rng)
pt, err := t.GetPartitionTable(customizations, options, rng)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -567,7 +567,7 @@ func EdgeRawImage(workload workload.Workload,
img.OSName = "rhel-edge"

// TODO: move generation into LiveImage
pt, err := t.GetPartitionTable(customizations.GetFilesystems(), options, rng)
pt, err := t.GetPartitionTable(customizations, options, rng)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -609,7 +609,7 @@ func EdgeSimplifiedInstallerImage(workload workload.Workload,
rawImg.OSName = "rhel-edge"

// TODO: move generation into LiveImage
pt, err := t.GetPartitionTable(customizations.GetFilesystems(), options, rng)
pt, err := t.GetPartitionTable(customizations, options, rng)
if err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/distro/rhel/imagetype.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,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) {
Expand All @@ -194,7 +194,7 @@ func (t *ImageType) GetPartitionTable(

imageSize := t.Size(options.Size)

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 {
Expand Down
2 changes: 1 addition & 1 deletion pkg/distro/rhel/rhel10/distro_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func TestRhel10_NoBootPartition(t *testing.T) {
// and we do not support /boot on LVM, so it must be on a separate partition.
continue
}
pt, err := it.GetPartitionTable([]blueprint.FilesystemCustomization{}, distro.ImageOptions{}, rng)
pt, err := it.GetPartitionTable(&blueprint.Customizations{}, distro.ImageOptions{}, rng)
assert.NoError(t, err)
_, err = pt.GetMountpointSize("/boot")
require.EqualError(t, err, "cannot find mountpoint /boot")
Expand Down
2 changes: 1 addition & 1 deletion pkg/distro/rhel/rhel8/distro_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func TestEC2Partitioning(t *testing.T) {
require.NoError(t, err)

it := i.(*rhel.ImageType)
pt, err := it.GetPartitionTable([]blueprint.FilesystemCustomization{}, distro.ImageOptions{}, rng)
pt, err := it.GetPartitionTable(&blueprint.Customizations{}, distro.ImageOptions{}, rng)
require.NoError(t, err)

// x86_64 is /boot-less, check that
Expand Down
2 changes: 1 addition & 1 deletion pkg/distro/rhel/rhel9/distro_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func TestEC2Partitioning(t *testing.T) {
require.NoError(t, err)

it := i.(*rhel.ImageType)
pt, err := it.GetPartitionTable([]blueprint.FilesystemCustomization{}, distro.ImageOptions{}, rng)
pt, err := it.GetPartitionTable(&blueprint.Customizations{}, distro.ImageOptions{}, rng)
require.NoError(t, err)

bootSize, err := pt.GetMountpointSize("/boot")
Expand Down

0 comments on commit c47e5c9

Please sign in to comment.