manifest: support specifying force_size for VPC

The RHEL 7 vpc subformat in qemu does not support force_size so we need
to be able to disable it.  The parameter in all parts is defined as a
pointer because the default value is 'true'.  Not specifying it will
keep the option in the osbuild stage as 'nil', falling back to 'true' in
osbuild.
This commit is contained in:
Achilleas Koutsou 2023-01-24 18:34:39 +01:00 committed by Tomáš Hozza
parent b39d802155
commit 822571e28e
3 changed files with 11 additions and 3 deletions

View file

@ -4,6 +4,7 @@ import (
"math/rand"
"github.com/osbuild/osbuild-composer/internal/blueprint"
"github.com/osbuild/osbuild-composer/internal/common"
"github.com/osbuild/osbuild-composer/internal/container"
"github.com/osbuild/osbuild-composer/internal/distro"
"github.com/osbuild/osbuild-composer/internal/image"
@ -181,8 +182,9 @@ func liveImage(workload workload.Workload,
img.Environment = t.environment
img.Workload = workload
img.Compression = t.compression
img.PartTool = osbuild.PTSgdisk // all RHEL 7 images should use sgdisk
img.NoBLS = true // RHEL 7 grub does not support BLS
img.PartTool = osbuild.PTSgdisk // all RHEL 7 images should use sgdisk
img.ForceSize = common.ToPtr(false) // RHEL 7 qemu vpc subformat does not support force_size
img.NoBLS = true // RHEL 7 grub does not support BLS
img.OSProduct = t.arch.distro.product
img.OSVersion = t.arch.distro.osVersion
img.OSNick = t.arch.distro.nick

View file

@ -25,6 +25,7 @@ type LiveImage struct {
Workload workload.Workload
Filename string
Compression string
ForceSize *bool
PartTool osbuild.PartTool
NoBLS bool
@ -82,6 +83,7 @@ func (img *LiveImage) InstantiateManifest(m *manifest.Manifest,
if img.Compression == "" {
vpcPipeline.Filename = img.Filename
}
vpcPipeline.ForceSize = img.ForceSize
artifactPipeline = vpcPipeline
artifact = vpcPipeline.Export()
case platform.FORMAT_VMDK:

View file

@ -10,6 +10,8 @@ type VPC struct {
Base
Filename string
ForceSize *bool
imgPipeline *RawImage
}
@ -35,8 +37,10 @@ func NewVPC(m *Manifest,
func (p *VPC) serialize() osbuild.Pipeline {
pipeline := p.Base.serialize()
formatOptions := osbuild.VPCOptions{ForceSize: p.ForceSize}
pipeline.AddStage(osbuild.NewQEMUStage(
osbuild.NewQEMUStageOptions(p.Filename, osbuild.QEMUFormatVPC, nil),
osbuild.NewQEMUStageOptions(p.Filename, osbuild.QEMUFormatVPC, formatOptions),
osbuild.NewQemuStagePipelineFilesInputs(p.imgPipeline.Name(), p.imgPipeline.Filename),
))