I ran into a problem recently when disabling NSX in my lab where I couldn’t remove a logical segment. This logical segment was previously attached to NSX Edge virtual machines. The logical segments still had a stale port, even after the Edge virtual machines were deleted.
Any attempt to delete the segment through UI/API resulted in the error “Segment has 1 VMs or VIFs attached. Disconnect all VMs and VIFs before deleting a segment.”
GUI Error
API Error
So how do I delete the stale segments in this case? The answer is through API, but before deleting the segments, you must delete the stale VIFs.
Follow the procedure given below to delete stale VIFs.
1: List Logical Ports associated with the Stale Segment
1 2 3 |
Method: GET URL: https://{{nsx_mgr}}/api/v1/logical-ports |
This API call will list all segments. You can pass the segment uuid in the above command to list a specific segment (stale one).… Read More