Merge "Fix attach logical router port failure"

This commit is contained in:
Jenkins 2015-11-13 00:12:24 +00:00 committed by Gerrit Code Review
commit 1e7734214e
2 changed files with 7 additions and 3 deletions

View File

@ -230,9 +230,10 @@ class LogicalPort(AbstractRESTResource):
# NOTE(arosen): The above api body structure might change
# in the future
body = {'logical_switch_id': lswitch_id,
'attachment': {'attachment_type': attachment_type,
'id': vif_uuid}}
body = {'logical_switch_id': lswitch_id}
if attachment_type and vif_uuid:
body['attachment'] = {'attachment_type': attachment_type,
'id': vif_uuid}
if key_values:
body['attachment']['context'] = {'key_values': key_values}

View File

@ -563,6 +563,9 @@ class NsxV3Plugin(addr_pair_db.AllowedAddressPairsMixin,
# transaction here later.
vif_uuid = port_data['id']
attachment_type = nsx_constants.ATTACHMENT_VIF
if port_data.get('device_owner') == l3_db.DEVICE_OWNER_ROUTER_INTF:
attachment_type = None
vif_uuid = None
# Change the attachment type for L2 gateway owned ports.
if l2gw_port_check:
# NSX backend requires the vif id be set to bridge endpoint id