-
Notifications
You must be signed in to change notification settings - Fork 946
Description
Describe the bug
When creating a VirtualMachineConfigSpec from an OVF envelope (Envelope.ToConfigSpec), vApp properties of type boolean have their default values passed through verbatim from the OVF envelope. The OVF envelope uses lowercase "true" / "false", but the vSphere API (VAppPropertyInfo.DefaultValue) requires the canonical form "True" / "False". This causes vSphere to reject the boolean property values.
Additionally, other typed vApp properties (int, real, ip, string with length constraints, password with length constraints, etc.) had their default values passed through without any validation or parsing, meaning malformed or out-of-range values could be silently stored in the config spec.
To Reproduce
- Parse an OVF envelope whose ProductSection contains a vApp property of type boolean with a default value of "true" or "false" (lowercase).
- Call Envelope.ToVirtualMachineConfigSpec to produce a VmConfigSpec from the parsed envelope.
- Inspect the resulting VmConfigSpec.VAppConfig.Property entries.
Observe that the boolean property DefaultValue is "true" / "false" instead of the required "True" / "False".
Expected behavior
Boolean vApp property default values in the generated VmConfigSpec should be normalized to "True" or "False" as required by the vSphere API. All other typed properties (int, real, ip, string(N..M), password(N..M), etc.) should be validated against their declared type constraints, and an actionable error should be returned if a value does not conform.
Affected version
Affects current main branch. The DefaultValue field in Envelope.toVAppConfig was assigned verbatim without any type-aware parsing.
Screenshots/Debug Output
Relevant code path: ovf/configspec.go → Envelope.toVAppConfig → VAppPropertyInfo.DefaultValue.
While creating a VM with such ConfigSpec, vSphere will reject the VM creation saying one of the following messages.
Invalid value '' specified for property <property>
Invalid value 'false' specified for property <property>
Invalid value 'true' specified for property <property>
Additional context
he vSphere OVF specification (DSP0243) and the CIM property type definitions (DSP0004) define strict formats for each property type. The boolean type in particular requires the capitalised forms "True" and "False".