Removing NSX Segments that are stuck in "Marked for Delete" state
book
Article ID: 303323
calendar_today
Updated On:
Products
VMware NSX
Issue/Introduction
Deleted Segments are stuck grayed out in the NSX-T UI and cannot be modified.
The API request: GET https://{mgrIP}/policy/api/v1/infra/segments may NOT list these segments, but they are listed with:
GET https://{mgrIP}/policy/api/v1/infra/segments?include_mark_for_delete_objects=true
The API request: DELETE https://{mgrIP}/policy/api/v1/infra/segments/<segment-id> returns a 404 response code, and the segment is not deleted
Environment
VMware NSX
Resolution
Follow these instructions only if:
There are no logical ports associated with this LS at both Policy/MP.
The Logical switch at the MP is deleted already and we have only Policy Object of LS.
When you run realization API, there is no realized object at MP for the intent path in question (LS in question)
Create a file with the paths of policy objects to delete. The file should have the below format, with comma-separated paths if multiple segments are to be deleted:
Note that the path provided should omit "/policy/api/v1/" from the full object path in the above API examples. The segment path can be obtained from the NSX UI by clicking Networking > Segments > clicking the three dots next to the segment name and choosing the option, "Copy Path to Clipboard".
Run cleanup API request reference the 'body' file created in the previous step: