Skip to content

Commit 586453e

Browse files
authored
Merge pull request #5 from galaxyproject/master
[pull] master from galaxyproject:master
2 parents a804088 + c2dfaa2 commit 586453e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

django-cloudlaunch/cloudlaunch/backend_plugins/base_vm_app.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,15 @@ def _setup_networking(self, provider, net_id, subnet_id, placement):
227227
provider, net_id, placement)
228228
# Make sure the subnet has Internet connectivity
229229
try:
230-
found_routers = [router for router in provider.networking.routers
231-
if router.network_id == subnet.network_id]
230+
# This will allow to re-use a router when subnets from multiple networks are attached to it
231+
# xref: https://github.com/galaxyproject/cloudlaunch/pull/261
232+
if provider.PROVIDER_ID == 'openstack':
233+
found_routers = [router for router in provider.networking.routers
234+
if subnet.network_id in [port.network_id for port in
235+
provider.os_conn.list_ports(filters={'device_id': self.id})]]
236+
else:
237+
found_routers = [router for router in provider.networking.routers
238+
if router.network_id == subnet.network_id]
232239
# Check if the subnet's network is connected to a router
233240
router = None
234241
for r in found_routers:

0 commit comments

Comments
 (0)