Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions django-cloudlaunch/cloudlaunch/backend_plugins/base_vm_app.py
Original file line number Diff line number Diff line change
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