distro: move RequiredPartitionSizes into ImageType

It used to be defined on ImageOptions, but ImageType is a better fit for
this.
This commit is contained in:
Simon de Vlieger 2023-03-15 11:16:49 +01:00 committed by Ondřej Budai
parent 34f7f6c7e2
commit 7e93df725c
3 changed files with 16 additions and 19 deletions

View file

@ -125,11 +125,10 @@ type ImageType interface {
// The ImageOptions specify options for a specific image build
type ImageOptions struct {
Size uint64
OSTree OSTreeImageOptions
Subscription *SubscriptionImageOptions
Facts *FactsImageOptions
RequiredSizes map[string]uint64
Size uint64
OSTree OSTreeImageOptions
Subscription *SubscriptionImageOptions
Facts *FactsImageOptions
}
// The OSTreeImageOptions specify an ostree ref, checksum, URL, ContentURL, and RHSM. The meaning of

View file

@ -160,14 +160,15 @@ var (
defaultImageConfig: &distro.ImageConfig{
Locale: common.ToPtr("en_US.UTF-8"),
},
defaultSize: 4 * common.GibiByte,
rpmOstree: true,
bootable: true,
image: iotRawImage,
buildPipelines: []string{"build"},
payloadPipelines: []string{"image-tree", "image", "xz"},
exports: []string{"xz"},
basePartitionTables: iotBasePartitionTables,
defaultSize: 4 * common.GibiByte,
rpmOstree: true,
bootable: true,
image: iotRawImage,
buildPipelines: []string{"build"},
payloadPipelines: []string{"image-tree", "image", "xz"},
exports: []string{"xz"},
basePartitionTables: iotBasePartitionTables,
requiredPartitionSizes: map[string]uint64{},
}
qcow2ImgType = imageType{
@ -511,7 +512,8 @@ type imageType struct {
// bootable image
bootable bool
// List of valid arches for the image type
basePartitionTables distro.BasePartitionTableMap
basePartitionTables distro.BasePartitionTableMap
requiredPartitionSizes map[string]uint64
}
func (t *imageType) Name() string {
@ -653,7 +655,7 @@ func (t *imageType) getPartitionTable(
lvmify := !t.rpmOstree
return disk.NewPartitionTable(&basePartitionTable, mountpoints, imageSize, lvmify, options.RequiredSizes, rng)
return disk.NewPartitionTable(&basePartitionTable, mountpoints, imageSize, lvmify, t.requiredPartitionSizes, rng)
}
func (t *imageType) getDefaultImageConfig() *distro.ImageConfig {

View file

@ -402,10 +402,6 @@ func iotRawImage(workload workload.Workload,
}
img.OSName = "fedora-iot"
// the iot raw image is laid out quite specifically, so we set no constraints; this means the
// default constraints don't apply either
options.RequiredSizes = map[string]uint64{}
// TODO: move generation into LiveImage
pt, err := t.getPartitionTable(customizations.GetFilesystems(), options, rng)
if err != nil {