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
When multiple NADs share the same source-portgroup annotation but exist in different namespaces, the network map NAD query now filters by namespace extracted from the network_attachment_definition override (format namespace/name). If no namespace is specified, the current behavior is preserved.
Adds validation to reject duplicate IDs in mtv_management_network_map_overrides, preventing silent selection of only the first match.
Changes
roles/mtv_management/tasks/_mtv_network_map.yml: Added assertion to validate unique IDs in network map overrides.
roles/mtv_management/tasks/_mtv_network_map_process_network.yml: Added namespace filter to JMESPath query for both VMware and oVirt NAD lookups when the override contains a namespaced network_attachment_definition.
Test plan
Verify network map creation with two NADs having the same annotation in different namespaces and overrides specifying namespace/name
Verify network map creation still works without namespace in network_attachment_definition
Verify duplicate ID validation fails with a clear error message
Jinja2 filter precedence ambiguity (low risk) — '...' + __mtv_management_nad_override_ns | trim + '...' works correctly by coincidence (surrounding literals have no whitespace to strip), but intent is clearer with parens: (__mtv_management_nad_override_ns | trim). Readers will question whether trim applies to the variable or the whole concatenation.
Namespace extracted but NAD name not stripped — when override is my-ns/my-nad, this PR filters by namespace my-ns in the annotation query. But if downstream code matches the network_attachment_definition value my-ns/my-nad against a NAD resource named my-nad, it won't match. Worth verifying that downstream consumers also handle the namespace/name format, or the name portion gets extracted separately.
Near-identical blocks for VMware and oVirt — both namespace extraction lines and query constructions are copy-pasted. Not a bug, but any future fix needs applying twice.
_mtv_network_map.yml
Duplicate ID assertion is clean. Correct Jinja2 filter chain, good error message, proper when guard.
Verdict
Solid targeted fix. Items 1 and 3 are style nits. Item 2 is the one worth confirming — does any code downstream of this query use the raw network_attachment_definition override value for name matching? If so, it needs the namespace/ prefix stripped too.
The reason will be displayed to describe this comment to others. Learn more.
please see my prior comment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
source-portgroupannotation but exist in different namespaces, the network map NAD query now filters by namespace extracted from thenetwork_attachment_definitionoverride (formatnamespace/name). If no namespace is specified, the current behavior is preserved.mtv_management_network_map_overrides, preventing silent selection of only the first match.Changes
roles/mtv_management/tasks/_mtv_network_map.yml: Added assertion to validate unique IDs in network map overrides.roles/mtv_management/tasks/_mtv_network_map_process_network.yml: Added namespace filter to JMESPath query for both VMware and oVirt NAD lookups when the override contains a namespacednetwork_attachment_definition.Test plan
namespace/namenetwork_attachment_definition