[NSX|v3] L2 gw: store segmentation id in DB in any case
Store the segmentation id for a connection even when not specified on the connection create request, but inherited from l2gw device configuration Change-Id: I3ce91eed538ef467129c83e58d560961835db255
This commit is contained in:
parent
30fc8ffaef
commit
a642dc7f98
@ -441,12 +441,23 @@ class NsxV3Driver(l2gateway_db.L2GatewayMixin):
|
|||||||
gw_connection['id'])
|
gw_connection['id'])
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Update neutron's database with the mappings.
|
with db_api.CONTEXT_WRITER.using(context):
|
||||||
nsx_db.add_l2gw_connection_mapping(
|
# Update neutron's database with the mappings.
|
||||||
session=context.session,
|
nsx_db.add_l2gw_connection_mapping(
|
||||||
connection_id=gw_connection['id'],
|
session=context.session,
|
||||||
bridge_endpoint_id=bridge_endpoint['id'],
|
connection_id=gw_connection['id'],
|
||||||
port_id=port['id'])
|
bridge_endpoint_id=bridge_endpoint['id'],
|
||||||
|
port_id=port['id'])
|
||||||
|
# If no segmentation_id was passed as a part of the
|
||||||
|
# connection object, update it with the one inherited
|
||||||
|
# from the device spec
|
||||||
|
if seg_id and not gw_connection.get(l2gw_const.SEG_ID):
|
||||||
|
conn_db = self._plugin._get_l2_gateway_connection(
|
||||||
|
context, gw_connection['id'])
|
||||||
|
conn_db['segmentation_id'] = seg_id
|
||||||
|
# Ensure the object is updated as well so the
|
||||||
|
# create response returns the segmentation_id
|
||||||
|
gw_connection[l2gw_const.SEG_ID] = seg_id
|
||||||
except db_exc.DBError:
|
except db_exc.DBError:
|
||||||
with excutils.save_and_reraise_exception():
|
with excutils.save_and_reraise_exception():
|
||||||
LOG.exception("Unable to add L2 gateway connection "
|
LOG.exception("Unable to add L2 gateway connection "
|
||||||
|
Loading…
Reference in New Issue
Block a user