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

NSXT Bulk API for realizing SGs #129

Open
wants to merge 1 commit into
base: stable/yoga-m3
Choose a base branch
from

Conversation

sven-rosenzweig
Copy link
Contributor

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.

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.
@sven-rosenzweig sven-rosenzweig force-pushed the feature/bulk_api_for_sg_operations branch from c2e98fa to 58c4718 Compare January 23, 2024 16:12
"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
Copy link
Contributor

Choose a reason for hiding this comment

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

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)
Copy link
Contributor

Choose a reason for hiding this comment

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

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))
Copy link
Contributor

Choose a reason for hiding this comment

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

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.

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

Successfully merging this pull request may close these issues.

2 participants