Don't return ext net DB object in auto allocate

Returning a DB object for the external network and passing
that to the create_router operation makes the life of the
DB object transition many operations. If any of those operations
detech it from the session or expire it, it can result in
an exception down in the router operations.

This patch just returns the network ID since that's all we need.

Closes-Bug: #1616126
Change-Id: Ib9c4ba9f00ca7f7a713a89be4f75a230b086ac38
This commit is contained in:
Kevin Benton 2016-09-07 18:09:21 -07:00
parent dc6508aae2
commit fef301979e
1 changed files with 2 additions and 2 deletions

View File

@ -235,7 +235,7 @@ class AutoAllocatedTopologyMixin(common_db_mixin.CommonDbMixin):
LOG.error(_LE("Multiple external default networks detected. "
"Network %s is true 'default'."),
default_external_networks[0]['network_id'])
return default_external_networks[0]
return default_external_networks[0].network_id
def _get_supported_subnetpools(self, context):
"""Return the default subnet pools available."""
@ -295,7 +295,7 @@ class AutoAllocatedTopologyMixin(common_db_mixin.CommonDbMixin):
"""Uplink tenant subnet(s) to external network."""
router_args = {
'name': 'auto_allocated_router',
l3.EXTERNAL_GW_INFO: default_external_network,
l3.EXTERNAL_GW_INFO: {'network_id': default_external_network},
'tenant_id': tenant_id,
'admin_state_up': True
}