Skip to content

Commit

Permalink
RHEL-10: add internal-only ec2-sap image type
Browse files Browse the repository at this point in the history
Signed-off-by: Tomáš Hozza <[email protected]>
  • Loading branch information
thozza authored and achilleas-k committed Nov 28, 2024
1 parent 7cc38b9 commit c211c9d
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 2 deletions.
34 changes: 34 additions & 0 deletions pkg/distro/rhel/rhel10/ami.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,37 @@ func mkEc2HaImgTypeX86_64() *rhel.ImageType {
return it
}

func mkEC2SapImgTypeX86_64(osVersion string) *rhel.ImageType {
it := rhel.NewImageType(
"ec2-sap",
"image.raw.xz",
"application/xz",
map[string]rhel.PackageSetFunc{
rhel.OSPkgsKey: rhelEc2SapPackageSet,
},
rhel.DiskImage,
[]string{"build"},
[]string{"os", "image", "xz"},
[]string{"xz"},
)

it.Compression = "xz"
it.KernelOptions = amiSapKernelOptions
it.Bootable = true
it.DefaultSize = 10 * datasizes.GibiByte
it.DefaultImageConfig = sapImageConfig(osVersion).InheritFrom(defaultEc2ImageConfigX86_64())
it.BasePartitionTables = defaultBasePartitionTables

return it
}

// IMAGE CONFIG

// TODO: move these to the EC2 environment
const (
amiKernelOptions = "console=tty0 console=ttyS0,115200n8 nvme_core.io_timeout=4294967295"
amiAarch64KernelOptions = amiKernelOptions + " iommu.strict=0"
amiSapKernelOptions = amiKernelOptions + " processor.max_cstate=1 intel_idle.max_cstate=1"
)

// default EC2 images config (common for all architectures)
Expand Down Expand Up @@ -336,3 +361,12 @@ func rhelEc2HaPackageSet(t *rhel.ImageType) rpmmd.PackageSet {
})
return ec2HaPackageSet
}

// rhel-sap-ec2 image package set
func rhelEc2SapPackageSet(t *rhel.ImageType) rpmmd.PackageSet {
return rpmmd.PackageSet{
Include: []string{
//"libcanberra-gtk2", // libcanberra-gtk2 is not available in RHEL-10
},
}.Append(ec2PackageSet(t)).Append(SapPackageSet(t))
}
2 changes: 1 addition & 1 deletion pkg/distro/rhel/rhel10/distro.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ func newDistro(name string, major, minor int) *rhel.Distribution {

x86_64.AddImageTypes(azureX64Platform, mkAzureSapInternalImgType(rd))

x86_64.AddImageTypes(ec2X86Platform, mkEc2ImgTypeX86_64(), mkEc2HaImgTypeX86_64())
x86_64.AddImageTypes(ec2X86Platform, mkEc2ImgTypeX86_64(), mkEc2HaImgTypeX86_64(), mkEC2SapImgTypeX86_64(rd.OsVersion()))
aarch64.AddImageTypes(ec2Aarch64Platform, mkEC2ImgTypeAarch64())
}

Expand Down
1 change: 1 addition & 0 deletions pkg/distro/rhel/rhel10/distro_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ func TestArchitecture_ListImageTypes(t *testing.T) {
"azure-sap-rhui",
"ec2",
"ec2-ha",
"ec2-sap",
},
},
{
Expand Down
3 changes: 2 additions & 1 deletion test/config-map.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
"rhel-8.7",
"rhel-8.8",
"rhel-8.9",
"rhel-9.*"
"rhel-9.*",
"rhel-10.*"
],
"image-types": [
"ec2-sap"
Expand Down

0 comments on commit c211c9d

Please sign in to comment.