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

GetNetworkList() truncates the network list when a VDC has more than 25 networks #514

Closed
RussPitcher opened this issue Nov 1, 2022 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@RussPitcher
Copy link

Describe the bug

When running a Terraform action against an OrgVDC with more than 25 OrgVDC networks the state refresh fails with one or more errors as follows:

Error: error retrieving network myOrgVdcNetwork from network list

On investigation we discovered that the query used to retrieve the network list does not manage paged responses and therefore uses the default page size of 25 records. Any records apart from the initial 25 are not returned. This causes the calling functions to fail when the expected network is missing.

We tracked the REST call down to the GetNetworkList() function in the orgvdcnetwork.go file and it can be seen that the pageSize parameter is not used, and the function itself does not attempt to handle paged responses.

Reproduction steps

  1. Create an OrgVDC with more than 25 terraform-managed vdc_network_direct objects
  2. Run a terraform plan

Expected behavior

The terraform plan should refresh the state successfully without errors

Additional context

Adding a simple "pageSize": "128" to the query would reduce the scope of this issue (as has been done in the QueryProviderVdcStorageProfileByName function) but it would be better to implement proper support for paged responses.

@dataclouder
Copy link
Contributor

Thanks for the investigation. we were aware of the problem, but this function skipped through the cracks last time we went around fixing it.
There is a simple fix (we do have a cumulativeQuery that does the pagination automatically). It will require some tests, but it should be addressed easily.

dataclouder pushed a commit to dataclouder/go-vcloud-director that referenced this issue Nov 14, 2022
Signed-off-by: Giuseppe Maxia <gmaxia@vmware.com>
dataclouder added a commit that referenced this issue Nov 14, 2022
* Fix issue #514 - ignoring pagination in network queries
* Add chengelog entry

Signed-off-by: Giuseppe Maxia <gmaxia@vmware.com>
@dataclouder
Copy link
Contributor

Fixed with PR #518

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants