fix: Fix for parsing vApp properties while converting from OVF envelope to VM ConfigSpec#3964
Open
hpannem wants to merge 1 commit intovmware:mainfrom
Open
fix: Fix for parsing vApp properties while converting from OVF envelope to VM ConfigSpec#3964hpannem wants to merge 1 commit intovmware:mainfrom
hpannem wants to merge 1 commit intovmware:mainfrom
Conversation
…pe to VM ConfigSpec Signed-off-by: Hemanth kumar Pannem <hpannem@vmware.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When building a
VmConfigSpecfrom an OVF envelope (Envelope.toVAppConfig), vApp property default values were assigned verbatim from the parsed OVF without any type-aware processing. This caused a correctness bug forbooleanproperties: the OVF envelope uses lowercase"true"/"false", but the vSphere API requires the canonical forms"True"/"False".This change introduces
ovf/vappconfig_parser.go, which implements type-aware parsing and validation of vApp property values for all OVF property types defined in DSP0004/DSP0243:boolean"True"/"False"intrealipstring/passwordstring(N..M)/password(N..M)int(N..M)real(N..M)ip:network,expression, unknownPassword-typed properties are handled with care: error messages never include the property value to avoid leaking secrets in logs.
Envelope.toVAppConfignow returns an error if any property value fails validation, surfacing problems at config-spec construction time rather than silently passing bad values to vSphere.Closes: #3963
How Has This Been Tested?
Unit tests added in
ovf/vappconfig_parser_test.gocovering:string,password,boolean,int,real,ip,ip:network,expression, unknown)string(..N),string(N..),string(M..N),int(M..N),real(M..N),password(..N),password(N..),password(M..N))go test ./ovf/...
ok github.com/vmware/govmomi/ovf 0.403s
ok github.com/vmware/govmomi/ovf/importer 0.198s