cloudapi: Add partitioning_mode support to the API
This adds a 'partitioning_mode' field that can be set to 'auto-lvm', 'lvm' or 'raw'. It defaults to 'auto-lvm'.
This commit is contained in:
parent
3df67e9adb
commit
d0877e68dc
7 changed files with 231 additions and 148 deletions
|
|
@ -5,6 +5,7 @@ import (
|
|||
"fmt"
|
||||
"reflect"
|
||||
|
||||
"github.com/osbuild/images/pkg/disk"
|
||||
"github.com/osbuild/images/pkg/subscription"
|
||||
"github.com/osbuild/osbuild-composer/internal/blueprint"
|
||||
)
|
||||
|
|
@ -424,3 +425,22 @@ func (request *ComposeRequest) GetSubscription() (sub *subscription.ImageOptions
|
|||
|
||||
return
|
||||
}
|
||||
|
||||
// GetPartitioningMode returns the partitioning mode included in the request
|
||||
// or defaults to AutoLVMPartitioningMode if not included
|
||||
func (request *ComposeRequest) GetPartitioningMode() (disk.PartitioningMode, error) {
|
||||
if request.Customizations == nil || request.Customizations.PartitioningMode == nil {
|
||||
return disk.AutoLVMPartitioningMode, nil
|
||||
}
|
||||
|
||||
switch *request.Customizations.PartitioningMode {
|
||||
case CustomizationsPartitioningModeRaw:
|
||||
return disk.RawPartitioningMode, nil
|
||||
case CustomizationsPartitioningModeLvm:
|
||||
return disk.LVMPartitioningMode, nil
|
||||
case CustomizationsPartitioningModeAutoLvm:
|
||||
return disk.AutoLVMPartitioningMode, nil
|
||||
}
|
||||
|
||||
return disk.AutoLVMPartitioningMode, HTTPError(ErrorInvalidPartitioningMode)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue