Skip to content

OpenStack: Don't modify port dict when collecting additional information #10192

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

Merged
merged 2 commits into from
May 9, 2025

Conversation

nelljerram
Copy link
Member

While working on #10160 I noticed that our UT code sometimes has to reset generated elements in the mock port dicts that it uses, e.g.

del self.osdb_ports[0]['network_qos_policy_id']

This is because our driver code gets a port dict, in a create or update hook, and then has to gather various pieces of related information, from other tables in the Neutron DB, before being ready to map that to a corresponding Calico WorkloadEndpoint; and it stores that additional information by adding keys to the supplied port dict.

It's a bit fragile to modify the input port dict like that, and it would be better to collect the additional information in a separate object, as this change now does.

While working on projectcalico#10160 I noticed that our UT code sometimes has to reset generated elements in the mock port dicts that it uses, e.g.

    del self.osdb_ports[0]['network_qos_policy_id']

This is because our driver code gets a port dict, in a create or update hook, and then has to gather various pieces of related information, from other tables in the Neutron DB, before being ready to map that to a corresponding Calico WorkloadEndpoint; and it stores that additional information by adding keys to the supplied port dict.

It's a bit fragile to modify the input port dict like that, and it would be better to collect the additional information in a separate object, as this change now does.
@nelljerram nelljerram requested a review from a team as a code owner April 10, 2025 11:10
@marvin-tigera marvin-tigera added this to the Calico v3.31.0 milestone Apr 10, 2025
@marvin-tigera marvin-tigera added release-note-required Change has user-facing impact (no matter how small) docs-pr-required Change is not yet documented labels Apr 10, 2025
@nelljerram nelljerram added docs-not-required Docs not required for this change release-note-not-required Change has no user-facing impact and removed release-note-required Change has user-facing impact (no matter how small) docs-pr-required Change is not yet documented labels Apr 10, 2025
@marvin-tigera marvin-tigera added release-note-required Change has user-facing impact (no matter how small) docs-pr-required Change is not yet documented and removed docs-not-required Docs not required for this change release-note-not-required Change has no user-facing impact labels Apr 10, 2025
@nelljerram nelljerram added docs-not-required Docs not required for this change release-note-not-required Change has no user-facing impact and removed release-note-required Change has user-facing impact (no matter how small) docs-pr-required Change is not yet documented labels Apr 10, 2025
@nelljerram nelljerram merged commit 013b3d0 into projectcalico:master May 9, 2025
3 checks passed
@nelljerram nelljerram deleted the port-extra branch May 9, 2025 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs-not-required Docs not required for this change release-note-not-required Change has no user-facing impact
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants