Cannot delete an NSX segment due to error: "Disconnect all VMs and VIFs before deleting a segment"
search cancel

Cannot delete an NSX segment due to error: "Disconnect all VMs and VIFs before deleting a segment"

book

Article ID: 371939

calendar_today

Updated On:

Products

VMware NSX

Issue/Introduction

  • When attempting to delete an NSX segment but the deletion fails with the following error in the NSX UI:
    Segment path=*** has N VMs or VIFs attached. Disconnect all VMs and VIFs before deleting a segment.
  • In the NSX Manager UI under Networking > Segments, the Ports / Interfaces column for the affected segment displays a non-zero value.
  • No VMs are found to be connected to the segment in vSphere client.
  • The /var/log/policy.log file contains the following error message:
    Segment /infra/segments/[segment] has VMs attached. Please disconnect all VMs before deleting a segment.

Environment

VMware NSX-T

VMware NSX

Cause

This issue occurs when stale logical ports remain attached to the segment in the NSX Manager

Resolution

To resolve this issue, you must manually identify and delete the stale ports from the NSX Manager UI:

  1. In the NSX Manager UI, navigate to Networking > Segments.
  2. Check the ports by clicking the non-zero number of [Ports / Interfaces] column of the segment.
  3. Verify in the vSphere Client that no active VMs are connected to the segment. (Note: If any active VMs are found, migrate their network connection to another NSX segment or vSphere port group before proceeding).
  4. Toggle from Policy Mode to Manager Mode
  5. Navigate to Networking > Logical Switches > Ports.
  6. Locate the specific ports identified in Step 2 and delete them manually.
  7. Switch back to Policy Mode and navigate to Networking > Segments.
    (Note: This may take a few minutes to update)
  8. Verify that the Ports / Interfaces column for the segment now reads 0.
  9. Once the port count is 0, proceed to delete the segment.

 

Additional Information

Steps to remove stale logical-port(s) in NSX-T after attempted delete : KB 91546