Fix attach logical router port failure

If port is created with vif attachment at the backend, router can's use
it as a linked_logical switch port. The patch fixed the bug by not
setting router_interface_owned port's attachment.
Closes-Bug: #1551171

Change-Id: I15fb0570656e69601da4781ba74bfef7cd151629
This commit is contained in:
berlin 2015-11-12 08:41:10 +00:00
parent bca69ea4e3
commit ccd5cf34b9
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