neo sdn: fix delete port to

This patch fixes send delete port to be send in the following
cases:
1. host_id and device_owner compute or DHCP port type
2. host_id and vnic_type baremetal

Change-Id: I7febfdfa69e4b7783c6bb8254c5e1172e5f60d67
(cherry picked from commit a09dadb5d6)
This commit is contained in:
Moshe Levi 2017-04-19 10:23:18 +03:00
parent 52d858f79c
commit 0f066d3f8c
2 changed files with 6 additions and 1 deletions

View File

@ -222,7 +222,10 @@ class SDNMechanismDriver(api.MechanismDriver):
def delete_port_precommit(self, context):
port_dic = context.current
# delete the port only if attached to a host
if port_dic[portbindings.HOST_ID]:
vnic_type = port_dic[portbindings.VNIC_TYPE]
if (port_dic[portbindings.HOST_ID] and
(vnic_type == portbindings.VNIC_BAREMETAL or
self._is_send_bind_port(port_dic))):
port_dic[NETWORK_QOS_POLICY] = (
self._get_network_qos_policy(context,
port_dic['network_id']))

View File

@ -175,6 +175,7 @@ class SdnDriverTestCase(SdnConfigBase):
u'pci_vendor_info': u'15b3:1004'},
'id': '72c56c48-e9b8-4dcf-b3a7-0813bb3bd839',
'binding:vnic_type': 'direct',
'device_owner': DEVICE_OWNER_COMPUTE,
'mac_address': '12:34:56:78:21:b6',
'name': 'port_test1',
'network_id': 'c13bba05-eb07-45ba-ace2-765706b2d701',
@ -185,6 +186,7 @@ class SdnDriverTestCase(SdnConfigBase):
u'pci_vendor_info': u'15b3:1004'},
'id': None,
'binding:vnic_type': None,
'device_owner': DEVICE_OWNER_COMPUTE,
'mac_address': None,
'name': None,
'network_id': 'c13bba05-eb07-45ba-ace2-765706b2d701',