NSXT Bulk API for realizing SGs#129
Conversation
For ports with more than 27 SGs, the approach of adding them as static member one by one results in a rpc-timout. Thus ports rely on the update_sg_group method executed after a port binding. With this commit, we use the nsxt bulk API to add the staticmembership of ports directly after binding the port.
c2e98fa to
58c4718
Compare
| "resource_type": "Child{}".format(o.get("resource_type")), | ||
| "marked_for_delete": o.get("marked_for_delete") | ||
| } for o in child_objs | ||
| { o } for o in child_objs |
There was a problem hiding this comment.
This simplification improvement does not work for the delete segment port scenario. Also, this is the reason why one of the functional tests failed. Suggest reviewing it to the old structure and adding the additional fields you need (if any). Also, it will be more readable.
| LOG.info(report, "created") | ||
| path = "{}".format(API.INFRA) | ||
|
|
||
| res = self.client.patch(path=path, data=data) |
There was a problem hiding this comment.
We need a lock before the execution of the actual update/create operation. The challenge here is not to lock on the entire "SG_MEMBERS" type but for each group ID individually "member-{}".format(os_id). A semaphore implementation would be required.
|
|
||
| # Fetch _revision data (needed to run put requests) for all updated objects | ||
| # This is needed to run put requests on objects since put relies on the correct _revision number | ||
| updated_nsxt_objs = self.client.get_all(path=API.SEARCH_DSL, params=API.SEARCH_DSL_QUERY(nsxt_res_type, dsl)) |
There was a problem hiding this comment.
I'm not sure about the search API approach. Ideally, we need to use GET /infra as we use the same endpoint for the update/create operation.
For ports with more than 27 SGs, the approach of adding them as static member one by one results in a rpc-timout. Thus ports rely on the update_sg_group method executed after a port binding.
With this commit, we use the nsxt bulk API to add the staticmembership of ports directly after binding the port.