NSX|V3: devstack cleanup exclude list ports on devstack

If ports are added to the exclude list directly (not using tags),
they should also be deleted when using devstack cleanup.

Change-Id: Id2bc3690bf11be41a52e6b3301995cd71da0af3b
This commit is contained in:
Adit Sarfaty 2017-07-05 10:13:48 +03:00
parent 2376d72d94
commit c976ab8e61
1 changed files with 10 additions and 0 deletions

View File

@ -229,10 +229,20 @@ class NSXClient(object):
if response.status_code != requests.codes.ok:
print("ERROR: Failed to update lport %s" % p['id'])
def _remove_port_from_exclude_list(self, p):
try:
endpoint = ('/firewall/excludelist?action=remove_member&'
'object_id=%s' % p['id'])
self.post(endpoint)
except Exception:
pass
def _cleanup_logical_ports(self, lports):
# logical port vif detachment
self.update_logical_port_attachment(lports)
for p in lports:
# delete this port from the exclude list (if in it)
self._remove_port_from_exclude_list(p)
endpoint = '/logical-ports/%s' % p['id']
response = self.delete(endpoint=endpoint)
if response.status_code == requests.codes.ok: