Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix queries for vCD 10 #293

Merged
merged 12 commits into from
Apr 2, 2020
Merged

Fix queries for vCD 10 #293

merged 12 commits into from
Apr 2, 2020

Conversation

vbauzys
Copy link
Contributor

@vbauzys vbauzys commented Mar 26, 2020

Ref: https://github.com/terraform-providers/terraform-provider-vcd/issues/483
PVDC and Port groups fails in vCD 10 version, usually backed by NSX-T.
e.g.

2020/03/25 11:05:22 --------------------------------------------------------------------------------

2020/03/25 11:05:22 Request caller: vcd.resourceVcdExternalNetworkCreate-->vcd.getExternalNetworkInput-->govcd.QueryNetworkPortGroup-->govcd.QueryPortGroups-->govcd.(*VCDClient).QueryWithNotEncodedParams-->govcd.(*Client).QueryWithNotEncodedParams

2020/03/25 11:05:22 GET https://./api/query?&filter=name==VM+Network;portgroupType==NETWORK&type=portgroup

2020/03/25 11:05:22 --------------------------------------------------------------------------------

2020/03/25 11:05:22 Req header:

2020/03/25 11:05:22     Accept: [application/*+xml;version=29.0]

2020/03/25 11:05:22     X-Vcloud-Authorization: [********]

2020/03/25 11:05:23 ################################################################################

2020/03/25 11:05:23 Response caller vcd.resourceVcdExternalNetworkCreate-->vcd.getExternalNetworkInput-->govcd.QueryNetworkPortGroup-->govcd.QueryPortGroups-->govcd.(*VCDClient).QueryWithNotEncodedParams-->govcd.(*Client).QueryWithNotEncodedParams-->govcd.getResult-->govcd.decodeBody

2020/03/25 11:05:23 Response status 200 OK

2020/03/25 11:05:23 ################################################################################

2020/03/25 11:05:23 Response header:

2020/03/25 11:05:23     X-Vmware-Vcloud-Request-Id: [9b57e4f7-8574-4d6f-b500-11c1e72a7814]

2020/03/25 11:05:23     X-Vmware-Vcloud-Ceip-Id: [8a93a18b-6459-4a62-832f-29c2a0b1e0ac]

2020/03/25 11:05:23     Content-Length: [1198]

2020/03/25 11:05:23     Date: [Wed, 25 Mar 2020 10:05:21 GMT]

2020/03/25 11:05:23     X-Vcloud-Authorization: [********]

2020/03/25 11:05:23     Content-Type: [application/vnd.vmware.vcloud.query.records+xml;version=29.0]

2020/03/25 11:05:23     X-Vmware-Vcloud-Request-Execution-Time: [28]

2020/03/25 11:05:23     Cache-Control: [no-store, must-revalidate]

2020/03/25 11:05:23     Vary: [Accept-Encoding, User-Agent]

2020/03/25 11:05:23 Response text: [1198] <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2020/03/25 11:05:22 --------------------------------------------------------------------------------

2020/03/25 11:05:22 Request caller: vcd.resourceVcdExternalNetworkCreate-->vcd.getExternalNetworkInput-->govcd.QueryNetworkPortGroup-->govcd.QueryPortGroups-->govcd.(*VCDClient).QueryWithNotEncodedParams-->govcd.(*Client).QueryWithNotEncodedParams

2020/03/25 11:05:22 GET https://.../api/query?&filter=name==VM+Network;portgroupType==NETWORK&type=portgroup

2020/03/25 11:05:22 --------------------------------------------------------------------------------

2020/03/25 11:05:22 Req header:

2020/03/25 11:05:22     Accept: [application/*+xml;version=29.0]

2020/03/25 11:05:22     X-Vcloud-Authorization: [********]

2020/03/25 11:05:23 ################################################################################

2020/03/25 11:05:23 Response caller vcd.resourceVcdExternalNetworkCreate-->vcd.getExternalNetworkInput-->govcd.QueryNetworkPortGroup-->govcd.QueryPortGroups-->govcd.(*VCDClient).QueryWithNotEncodedParams-->govcd.(*Client).QueryWithNotEncodedParams-->govcd.getResult-->govcd.decodeBody

2020/03/25 11:05:23 Response status 200 OK

2020/03/25 11:05:23 ################################################################################

2020/03/25 11:05:23 Response header:

2020/03/25 11:05:23     X-Vmware-Vcloud-Request-Id: [9b57e4f7-8574-4d6f-b500-11c1e72a7814]

2020/03/25 11:05:23     X-Vmware-Vcloud-Ceip-Id: [8a93a18b-6459-4a62-832f-29c2a0b1e0ac]

2020/03/25 11:05:23     Content-Length: [1198]

2020/03/25 11:05:23     Date: [Wed, 25 Mar 2020 10:05:21 GMT]

2020/03/25 11:05:23     X-Vcloud-Authorization: [********]

2020/03/25 11:05:23     Content-Type: [application/vnd.vmware.vcloud.query.records+xml;version=29.0]

2020/03/25 11:05:23     X-Vmware-Vcloud-Request-Execution-Time: [28]

2020/03/25 11:05:23     Cache-Control: [no-store, must-revalidate]

2020/03/25 11:05:23     Vary: [Accept-Encoding, User-Agent]

2020/03/25 11:05:23 Response text: [1198] <?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<QueryResultRecords xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:common="http://schemas.dmtf.org/wbem/wscim/1/common" xmlns:vmw="http://www.vmware.com/schema/ovf" xmlns:ovfenv="http://schemas.dmtf.org/ovf/environment/1" xmlns:vmext="http://www.vmware.com/vcloud/extension/v1.5" xmlns:ns9="http://www.vmware.com/vcloud/versions" name="portgroup" page="1" pageSize="25" total="0" href="https://...eng.vmware.com/api/query?type=portgroup&amp;page=1&amp;pageSize=25&amp;format=records&amp;filter=name==VM+Network;portgroupType==NETWORK" type="application/vnd.vmware.vcloud.query.records+xml">

    <Link rel="alternate" href="https://...eng.vmware.com/api/query?type=portgroup&amp;page=1&amp;pageSize=25&amp;format=idrecords&amp;filter=name==VM+Network;portgroupType==NETWORK" type="application/vnd.vmware.vcloud.query.idrecords+xml"/>

</QueryResultRecords>
<QueryResultRecords xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:common="http://schemas.dmtf.org/wbem/wscim/1/common" xmlns:vmw="http://www.vmware.com/schema/ovf" xmlns:ovfenv="http://schemas.dmtf.org/ovf/environment/1" xmlns:vmext="http://www.vmware.com/vcloud/extension/v1.5" xmlns:ns9="http://www.vmware.com/vcloud/versions" name="portgroup" page="1" pageSize="25" total="0" href="https://...eng.vmware.com/api/query?type=portgroup&amp;page=1&amp;pageSize=25&amp;format=records&amp;filter=name==VM+Network;portgroupType==NETWORK" type="application/vnd.vmware.vcloud.query.records+xml">

    <Link rel="alternate" href="https://...eng.vmware.com/api/query?type=portgroup&amp;page=1&amp;pageSize=25&amp;format=idrecords&amp;filter=name==VM+Network;portgroupType==NETWORK" type="application/vnd.vmware.vcloud.query.idrecords+xml"/>

</QueryResultRecords>
  • Solution was to enhance request and explicitly state that parameter value was encoded.

Signed-off-by: Vaidotas Bauzys <[email protected]>
@vbauzys vbauzys requested review from dataclouder, lvirbalas and Didainius and removed request for dataclouder and lvirbalas March 26, 2020 11:23
@vbauzys vbauzys self-assigned this Mar 26, 2020
@vbauzys vbauzys requested a review from lvirbalas March 26, 2020 11:24
@vbauzys vbauzys marked this pull request as ready for review March 26, 2020 11:24
vbauzys added 3 commits March 26, 2020 13:40
Signed-off-by: Vaidotas Bauzys <[email protected]>
Signed-off-by: Vaidotas Bauzys <[email protected]>
Signed-off-by: Vaidotas Bauzys <[email protected]>
Copy link
Collaborator

@lvirbalas lvirbalas left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

vbauzys added 2 commits March 27, 2020 09:30
…s backed NSX-T is returned only from API 31 version.

Signed-off-by: Vaidotas Bauzys <[email protected]>
vbauzys added 3 commits April 1, 2020 08:42
Signed-off-by: Vaidotas Bauzys <[email protected]>

# Conflicts:
#	CHANGELOG.md
Signed-off-by: Vaidotas Bauzys <[email protected]>
Copy link
Contributor

@dataclouder dataclouder left a comment

Choose a reason for hiding this comment

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

LGTM

@vbauzys vbauzys merged commit bc63d3c into vmware:master Apr 2, 2020
Didainius added a commit to vmware/terraform-provider-vcd that referenced this pull request Apr 15, 2020
* Add vCD 10.1 vcd_org_vdc fix note to changelog which was actually fixed with #489 by pulling in go-vcloud-director SDK version vmware/go-vcloud-director#293
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants