Removing NSX Segments that are stuck in "Marked for Delete" state
search cancel

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:

  1. There are no logical ports associated with this LS at both Policy/MP.
  2. The Logical switch at the MP is deleted already and we have only Policy Object of LS.
  3. When you run realization API, there is no realized object at MP for the intent path in question (LS in question)
  1. 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:
     
    cat body

    {
        "paths": [
            "/infra/segments/98b4578f-####-####-####-7ac2a594949b",
            "/infra/segments/775e03df-####-####-####-5be6b7da54cf",
            "/infra/segments/4dbc449c-####-####-####-0c9e9850b06b"
        ]
    }
     
    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".

  2. Run cleanup API request reference the 'body' file created in the previous step:

    curl -v -k -H "Content-Type: application/json" -u admin --request POST 'https://localhost/policy/api/v1/troubleshooting/infra/tree/realization?action=cleanup' -d @body

Additional Information