In a federated NSX environment, attempts to remove a Global Segment may fail due to existing virtual machines connected to the segment in a Local Manager. When this occurs, the deletion request is rejected by the Global Manager and returns the following error:Error: The API deleteInfraSegmentPort is invalid on the global manager. (Error code: 500518)
VM connections are managed by Local Managers. If a Global Segment still has VMs connected at another site, the Global Manager considers it in use and blocks deletion.
To verify whether a Global Segment still has VM attachments at a specific site, the following Local Manager API can be used:
{ "results" : [ ], "result_count" : 0, "sort_by" : "display_name", "sort_ascending" : true}If segment ports are returned, virtual machines are still connected to the Global Segment at that site, which prevents deletion from the Global Manager.
See: Scripted cleanup of stale logical ports on NSX segments if there are no VMs connected to the segment but it still shows ports are in use.