cloudapi: Add optional image size support
This adds a 'size' parameter to the image_request object. It can be used to specify the minimum image size in bytes This behaves in the same way as the size parameter of the weldr API For raw images the root partition is grown to fill the available space. For LVM images the PV uses the available space, but the LV does not, leaving space available for other LVs to be created after boot. See COMPOSER-1883
This commit is contained in:
parent
8e29448044
commit
818d434303
3 changed files with 156 additions and 129 deletions
|
|
@ -447,7 +447,20 @@ func (h *apiHandlers) PostCompose(ctx echo.Context) error {
|
|||
return err
|
||||
}
|
||||
|
||||
imageOptions := distro.ImageOptions{Size: imageType.Size(0)}
|
||||
// check if filesytem customizations have been set.
|
||||
// if compose size parameter is set, take the larger of
|
||||
// the two values.
|
||||
// NOTE: The size is in bytes
|
||||
var size uint64
|
||||
minSize := bp.Customizations.GetFilesystemsMinSize()
|
||||
if ir.Size == nil {
|
||||
size = imageType.Size(minSize)
|
||||
} else if bp.Customizations != nil && minSize > 0 && minSize > *ir.Size {
|
||||
size = imageType.Size(minSize)
|
||||
} else {
|
||||
size = imageType.Size(*ir.Size)
|
||||
}
|
||||
imageOptions := distro.ImageOptions{Size: size}
|
||||
|
||||
if request.Koji == nil {
|
||||
imageOptions.Facts = &facts.ImageOptions{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue