In some cases, vm.UpdateNetworkConnectionSection fails with error similar toHTTP 400 Bad Request - cvc-elt.1.a: Cannot find the declaration of element 'NetworkConnectionSection'
The cause
The vm.UpdateNetworkConnectionSection at first retrieves existing network configuration (vm.GetNetworkConnectionSection) and the modifies it.
In some environments, there is a problem that in some cases VCD randomly (not always) puts the payload for GET query into ns2 namespace.
Because Go XML library has issues with namespace handling (https://github.com/golang/go/issues/9519), the Xmlns attribute value http://www.vmware.com/vcloud/v1.5 gets lost in translation and this causes the described error when update occurs.
The fix
The fix is to set hardcoded setting for Xmlns to http://www.vmware.com/vcloud/v1.5 for every update call. This will prevent malformed XML document query.
Testing
I have triggered tests that include call to the methodvm.UpdateNetworkConnectionSection and none of them failed:
Closes #429
Problem
In some cases,
vm.UpdateNetworkConnectionSection
fails with error similar toHTTP 400 Bad Request - cvc-elt.1.a: Cannot find the declaration of element 'NetworkConnectionSection'
The cause
The
vm.UpdateNetworkConnectionSection
at first retrieves existing network configuration (vm.GetNetworkConnectionSection
) and the modifies it.In some environments, there is a problem that in some cases VCD randomly (not always) puts the payload for GET query into
ns2
namespace.For reference, the regular normal payload that this call returns (not wrapped into
ns2
namespace)Because Go XML library has issues with namespace handling (https://github.com/golang/go/issues/9519), the
Xmlns
attribute valuehttp://www.vmware.com/vcloud/v1.5
gets lost in translation and this causes the described error when update occurs.The fix
The fix is to set hardcoded setting for
Xmlns
tohttp://www.vmware.com/vcloud/v1.5
for every update call. This will prevent malformed XML document query.Testing
I have triggered tests that include call to the method
vm.UpdateNetworkConnectionSection
and none of them failed: