Skip to content

Commit

Permalink
Support router attached to different net's sn (#261)
Browse files Browse the repository at this point in the history
* Support router attached to different net's sn
  • Loading branch information
Alexandru Mahmoud committed Sep 15, 2022
1 parent 78faf84 commit c2dfaa2
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions django-cloudlaunch/cloudlaunch/backend_plugins/base_vm_app.py
Expand Up @@ -227,8 +227,15 @@ def _setup_networking(self, provider, net_id, subnet_id, placement):
provider, net_id, placement)
# Make sure the subnet has Internet connectivity
try:
found_routers = [router for router in provider.networking.routers
if router.network_id == subnet.network_id]
# This will allow to re-use a router when subnets from multiple networks are attached to it
# xref: https://github.com/galaxyproject/cloudlaunch/pull/261
if provider.PROVIDER_ID == 'openstack':
found_routers = [router for router in provider.networking.routers
if subnet.network_id in [port.network_id for port in
provider.os_conn.list_ports(filters={'device_id': self.id})]]
else:
found_routers = [router for router in provider.networking.routers
if router.network_id == subnet.network_id]
# Check if the subnet's network is connected to a router
router = None
for r in found_routers:
Expand Down

0 comments on commit c2dfaa2

Please sign in to comment.