V2T migration: Cleanup unused ports post migration
Change-Id: I36db2f1be84adb723774d09cc7192929ce0fe60f
This commit is contained in:
parent
ce8718de8d
commit
5e766b1afb
@ -50,6 +50,19 @@ def post_v2t_migration_cleanups(resource, event, trigger, **kwargs):
|
|||||||
section['id'])
|
section['id'])
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
# cleanup migrated DVS ports (belong to the edges that are not in use)
|
||||||
|
segments = nsxpolicy.segment.list()
|
||||||
|
for seg in segments:
|
||||||
|
# skip non-neutron segments
|
||||||
|
if not p_utils.is_neutron_resource(seg):
|
||||||
|
continue
|
||||||
|
ports = nsxpolicy.segment_port.list(seg['id'])
|
||||||
|
# find the non-neutron ports and delete them
|
||||||
|
for port in ports:
|
||||||
|
if not p_utils.is_neutron_resource(port):
|
||||||
|
nsxpolicy.segment_port.delete(seg['id'], port['id'])
|
||||||
|
LOG.error("Deleted migrated non-neutron port %s", port['id'])
|
||||||
|
|
||||||
|
|
||||||
@admin_utils.output_header
|
@admin_utils.output_header
|
||||||
def migration_tier0_redistribute(resource, event, trigger, **kwargs):
|
def migration_tier0_redistribute(resource, event, trigger, **kwargs):
|
||||||
|
@ -137,3 +137,11 @@ class NsxPolicyPluginWrapper(plugin.NsxPolicyPlugin):
|
|||||||
fwaas_callbacks_v2.NsxpFwaasCallbacksV2,
|
fwaas_callbacks_v2.NsxpFwaasCallbacksV2,
|
||||||
None)
|
None)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
def is_neutron_resource(resource):
|
||||||
|
# Return True if the resource has the neutron marking tag
|
||||||
|
for tag in resource.get('tags', []):
|
||||||
|
if tag.get('scope') == 'os-api-version':
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
Loading…
Reference in New Issue
Block a user