From 01184f43a0d38457de3c285d2c6408b6a5fd9a00 Mon Sep 17 00:00:00 2001 From: Achilleas Koutsou Date: Fri, 26 Nov 2021 16:38:52 +0100 Subject: [PATCH] distro/rhel90: assign random volid for efiboot.img --- internal/distro/rhel90/pipelines.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/internal/distro/rhel90/pipelines.go b/internal/distro/rhel90/pipelines.go index a95439b81..47fa54a02 100644 --- a/internal/distro/rhel90/pipelines.go +++ b/internal/distro/rhel90/pipelines.go @@ -1073,7 +1073,10 @@ func edgeSimplifiedInstallerPipelines(t *imageType, customizations *blueprint.Cu installerTreePipeline := simplifiedInstallerTreePipeline(repos, installerPackages, kernelVer, archName, d.product, d.osVersion, "edge") isolabel := fmt.Sprintf(d.isolabelTmpl, archName) efibootTreePipeline := simplifiedInstallerEFIBootTreePipeline(installDevice, kernelVer, archName, d.vendor, d.product, d.osVersion, isolabel) - bootISOTreePipeline := simplifiedInstallerBootISOTreePipeline(imgPipelineName, kernelVer) + bootISOTreePipeline, err := simplifiedInstallerBootISOTreePipeline(imgPipelineName, kernelVer, rng) + if err != nil { + return nil, err + } pipelines = append(pipelines, *installerTreePipeline, *efibootTreePipeline, *bootISOTreePipeline) pipelines = append(pipelines, *bootISOPipeline(t.Filename(), d.isolabelTmpl, t.Arch().Name(), false)) @@ -1081,7 +1084,7 @@ func edgeSimplifiedInstallerPipelines(t *imageType, customizations *blueprint.Cu return pipelines, nil } -func simplifiedInstallerBootISOTreePipeline(archivePipelineName, kver string) *osbuild.Pipeline { +func simplifiedInstallerBootISOTreePipeline(archivePipelineName, kver string, rng *rand.Rand) (*osbuild.Pipeline, error) { p := new(osbuild.Pipeline) p.Name = "bootiso-tree" p.Build = "name:build" @@ -1112,6 +1115,11 @@ func simplifiedInstallerBootISOTreePipeline(archivePipelineName, kver string) *o )) var sectorSize uint64 = 512 + // TODO: handle error + volid, err := disk.NewRandomVolIDFromReader(rng) + if err != nil { + return nil, err + } pt := disk.PartitionTable{ Size: 20971520, Partitions: []disk.Partition{ @@ -1121,6 +1129,7 @@ func simplifiedInstallerBootISOTreePipeline(archivePipelineName, kver string) *o Filesystem: &disk.Filesystem{ Type: "vfat", Mountpoint: "/", + UUID: volid, }, }, }, @@ -1171,7 +1180,7 @@ func simplifiedInstallerBootISOTreePipeline(archivePipelineName, kver string) *o copyInputs, )) - return p + return p, nil } func simplifiedInstallerEFIBootTreePipeline(installDevice, kernelVer, arch, vendor, product, osVersion, isolabel string) *osbuild.Pipeline {