osbuild2: add QEMU format options for vdi and vhdx
Although these format types are not used by any of the image definitions at this moment, add them since they are supported by the osbuild stage.
This commit is contained in:
parent
8697713ce8
commit
f5d70d6b58
2 changed files with 34 additions and 0 deletions
|
|
@ -52,6 +52,20 @@ func (o QCOW2Options) validate() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
type VDIOptions struct {
|
||||
// The type of the format must be 'vdi'
|
||||
Type QEMUFormat `json:"type"`
|
||||
}
|
||||
|
||||
func (VDIOptions) isQEMUFormatOptions() {}
|
||||
|
||||
func (o VDIOptions) validate() error {
|
||||
if o.Type != QEMUFormatVDI {
|
||||
return fmt.Errorf("invalid format type %q for %q options", o.Type, QEMUFormatVDI)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type VPCOptions struct {
|
||||
// The type of the format must be 'vpc'
|
||||
Type QEMUFormat `json:"type"`
|
||||
|
|
@ -80,6 +94,20 @@ func (o VMDKOptions) validate() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
type VHDXOptions struct {
|
||||
// The type of the format must be 'vhdx'
|
||||
Type QEMUFormat `json:"type"`
|
||||
}
|
||||
|
||||
func (VHDXOptions) isQEMUFormatOptions() {}
|
||||
|
||||
func (o VHDXOptions) validate() error {
|
||||
if o.Type != QEMUFormatVHDX {
|
||||
return fmt.Errorf("invalid format type %q for %q options", o.Type, QEMUFormatVHDX)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type QEMUStageInputs struct {
|
||||
Image *QEMUStageInput `json:"image"`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,12 +13,18 @@ func TestNewQemuStage(t *testing.T) {
|
|||
Type: QEMUFormatQCOW2,
|
||||
Compat: "0.10",
|
||||
},
|
||||
VDIOptions{
|
||||
Type: QEMUFormatVDI,
|
||||
},
|
||||
VPCOptions{
|
||||
Type: QEMUFormatVPC,
|
||||
},
|
||||
VMDKOptions{
|
||||
Type: QEMUFormatVMDK,
|
||||
},
|
||||
VHDXOptions{
|
||||
Type: QEMUFormatVHDX,
|
||||
},
|
||||
}
|
||||
|
||||
input := new(QEMUStageInput)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue