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

nsx-t integration does not do paging when retrieving objects #199

Closed
MatthiasWinzeler opened this issue Mar 14, 2019 · 3 comments
Closed
Assignees

Comments

@MatthiasWinzeler
Copy link

Describe the bug
We're starting to use the NSX-T integration to add VMs to nsgroups.
It looks to us as if the nsxt_provider is not properly retrieving all nsgroups in a paginated way, but instead only retrieves the first 50 objects: https://github.com/cloudfoundry/bosh-vsphere-cpi-release/blob/52.x/src/vsphere_cpi/lib/cloud/vsphere/nsxt_provider.rb#L138

This leads to NSGroups [<my-nsgroup>] was not found in NSX-T errors if the nsgroup you'd like to add your VM to is on the second page.

To Reproduce
Steps to reproduce the behavior:

  1. Create more than 50 nsgroups
  2. Try to add the VM to an nsgroup that's on the second page
  3. Receive error above.

CPI Error Log
NSGroups [mysql-priv-prd-workspaces-nsgroup] was not found in NSX-T

Expected behavior
We expect the VM to be added to the nsgroup.

Release Version & Related Info (please complete the following information):

  • CPI Version: 52
  • BOSH Director Version: latest
  • Stemcell Name & Version: latest
  • vCenter Version: unknown
  • NSX(T/V) Version (If using): 2.3.x

Additional context
We monkey-patched the cpi with our following implementation of paging to grouping_objects_api.rb which works:

    def list_ns_groups_paged(opts = {})
      results = []
      params = { page_size: 50 }
      loop do
        data, _status_code, _headers = list_ns_groups_with_http_info(params)
        results += data.results
        return results if data.results.count < params[:page_size]
        params[:cursor] = data.cursor
      end
    end

However, I think there's a.) a more elegant solution that uses iterators/blocks to not retrieve all objects and b.) probably all listing of resources is affected, so one had to go through to all the code to make a proper PR.

@MatthiasWinzeler
Copy link
Author

FYI, for now we're tracking a fork containing the most important fixes: master...swisscom:add-paging-for-nsx-t-nsgroups

@EleanorRigby
Copy link
Contributor

Thanks Matthias for bringing this to our attention. We have added the bug to our tracker and will be working on it as soon as we finish current line of work.

Feel free to submit a Pull Request. That will definitely help us merge it to Master faster.

@EleanorRigby
Copy link
Contributor

@neilcx : The bug details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants