Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion data/dependencies/deps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ import (
)

func TestMinimumOSBuildVersion(t *testing.T) {
assert.Equal(t, "183", dependencies.MinimumOSBuildVersion())
assert.Equal(t, "185", dependencies.MinimumOSBuildVersion())
}
2 changes: 1 addition & 1 deletion data/dependencies/osbuild
Original file line number Diff line number Diff line change
@@ -1 +1 @@
183
185
7 changes: 7 additions & 0 deletions data/distrodefs/eln-11/disk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,13 @@ image_types:
platforms:
- <<: *x86_64_bios_platform
image_format: "ova"
disk_config:
ovf_vmware:
# Ideally we would use rhel10_64Guest, but this requires vmx-22 (vcenter 9+). And many users
# are trying to use vcenter 8 for as long as possible. If this should change at some point
# in future, it should become part of the blueprint.
os_type: "rhel9_64Guest"
virtual_hardware_version: "vmx-21"
blueprint:
supported_options: *supported_options_disk

Expand Down
4 changes: 4 additions & 0 deletions data/distrodefs/fedora/imagetypes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1538,6 +1538,10 @@ image_types:
name_aliases: ["ova", "vsphere-ova"]
filename: "image.ova"
mime_type: "application/ovf"
disk_config:
ovf_vmware:
os_type: "fedora64Guest"
virtual_hardware_version: "vmx-21"
exports: ["archive"]
platforms:
- <<: *x86_64_bios_platform
Expand Down
7 changes: 7 additions & 0 deletions data/distrodefs/rhel-10/imagetypes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1526,6 +1526,13 @@ image_types:
platforms:
- <<: *x86_64_bios_platform
image_format: "ova"
disk_config:
ovf_vmware:
# Ideally we would use rhel10_64Guest, but this requires vmx-22 (vcenter 9+). And many users
# are trying to use vcenter 8 for as long as possible. If this should change at some point
# in future, it should become part of the blueprint.
os_type: "rhel9_64Guest"
virtual_hardware_version: "vmx-21"
blueprint:
supported_options: *supported_options_disk

Expand Down
4 changes: 4 additions & 0 deletions data/distrodefs/rhel-8/imagetypes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2473,6 +2473,10 @@ image_types:
platforms:
- <<: *x86_64_bios_platform
image_format: "ova"
disk_config:
ovf_vmware:
os_type: "rhel8_64Guest"
virtual_hardware_version: "vmx-15"
blueprint:
supported_options: *supported_options_disk

Expand Down
4 changes: 4 additions & 0 deletions data/distrodefs/rhel-9/imagetypes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2068,6 +2068,10 @@ image_types:
platforms:
- <<: *x86_64_bios_platform
image_format: "ova"
disk_config:
ovf_vmware:
os_type: "rhel9_64Guest"
virtual_hardware_version: "vmx-18"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, why not "vmx-21", since all rhel9 cases elsewhere use that?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not understand neither 18 nor 21. I would expect all hw versions to match the vSphere version that introduced the official support in the UI except RHEL 10 which is nicely explained in the comment above.

Image

blueprint:
supported_options: *supported_options_disk

Expand Down
2 changes: 2 additions & 0 deletions pkg/distro/disk_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ type DiskConfig struct {

// Mostly for RHEL7 compat though might be purposed in the future
PartitioningTool *osbuild.PartTool `yaml:"partitioning_tool,omitempty"`

OVFVMWare *osbuild.OVFVMWareStageOptions `yaml:"ovf_vmware,omitempty"`
}

// InheritFrom inherits unset values from the provided parent configuration and
Expand Down
3 changes: 3 additions & 0 deletions pkg/distro/generic/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,9 @@ func diskCustomizations(t *imageType) (manifest.DiskCustomizations, error) {
if diskConfig.PartitioningTool != nil {
diskCust.PartitioningTool = *diskConfig.PartitioningTool
}
if diskConfig.OVFVMWare != nil {
diskCust.OVFVMWare = *diskConfig.OVFVMWare
}
}

return diskCust, nil
Expand Down
2 changes: 2 additions & 0 deletions pkg/image/disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ func (img *DiskImage) InstantiateManifest(m *manifest.Manifest,
case platform.FORMAT_OVA:
vmdkPipeline := manifest.NewVMDK(buildPipeline, rawImagePipeline)
ovfPipeline := manifest.NewOVF(buildPipeline, vmdkPipeline)
ovfPipeline.VMWareOSType = img.DiskCustomizations.OVFVMWare.OSType
ovfPipeline.VMWareVirtualHardwareVersion = img.DiskCustomizations.OVFVMWare.VirtualHardwareVersion
tarPipeline := manifest.NewTar(buildPipeline, ovfPipeline, "archive")
tarPipeline.Format = osbuild.TarArchiveFormatUstar
tarPipeline.SetFilename(img.filename)
Expand Down
2 changes: 2 additions & 0 deletions pkg/manifest/disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ type DiskCustomizations struct {

// Which partitioning tooling is used to create the disk image(s)
PartitioningTool osbuild.PartTool

OVFVMWare osbuild.OVFVMWareStageOptions
}

func NewDiskCustomizations() DiskCustomizations {
Expand Down
14 changes: 12 additions & 2 deletions pkg/manifest/ovf.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ type OVF struct {
Base

imgPipeline *VMDK

VMWareOSType string
VMWareVirtualHardwareVersion string
}

// NewOVF creates a new OVF pipeline. imgPipeline is the pipeline producing the vmdk image.
Expand Down Expand Up @@ -47,9 +50,16 @@ func (p *OVF) serialize() (osbuild.Pipeline, error) {
osbuild.NewPipelineTreeInputs(inputName, p.imgPipeline.Name()),
))

pipeline.AddStage(osbuild.NewOVFStage(&osbuild.OVFStageOptions{
options := &osbuild.OVFStageOptions{
Vmdk: p.imgPipeline.Filename(),
}))
}
if p.VMWareOSType != "" || p.VMWareVirtualHardwareVersion != "" {
options.VMWare = &osbuild.OVFVMWareStageOptions{
OSType: p.VMWareOSType,
VirtualHardwareVersion: p.VMWareVirtualHardwareVersion,
}
}
pipeline.AddStage(osbuild.NewOVFStage(options))

return pipeline, nil
}
Expand Down
11 changes: 10 additions & 1 deletion pkg/osbuild/ovf_stage.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
)

const vmdkRegex = "^[a-zA-Z0-9+_.-]*$"
const vhwvRegex = "^vmx-[0-9]+$"

type OVFStageOptions struct {
Vmdk string `json:"vmdk"`
Expand All @@ -14,7 +15,8 @@ type OVFStageOptions struct {
}

type OVFVMWareStageOptions struct {
OSType string `json:"os_type,omitempty"`
OSType string `json:"os_type,omitempty" yaml:"os_type,omitempty"`
VirtualHardwareVersion string `json:"virtual_hardware_version,omitempty" yaml:"virtual_hardware_version,omitempty"`
}

type OVFVirtualBoxStageOptions struct {
Expand All @@ -33,6 +35,13 @@ func (o OVFStageOptions) validate() error {
return fmt.Errorf("'vmdk' name %q doesn't conform to schema (%s)", o.Vmdk, exp.String())
}

if o.VMWare != nil && o.VMWare.VirtualHardwareVersion != "" {
exp = regexp.MustCompile(vhwvRegex)
if !exp.MatchString(o.VMWare.VirtualHardwareVersion) {
return fmt.Errorf("'vmdk' name %q doesn't conform to schema (%s)", o.Vmdk, exp.String())
}
}

return nil
}

Expand Down
2 changes: 1 addition & 1 deletion test/data/manifest-checksums/centos_10-x86_64-ova-empty

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/data/manifest-checksums/centos_9-x86_64-ova-empty

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/data/manifest-checksums/eln_11-x86_64-ova-empty

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/data/manifest-checksums/rhel_10.0-x86_64-ova-empty

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/data/manifest-checksums/rhel_10.2-x86_64-ova-empty

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/data/manifest-checksums/rhel_10.3-x86_64-ova-empty

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/data/manifest-checksums/rhel_8.10-x86_64-ova-empty

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/data/manifest-checksums/rhel_8.4-x86_64-ova-empty

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/data/manifest-checksums/rhel_8.6-x86_64-ova-empty

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/data/manifest-checksums/rhel_8.8-x86_64-ova-empty

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/data/manifest-checksums/rhel_9.0-x86_64-ova-empty

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/data/manifest-checksums/rhel_9.2-x86_64-ova-empty

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/data/manifest-checksums/rhel_9.4-x86_64-ova-empty

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/data/manifest-checksums/rhel_9.6-x86_64-ova-empty

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/data/manifest-checksums/rhel_9.8-x86_64-ova-empty

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/data/manifest-checksums/rhel_9.9-x86_64-ova-empty

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading