Steps to remove stale logical-port(s) in NSX-T after attempted delete
search cancel

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

book

Article ID: 319115

calendar_today

Updated On:

Products

VMware NSX

Issue/Introduction

  • While attempting to delete a logical port, that is you detached a VM from the segment, but the port is still present in the NSX-T UI.

  • In policy view, for the segment, the segment port shows as Admin Status Up and Status Success.

  • In manager view for the logical switch, Admin Status is Up, but Operational Status is Down.

  • In the NSX-T manager log /var/log/search/search-manager.log you see the following log entries:
36804:20##-##-##T##:##:##.591Z INFO TopologyEventHandler TopologyIndexer 6090 - [nsx@6876 comp="nsx-manager" level="INFO" subcomp="manager"] No VIF found for attachment id:<Logical Port UUID>

Note:
The preceding log excerpts are only examples. Date, time, and environmental variables may vary depending on your environment.

Environment

VMware NSX-T

Cause

The stale logical ports are left behind, when the detach operation occurred, due to the port delete not being successful.

Resolution

This is a known issue Impacting NSX-T.

Workaround:

In the NSX-T manager UI, under Policy view, find the port (Networking > Segments > click on blue number of Ports for Segment), click the ellipsis (3 vertical dots) of the port, and select the Delete option.

If this operation fails, you can use the below API call the with the HEADER x-allow-overwrite = true to remove the logical port:

  • DELETE /api/v1/logical-ports/<Logical-Port-UUID>?detach=true

  • Steps:

    • Login to the NSX-T manager as user admin.

    • Switch to root account using the command "st  en"

    • Run the following command to delete the logical-port(s)

      curl -l -k -u 'admin' -H 'Content-Type:application/json' -H 'X-Allow-Overwrite: true' -X DELETE "https://<nsx-manager-ip>/api/v1/logical-ports/<Logical Port UUID>?detach=true" 

      Where Logical Port UUID is the port id to be deleted.

      For example the below highlighted is the port id for VM <VM-name>. 



    • The port uuid  we can be obtained from the Manager view in NSX ie Networking ---> Logical Switches ---> Click on the Logical Switch


Alternatively, you can force delete the logical switch with the following API call directly, or in curl format: 

  • DELETE /api/v1/logical-switches/<logical-switch-UUID>?detach=true&cascade=true

  • curl -l -k -u 'admin' -H 'Content-Type:application/json' -H 'X-Allow-Overwrite: true' -X DELETE "https://<nsx-manager-ip>/api/v1/logical-switches/<logical-switch-UUID>?detach=true&cascade=true"
Name

Description

Type Notes
cascade Delete a Logical Switch and all the logical ports in it, if none of the logical ports have any attachment. boolean Default: "False"
detach Force delete a logical switch

If this is set to true, then logical switch is deleted
regardless of whether or not it is added to NSGroup.
If cascade is set to true in the meantime, then logical
switch and all logical ports are deleted regardless of
whether any logical port in this switch has attachments.
boolean Default: "False"

 

Additional Information

For additional information on the API details: NSX-T Data Center REST API