RHEL-90: replace ec2X86_64BaseTreePipeline by osPipeline

Move the x86_64 specific configuration from `ec2X86_64BaseTreePipeline`
to x86_64-specific image configurations for EC2 / AMI images. As a
result, remove the `ec2X86_64BaseTreePipeline` entirely and replace it
with `osPipeline`.

Regenerate image test cases. While there are changed in the manifests,
the actual image configuration didn't change at all and thus the
`image-info` report was not changed.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
This commit is contained in:
Tomas Hozza 2021-12-17 12:28:57 +01:00 committed by Tomáš Hozza
parent 776de86e6d
commit 43ea54f8de
6 changed files with 72 additions and 96 deletions

View file

@ -808,7 +808,7 @@ func newDistro(distroName string) distro.Distro {
basePartitionTables: defaultBasePartitionTables,
}
// default EC2 images config
// default EC2 images config (common for all architectures)
defaultEc2ImageConfig := &distro.ImageConfig{
Timezone: "UTC",
TimeSynchronization: &osbuild.ChronyStageOptions{
@ -947,6 +947,22 @@ func newDistro(distroName string) distro.Distro {
},
}
// default EC2 images config (x86_64)
defaultEc2ImageConfigX86_64 := &distro.ImageConfig{
DracutConf: append(defaultEc2ImageConfig.DracutConf,
&osbuild.DracutConfStageOptions{
Filename: "ec2.conf",
Config: osbuild.DracutConfigFile{
AddDrivers: []string{
"nvme",
"xen-blkfront",
},
},
}),
}
defaultEc2ImageConfigX86_64 = defaultEc2ImageConfigX86_64.InheritFrom(defaultEc2ImageConfig)
// default AMI (EC2 BYOS) images config
defaultAMIImageConfig := &distro.ImageConfig{
RHSMConfig: map[distro.RHSMSubscriptionStatus]*osbuild.RHSMStageOptions{
distro.RHSMConfigNoSubscription: {
@ -976,6 +992,7 @@ func newDistro(distroName string) distro.Distro {
},
},
}
defaultAMIImageConfigX86_64 := defaultAMIImageConfig.InheritFrom(defaultEc2ImageConfigX86_64)
defaultAMIImageConfig = defaultAMIImageConfig.InheritFrom(defaultEc2ImageConfig)
amiImgTypeX86_64 := imageType{
@ -986,7 +1003,7 @@ func newDistro(distroName string) distro.Distro {
buildPkgsKey: ec2BuildPackageSet,
osPkgsKey: ec2CommonPackageSet,
},
defaultImageConfig: defaultAMIImageConfig,
defaultImageConfig: defaultAMIImageConfigX86_64,
kernelOptions: "console=ttyS0,115200n8 console=tty0 net.ifnames=0 rd.blacklist=nouveau nvme_core.io_timeout=4294967295 crashkernel=auto",
bootable: true,
bootType: distro.LegacyBootType,
@ -1025,7 +1042,7 @@ func newDistro(distroName string) distro.Distro {
buildPkgsKey: ec2BuildPackageSet,
osPkgsKey: rhelEc2PackageSet,
},
defaultImageConfig: defaultEc2ImageConfig,
defaultImageConfig: defaultEc2ImageConfigX86_64,
kernelOptions: "console=ttyS0,115200n8 console=tty0 net.ifnames=0 rd.blacklist=nouveau nvme_core.io_timeout=4294967295 crashkernel=auto",
bootable: true,
bootType: distro.LegacyBootType,
@ -1064,7 +1081,7 @@ func newDistro(distroName string) distro.Distro {
buildPkgsKey: ec2BuildPackageSet,
osPkgsKey: rhelEc2HaPackageSet,
},
defaultImageConfig: defaultEc2ImageConfig,
defaultImageConfig: defaultEc2ImageConfigX86_64,
kernelOptions: "console=ttyS0,115200n8 console=tty0 net.ifnames=0 rd.blacklist=nouveau nvme_core.io_timeout=4294967295 crashkernel=auto",
bootable: true,
bootType: distro.LegacyBootType,
@ -1084,7 +1101,7 @@ func newDistro(distroName string) distro.Distro {
buildPkgsKey: ec2BuildPackageSet,
osPkgsKey: rhelEc2SapPackageSet,
},
defaultImageConfig: defaultEc2ImageConfig,
defaultImageConfig: defaultEc2ImageConfigX86_64,
kernelOptions: "console=ttyS0,115200n8 console=tty0 net.ifnames=0 rd.blacklist=nouveau nvme_core.io_timeout=4294967295 crashkernel=auto processor.max_cstate=1 intel_idle.max_cstate=1",
bootable: true,
bootType: distro.LegacyBootType,

View file

@ -144,30 +144,6 @@ func openstackPipelines(t *imageType, customizations *blueprint.Customizations,
return pipelines, nil
}
func ec2X86_64BaseTreePipeline(t *imageType, repos []rpmmd.RepoConfig, packages []rpmmd.PackageSpec, bpPackages []rpmmd.PackageSpec,
c *blueprint.Customizations, options distro.ImageOptions, pt *disk.PartitionTable) (*osbuild.Pipeline, error) {
treePipeline, err := osPipeline(t, repos, packages, bpPackages, c, options, pt)
if err != nil {
return nil, err
}
// EC2 x86_64-specific stages
// Add 'nvme' driver to handle the case when initramfs is getting forcefully
// rebuild on a Xen instance (and not able to boot on Nitro after that).
treePipeline.AddStage(osbuild.NewDracutConfStage(&osbuild.DracutConfStageOptions{
Filename: "ec2.conf",
Config: osbuild.DracutConfigFile{
AddDrivers: []string{
"nvme",
"xen-blkfront",
},
},
}))
return treePipeline, nil
}
func ec2CommonPipelines(t *imageType, customizations *blueprint.Customizations, options distro.ImageOptions,
repos []rpmmd.RepoConfig, packageSetSpecs map[string][]rpmmd.PackageSpec,
rng *rand.Rand, diskfile string) ([]osbuild.Pipeline, error) {
@ -179,17 +155,7 @@ func ec2CommonPipelines(t *imageType, customizations *blueprint.Customizations,
return nil, err
}
var treePipeline *osbuild.Pipeline
switch arch := t.arch.Name(); arch {
// rhel-ec2-x86_64, rhel-ha-ec2
case distro.X86_64ArchName:
treePipeline, err = ec2X86_64BaseTreePipeline(t, repos, packageSetSpecs[osPkgsKey], packageSetSpecs[blueprintPkgsKey], customizations, options, &partitionTable)
// rhel-ec2-aarch64
case distro.Aarch64ArchName:
treePipeline, err = osPipeline(t, repos, packageSetSpecs[osPkgsKey], packageSetSpecs[blueprintPkgsKey], customizations, options, &partitionTable)
default:
return nil, fmt.Errorf("ec2CommonPipelines: unsupported image architecture: %q", arch)
}
treePipeline, err := osPipeline(t, repos, packageSetSpecs[osPkgsKey], packageSetSpecs[blueprintPkgsKey], customizations, options, &partitionTable)
if err != nil {
return nil, err
}
@ -218,14 +184,7 @@ func ec2SapPipelines(t *imageType, customizations *blueprint.Customizations, opt
return nil, err
}
var treePipeline *osbuild.Pipeline
switch arch := t.arch.Name(); arch {
// rhel-sap-ec2
case distro.X86_64ArchName:
treePipeline, err = ec2X86_64BaseTreePipeline(t, repos, packageSetSpecs[osPkgsKey], packageSetSpecs[blueprintPkgsKey], customizations, options, &partitionTable)
default:
return nil, fmt.Errorf("ec2SapPipelines: unsupported image architecture: %q", arch)
}
treePipeline, err := osPipeline(t, repos, packageSetSpecs[osPkgsKey], packageSetSpecs[blueprintPkgsKey], customizations, options, &partitionTable)
if err != nil {
return nil, err
}

View file

@ -942,6 +942,18 @@
}
}
},
{
"type": "org.osbuild.dracut.conf",
"options": {
"filename": "ec2.conf",
"config": {
"add_drivers": [
"nvme",
"xen-blkfront"
]
}
}
},
{
"type": "org.osbuild.systemd.unit",
"options": {
@ -960,18 +972,6 @@
"profile": "sssd"
}
},
{
"type": "org.osbuild.dracut.conf",
"options": {
"filename": "ec2.conf",
"config": {
"add_drivers": [
"nvme",
"xen-blkfront"
]
}
}
},
{
"type": "org.osbuild.fstab",
"options": {

View file

@ -958,6 +958,18 @@
}
}
},
{
"type": "org.osbuild.dracut.conf",
"options": {
"filename": "ec2.conf",
"config": {
"add_drivers": [
"nvme",
"xen-blkfront"
]
}
}
},
{
"type": "org.osbuild.systemd.unit",
"options": {
@ -976,18 +988,6 @@
"profile": "sssd"
}
},
{
"type": "org.osbuild.dracut.conf",
"options": {
"filename": "ec2.conf",
"config": {
"add_drivers": [
"nvme",
"xen-blkfront"
]
}
}
},
{
"type": "org.osbuild.fstab",
"options": {

View file

@ -1152,6 +1152,18 @@
}
}
},
{
"type": "org.osbuild.dracut.conf",
"options": {
"filename": "ec2.conf",
"config": {
"add_drivers": [
"nvme",
"xen-blkfront"
]
}
}
},
{
"type": "org.osbuild.systemd.unit",
"options": {
@ -1170,18 +1182,6 @@
"profile": "sssd"
}
},
{
"type": "org.osbuild.dracut.conf",
"options": {
"filename": "ec2.conf",
"config": {
"add_drivers": [
"nvme",
"xen-blkfront"
]
}
}
},
{
"type": "org.osbuild.fstab",
"options": {

View file

@ -1206,6 +1206,18 @@
}
}
},
{
"type": "org.osbuild.dracut.conf",
"options": {
"filename": "ec2.conf",
"config": {
"add_drivers": [
"nvme",
"xen-blkfront"
]
}
}
},
{
"type": "org.osbuild.systemd.unit",
"options": {
@ -1224,18 +1236,6 @@
"profile": "sssd"
}
},
{
"type": "org.osbuild.dracut.conf",
"options": {
"filename": "ec2.conf",
"config": {
"add_drivers": [
"nvme",
"xen-blkfront"
]
}
}
},
{
"type": "org.osbuild.selinux.config",
"options": {