Can not delete an NSX segment for an error "Disconnect all VMs and VIFs before deleting a segment." even though no VMs are connected
search cancel

Can not delete an NSX segment for an error "Disconnect all VMs and VIFs before deleting a segment." even though no VMs are connected

book

Article ID: 371939

calendar_today

Updated On: 11-20-2024

Products

VMware NSX

Issue/Introduction

  • You tried deleting an NSX segment but it failed for an error.
    Segment path=*** has N VMs or VIFs attached. Disconnect all VMs and VIFs before deleting a segment.
  • On NSX Manager GUI [Networking] - [Segments], [Ports / Interfaces] column of the segment is not zero.
  • No VMs are found to be connected to the segment in vSphere client.
  • You find the error message in policy.log
    Segment /infra/segments/[segment] has VMs attached. Please disconnect all VMs before deleting a segment.

Environment

VMware NSX-T

VMware NSX

Cause

There might be stale ports on the segment.

Resolution

You can manually delete the stale ports:

  1. Check the ports by clicking the non-zero number of [Ports / Interfaces] column of the segment.
  2. Make sure the VMs are not connected to the segment.
    If connected, connect the VMs to another NSX segment or portgroup.
  3. Switch to Manager mode.
  4. Navigate to [Networking] - [Logical Switches] - [Ports].
  5. Find the ports of step 1. and manually delete the ports.
  6. Go back to Policy mode [Networking] - [Segments], and make sure [Ports / Interfaces] column of the segment is zero.
    It might take a few minutes.
  7. Once [Ports / Interfaces] column of the segment is zero, you can delete the segment.

Or following the steps in this KB 91546 "Steps to remove stale logical-port(s) in NSX-T after attempted delete".