cloudapi: drop ImageRequest.GetImageOptions() method
This method is not particularly useful anymore. Its purpose was to initialise the ImageOptions from an ImageRequest with the appropriate size and partitioning mode. However, the partitioning mode was also being set later using request.GetPartitioningMode(). More importantly, setting the size on the ImageOptions caused issues with the interaction between filesystem and partitioning customizations as well as the image request size (see #4705). The correct thing to do here is to map the ImageRequest.Size directly onto ImageOptions.Size, without taking into account ImageType or the Blueprint Customizations. The rest are considered when generating the manifest in images, either when preparing the Manifest() call or when generating the partition table. This makes it easier to trace and reason about the effect of each option. This kind of decision making in the API layer makes it difficult to maintain the logic, since it requires duplicating the decision making or, as we had now, making certain specific combinations impossible.
This commit is contained in:
parent
c587e723a9
commit
e621386caf
3 changed files with 8 additions and 104 deletions
|
|
@ -14,6 +14,7 @@ import (
|
|||
"github.com/osbuild/images/pkg/customizations/subscription"
|
||||
"github.com/osbuild/images/pkg/datasizes"
|
||||
"github.com/osbuild/images/pkg/disk"
|
||||
"github.com/osbuild/images/pkg/distro"
|
||||
"github.com/osbuild/images/pkg/distrofactory"
|
||||
"github.com/osbuild/images/pkg/reporegistry"
|
||||
"github.com/osbuild/images/pkg/rhsm/facts"
|
||||
|
|
@ -1251,8 +1252,13 @@ func (request *ComposeRequest) GetImageRequests(distroFactory *distrofactory.Fac
|
|||
repos = append(repos, dr...)
|
||||
}
|
||||
|
||||
// Get the initial ImageOptions with image size set
|
||||
imageOptions := ir.GetImageOptions(imageType, bp)
|
||||
// Initialise the image options from the image request and
|
||||
// customizations
|
||||
imageOptions := distro.ImageOptions{}
|
||||
|
||||
if ir.Size != nil {
|
||||
imageOptions.Size = *ir.Size
|
||||
}
|
||||
|
||||
if request.Koji == nil {
|
||||
imageOptions.Facts = &facts.ImageOptions{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue