diff --git a/data/distrodefs/eln-11/disk.yaml b/data/distrodefs/eln-11/disk.yaml index f7d41cb2d0..ab973cfcc7 100644 --- a/data/distrodefs/eln-11/disk.yaml +++ b/data/distrodefs/eln-11/disk.yaml @@ -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 diff --git a/data/distrodefs/fedora/imagetypes.yaml b/data/distrodefs/fedora/imagetypes.yaml index ae34dcfa8a..d3b8751651 100644 --- a/data/distrodefs/fedora/imagetypes.yaml +++ b/data/distrodefs/fedora/imagetypes.yaml @@ -1566,6 +1566,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 diff --git a/data/distrodefs/rhel-10/imagetypes.yaml b/data/distrodefs/rhel-10/imagetypes.yaml index 89849827dc..09c8bb14f2 100644 --- a/data/distrodefs/rhel-10/imagetypes.yaml +++ b/data/distrodefs/rhel-10/imagetypes.yaml @@ -1556,6 +1556,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 diff --git a/data/distrodefs/rhel-8/imagetypes.yaml b/data/distrodefs/rhel-8/imagetypes.yaml index 9bd4f53c61..39b20c4c44 100644 --- a/data/distrodefs/rhel-8/imagetypes.yaml +++ b/data/distrodefs/rhel-8/imagetypes.yaml @@ -2485,6 +2485,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 diff --git a/data/distrodefs/rhel-9/imagetypes.yaml b/data/distrodefs/rhel-9/imagetypes.yaml index 805434e7f1..2e7cad8b31 100644 --- a/data/distrodefs/rhel-9/imagetypes.yaml +++ b/data/distrodefs/rhel-9/imagetypes.yaml @@ -2098,6 +2098,10 @@ image_types: platforms: - <<: *x86_64_bios_platform image_format: "ova" + disk_config: + ovf_vmware: + os_type: "rhel9_64Guest" + virtual_hardware_version: "vmx-18" blueprint: supported_options: *supported_options_disk diff --git a/pkg/distro/disk_config.go b/pkg/distro/disk_config.go index db3d0665c1..a5bfde35df 100644 --- a/pkg/distro/disk_config.go +++ b/pkg/distro/disk_config.go @@ -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 diff --git a/pkg/distro/generic/images.go b/pkg/distro/generic/images.go index b747adcf04..f4c15c6aa5 100644 --- a/pkg/distro/generic/images.go +++ b/pkg/distro/generic/images.go @@ -670,6 +670,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 diff --git a/pkg/image/disk.go b/pkg/image/disk.go index 87979a018e..a242b3e367 100644 --- a/pkg/image/disk.go +++ b/pkg/image/disk.go @@ -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) diff --git a/pkg/manifest/disk.go b/pkg/manifest/disk.go index 786d9344ec..f7a758d4c0 100644 --- a/pkg/manifest/disk.go +++ b/pkg/manifest/disk.go @@ -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 { diff --git a/pkg/manifest/ovf.go b/pkg/manifest/ovf.go index 19a15c418e..299d026d2e 100644 --- a/pkg/manifest/ovf.go +++ b/pkg/manifest/ovf.go @@ -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. @@ -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 } diff --git a/pkg/osbuild/ovf_stage.go b/pkg/osbuild/ovf_stage.go index 830c4e9452..10d6c5b092 100644 --- a/pkg/osbuild/ovf_stage.go +++ b/pkg/osbuild/ovf_stage.go @@ -6,6 +6,7 @@ import ( ) const vmdkRegex = "^[a-zA-Z0-9+_.-]*$" +const vhwvRegex = "^vmx-[0-9]+$" type OVFStageOptions struct { Vmdk string `json:"vmdk"` @@ -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 { @@ -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 } diff --git a/test/data/manifest-checksums/centos_10-x86_64-ova-empty b/test/data/manifest-checksums/centos_10-x86_64-ova-empty index ab7237fb90..f09b9e1a29 100644 --- a/test/data/manifest-checksums/centos_10-x86_64-ova-empty +++ b/test/data/manifest-checksums/centos_10-x86_64-ova-empty @@ -1 +1 @@ -6f86ff66cb7c32c7b0067d99ff18d309dd64becac1af39bae757a0234381fd9b +70705371e2adf164ac92d6a9ec279c78104d44e3fa8d2c6c5b0c3a6efeda72ff diff --git a/test/data/manifest-checksums/centos_9-x86_64-ova-empty b/test/data/manifest-checksums/centos_9-x86_64-ova-empty index 4db353459a..5790170025 100644 --- a/test/data/manifest-checksums/centos_9-x86_64-ova-empty +++ b/test/data/manifest-checksums/centos_9-x86_64-ova-empty @@ -1 +1 @@ -5fe698363f224ec862f1e02c054a542d02c0909569edbe8471190f7a1c7b732e +8e1267819e2cd26df02c74fc85a38fad31ce9019476147eff924006338b73d57 diff --git a/test/data/manifest-checksums/eln_11-x86_64-ova-empty b/test/data/manifest-checksums/eln_11-x86_64-ova-empty index 69a359053e..5946f92259 100644 --- a/test/data/manifest-checksums/eln_11-x86_64-ova-empty +++ b/test/data/manifest-checksums/eln_11-x86_64-ova-empty @@ -1 +1 @@ -b256a9d581a74e9be0feb882e3b00dfed256367ac1bcf17a907d64d9fc58e98d +169909527eec52cc9e97fce75fd3739293c9e6d1a618be4f9864916621553820 diff --git a/test/data/manifest-checksums/fedora_43-x86_64-generic_ova-empty b/test/data/manifest-checksums/fedora_43-x86_64-generic_ova-empty index 34c83abd7f..b49a9665cb 100644 --- a/test/data/manifest-checksums/fedora_43-x86_64-generic_ova-empty +++ b/test/data/manifest-checksums/fedora_43-x86_64-generic_ova-empty @@ -1 +1 @@ -3d35837c3fb1dde16d9c3ec6f0a1e6756cd662e09d966ad268b1d41e71f2356e +7ef705be7f8ac623a04652291c1bd32b904d90a73cbad0b990aeeef97deae2bd diff --git a/test/data/manifest-checksums/fedora_44-x86_64-generic_ova-empty b/test/data/manifest-checksums/fedora_44-x86_64-generic_ova-empty index 30bbbd1914..9c97e3bd84 100644 --- a/test/data/manifest-checksums/fedora_44-x86_64-generic_ova-empty +++ b/test/data/manifest-checksums/fedora_44-x86_64-generic_ova-empty @@ -1 +1 @@ -30b3faea980337578fd0939e1776f0de18cc27be5d8130dc816ea0df84516018 +e0f6d7f284834a47b707ade09494a9c956ad39d43aba0aa518ae7e9ce1af610f diff --git a/test/data/manifest-checksums/fedora_45-x86_64-generic_ova-empty b/test/data/manifest-checksums/fedora_45-x86_64-generic_ova-empty index 2168913075..6b3f533fda 100644 --- a/test/data/manifest-checksums/fedora_45-x86_64-generic_ova-empty +++ b/test/data/manifest-checksums/fedora_45-x86_64-generic_ova-empty @@ -1 +1 @@ -a0d0752aa5bd20279e4ce64ba353fbe89b857ce547a47601f7e86cfc05073a60 +1fc82e6a21d8481d7436866c6c7aec5412a4e5d653b590d2c6b62a0259bec695 diff --git a/test/data/manifest-checksums/rhel_10.0-x86_64-ova-empty b/test/data/manifest-checksums/rhel_10.0-x86_64-ova-empty index 30c90443c5..c162af228e 100644 --- a/test/data/manifest-checksums/rhel_10.0-x86_64-ova-empty +++ b/test/data/manifest-checksums/rhel_10.0-x86_64-ova-empty @@ -1 +1 @@ -35a0906c98bf0a18416fa9c0be12cad084ae5a92bbf896dfbf4e27008d38a4e9 +70a34166e0dd3ae1da6d3ddcb07b0a11781b5fe65009085d31a32abc47278e1d diff --git a/test/data/manifest-checksums/rhel_10.2-x86_64-ova-empty b/test/data/manifest-checksums/rhel_10.2-x86_64-ova-empty index edfe1df8d2..54511440b9 100644 --- a/test/data/manifest-checksums/rhel_10.2-x86_64-ova-empty +++ b/test/data/manifest-checksums/rhel_10.2-x86_64-ova-empty @@ -1 +1 @@ -63f39beb400ca2e8c24456b9aa28f98b98ba633edb3389ac2aacf20ac60e4733 +969739c9ad637125d12463e6438c2cb047d143d02900dcc1d4ba5234f2bf3cf1 diff --git a/test/data/manifest-checksums/rhel_10.3-x86_64-ova-empty b/test/data/manifest-checksums/rhel_10.3-x86_64-ova-empty index f800fe4527..362f5a274d 100644 --- a/test/data/manifest-checksums/rhel_10.3-x86_64-ova-empty +++ b/test/data/manifest-checksums/rhel_10.3-x86_64-ova-empty @@ -1 +1 @@ -aa5ab75b4da147128dc619245c9e03de7c722df04621fc2227b6f68bab0dedde +0b22f92f7cd17cf266d4578b36eeecd78b48ec6026f2cf9fedb52f2e94aa9723 diff --git a/test/data/manifest-checksums/rhel_8.10-x86_64-ova-empty b/test/data/manifest-checksums/rhel_8.10-x86_64-ova-empty index 0508a9d62b..23af4f4e34 100644 --- a/test/data/manifest-checksums/rhel_8.10-x86_64-ova-empty +++ b/test/data/manifest-checksums/rhel_8.10-x86_64-ova-empty @@ -1 +1 @@ -edb7cf94de958350f3fb31f1949a1fa41a8ddeaa01cc91d797b5cfb8ed37f04b +bc5ca6c32bb265a13f34a2f3c268410faa0cb75a866133c1c4aac8537a84999e diff --git a/test/data/manifest-checksums/rhel_8.4-x86_64-ova-empty b/test/data/manifest-checksums/rhel_8.4-x86_64-ova-empty index e475d61a45..8344f4b97f 100644 --- a/test/data/manifest-checksums/rhel_8.4-x86_64-ova-empty +++ b/test/data/manifest-checksums/rhel_8.4-x86_64-ova-empty @@ -1 +1 @@ -72778bfd95391cf815e88c9d944b6308840dd3680f82f1e6982fd2f33f2b90bd +58d93bba3674e97fb7ed43720a2640fe4cecafcf7aafa14905e96bceec702cda diff --git a/test/data/manifest-checksums/rhel_8.6-x86_64-ova-empty b/test/data/manifest-checksums/rhel_8.6-x86_64-ova-empty index 108fbf193f..90478323d0 100644 --- a/test/data/manifest-checksums/rhel_8.6-x86_64-ova-empty +++ b/test/data/manifest-checksums/rhel_8.6-x86_64-ova-empty @@ -1 +1 @@ -40cad97ec2838ec29b1dc22453a28607d6a33038e8a8124e4f1a53f106f4403e +9a44d4d78aedc69a6f19a1d43191890863baf5a8fc8a08680a85bf1f5987f121 diff --git a/test/data/manifest-checksums/rhel_8.8-x86_64-ova-empty b/test/data/manifest-checksums/rhel_8.8-x86_64-ova-empty index eff45f53fc..e5e14c2470 100644 --- a/test/data/manifest-checksums/rhel_8.8-x86_64-ova-empty +++ b/test/data/manifest-checksums/rhel_8.8-x86_64-ova-empty @@ -1 +1 @@ -88ab8730ec73a8f8cd84f85c4402770a040321bcf9a91755bb13b36a284fe768 +f4429a15c096e2eb202656cc488e7b95d659e832d3d5d5ccc61d11dcda77d6ac diff --git a/test/data/manifest-checksums/rhel_9.0-x86_64-ova-empty b/test/data/manifest-checksums/rhel_9.0-x86_64-ova-empty index 7cf60e8d1c..63fe3569d6 100644 --- a/test/data/manifest-checksums/rhel_9.0-x86_64-ova-empty +++ b/test/data/manifest-checksums/rhel_9.0-x86_64-ova-empty @@ -1 +1 @@ -c4773cbaee4870a13969173d4d166b57ddade134d8bccd932141d4af9f144955 +f8a766909d6db0998caf98fe8585ec86bb0cc2c5e51c3207029461068cbf8c50 diff --git a/test/data/manifest-checksums/rhel_9.2-x86_64-ova-empty b/test/data/manifest-checksums/rhel_9.2-x86_64-ova-empty index c54a812c1d..decede7129 100644 --- a/test/data/manifest-checksums/rhel_9.2-x86_64-ova-empty +++ b/test/data/manifest-checksums/rhel_9.2-x86_64-ova-empty @@ -1 +1 @@ -b3f9e3983701fde6de6de0fa9edbdfa1acd4243e8e25803a143f9d573cecf528 +3912e1992b379c0b36d430e38a7db91122fc4de1a907248c38dbd374117a9116 diff --git a/test/data/manifest-checksums/rhel_9.4-x86_64-ova-empty b/test/data/manifest-checksums/rhel_9.4-x86_64-ova-empty index 8fd37f846a..d6fb066982 100644 --- a/test/data/manifest-checksums/rhel_9.4-x86_64-ova-empty +++ b/test/data/manifest-checksums/rhel_9.4-x86_64-ova-empty @@ -1 +1 @@ -e4ed9ad5b24a28d99c03c4deea07475065a89cc1af66bcb31e4d3af3472f371c +7108f63b357505a947cece13e27aa961d4cb662a523190ad684cad07a0bef37f diff --git a/test/data/manifest-checksums/rhel_9.6-x86_64-ova-empty b/test/data/manifest-checksums/rhel_9.6-x86_64-ova-empty index 93cf25335c..4b7a5aa20a 100644 --- a/test/data/manifest-checksums/rhel_9.6-x86_64-ova-empty +++ b/test/data/manifest-checksums/rhel_9.6-x86_64-ova-empty @@ -1 +1 @@ -b4dc34a0fbec88d8b3a0a2ce1e36271b5279d8943f3a8f2a3c01744fbd736545 +d97bb15434a7ff85c38bbc95f97c4f9782917d40703c895ceefbc1f6f245a913 diff --git a/test/data/manifest-checksums/rhel_9.8-x86_64-ova-empty b/test/data/manifest-checksums/rhel_9.8-x86_64-ova-empty index 0e98a3e011..098c813f90 100644 --- a/test/data/manifest-checksums/rhel_9.8-x86_64-ova-empty +++ b/test/data/manifest-checksums/rhel_9.8-x86_64-ova-empty @@ -1 +1 @@ -e9257c7e4c69e9665d06f4caf071de3d02e196fb6b80e25171eedbe184e715d7 +051d60fb2fcf16a725163a8268c6ef5a7d65d246f8171bd038a4e3a4720a8b9b diff --git a/test/data/manifest-checksums/rhel_9.9-x86_64-ova-empty b/test/data/manifest-checksums/rhel_9.9-x86_64-ova-empty index cef59f53ff..af0cb077e0 100644 --- a/test/data/manifest-checksums/rhel_9.9-x86_64-ova-empty +++ b/test/data/manifest-checksums/rhel_9.9-x86_64-ova-empty @@ -1 +1 @@ -6dca366cc4f0f5c857642c7841bf8f363eee7e707fd0b4bf3d6f557d44c0237e +dc9c380db32f4076537d464392aa4f0f4a7efd6407a64f1d079b33f905ac90ab