From 876823b88e9e09bf134e4fef26994017f6c1e33c Mon Sep 17 00:00:00 2001 From: Denys Mishchenko Date: Wed, 9 Sep 2026 10:16:11 +0200 Subject: [PATCH] Search for the router network in specified project If we have multiple networks with the same name in different projects, we will get an error in a global search. So first we should search in specified project and only if the network is missing there, do a global search. This should allow creation of multiple projects with the routers using the same network names. Change-Id: I40f41a6ee3e18d7cb2fc7fdd375539066444f3fb Signed-off-by: Denys Mishchenko --- changelogs/fragments/router_network.yaml | 3 +++ plugins/modules/router.py | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/router_network.yaml diff --git a/changelogs/fragments/router_network.yaml b/changelogs/fragments/router_network.yaml new file mode 100644 index 00000000..95f460a9 --- /dev/null +++ b/changelogs/fragments/router_network.yaml @@ -0,0 +1,3 @@ +--- +bugfixes: + - modules/router.py in function _build_router_interface_config network search will be performed in defined project first. diff --git a/plugins/modules/router.py b/plugins/modules/router.py index a928a0f7..c3748767 100644 --- a/plugins/modules/router.py +++ b/plugins/modules/router.py @@ -497,8 +497,15 @@ class RouterModule(OpenStackModule): if 'net' not in iface: self.fail( "Network name missing from interface definition") + # First try to find a network in the specified project. net = self.conn.network.find_network(iface['net'], - ignore_missing=False) + ignore_missing=False, + **filters) + # Fall back to a global search for the network. + if not net: + net = self.conn.network.find_network( + iface['net'], + ignore_missing=False) if 'portip' not in iface: # portip not set, add any ip from subnet