Browse Source

Merge "V2T migration: remove non-neutron ports after migration" into stable/train

changes/27/780827/2
Zuul 1 month ago
committed by Gerrit Code Review
parent
commit
bea0ef976e
1 changed files with 14 additions and 1 deletions
  1. +14
    -1
      vmware_nsx/shell/admin/plugins/nsxp/resources/migration.py

+ 14
- 1
vmware_nsx/shell/admin/plugins/nsxp/resources/migration.py View File

@ -41,7 +41,7 @@ def cleanup_db_mappings(resource, event, trigger, **kwargs):
def post_v2t_migration_cleanups(resource, event, trigger, **kwargs):
"""Cleanup unneeded migrated resources after v2t migration is done"""
nsxpolicy = p_utils.get_connected_nsxpolicy()
# clean all migrated DFW sections
# Clean all migrated DFW sections
sections = nsxpolicy.comm_map.list(policy_constants.DEFAULT_DOMAIN)
for section in sections:
# Look for the tag marking the migrated sections
@ -52,6 +52,19 @@ def post_v2t_migration_cleanups(resource, event, trigger, **kwargs):
section['id'])
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
def migration_tier0_redistribute(resource, event, trigger, **kwargs):


Loading…
Cancel
Save