osbuild2: support for the new vpc options in the qemu stage

Recently osbuild exposed the low level qemu options for the VPC
format. Add support for the `force_size` option.
This commit is contained in:
Christian Kellner 2022-06-14 22:19:30 +02:00
parent 5082c36ca5
commit 42038ad47b
2 changed files with 18 additions and 0 deletions

View file

@ -85,6 +85,9 @@ func (o VDIOptions) formatType() QEMUFormat {
type VPCOptions struct {
// The type of the format must be 'vpc'
Type QEMUFormat `json:"type"`
// VPC related options
ForceSize *bool `json:"force_size,omitempty"`
}
func (VPCOptions) isQEMUFormatOptions() {}

View file

@ -4,6 +4,7 @@ import (
"fmt"
"testing"
"github.com/osbuild/osbuild-composer/internal/common"
"github.com/stretchr/testify/assert"
)
@ -133,6 +134,20 @@ func TestNewQEMUStageOptions(t *testing.T) {
},
},
},
{
Filename: "image.vpc",
Format: QEMUFormatVPC,
FormatOptions: VPCOptions{
ForceSize: common.BoolToPtr(false),
},
ExpectedOptions: &QEMUStageOptions{
Filename: "image.vpc",
Format: VPCOptions{
Type: QEMUFormatVPC,
ForceSize: common.BoolToPtr(false),
},
},
},
{
Filename: "image.vmdk",
Format: QEMUFormatVMDK,