You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
Create more than 50 nsgroups
Try to add the VM to an nsgroup that's on the second page
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.
The text was updated successfully, but these errors were encountered:
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.
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#L138This 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:
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):
Additional context
We monkey-patched the cpi with our following implementation of paging to grouping_objects_api.rb which works:
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.
The text was updated successfully, but these errors were encountered: