This article would guide on how to remove Stale entries of NSX-T Manager Node using NSX API.

Recently, in my lab, I came across an issue while resizing NSX Manager Nodes from Medium to Large (VMware Doc mentioned here).

As per the article, I deployed a temporary node selecting “Large” as the appliance size with a new Name & IP. Once the cluster (with 4 nodes) got to a stable state, I deleted one of the old nodes. This worked fine for the first 2 nodes, however, when I went to do the same activity on the 3rd node (which was actually the primary node), I was unable to deploy a temporary node as it reported that, the name I am trying to assign, is already in use.

Notifications
<Date>: Http failure response for https://<nsxmgr>/api/v1/cluster/nodes/deployments: 400 OK
Error message: The specified hostname <Hostname> is already in use by an existing node VM. Duplicates of hostnames are not allowed. (Error code: 21016)

I checked that the name it is reporting in the error, used to be one of the nsx manager nodes. 

Logged into NSX CLI and confirmed that get cluster status showed correct/new hostnames for nsx nodes however, get nodes showed old names. 

Suspected a stale entry causing the issue.

Logged into one of the NSX Managers with root credentials and ran below command

curl -X GET https://localhost/api/v1/cluster/nodes/deployments -u admin:<admin_password> -k

Output would look like this

{
  “results” : [ {
    “vm_id” : “<>”,
    “roles” : [ “MANAGER”, “CONTROLLER” ],
    “form_factor” : “MEDIUM”,
    “user_settings” : {
      “cli_username” : “<>”
    },
    “deployment_config” : {
      “vc_id” : “<>”,
      “compute_id” : “<>”,
      “storage_id” : “<>”,
      “management_network_id” : “<>”,
      “management_port_subnets” : [ {
        “ip_addresses” : [ “<>” ],
        “prefix_length” : <>
      } ],
      “default_gateway_addresses” : [ “<>” ],
      “hostname” : “<>”,
      “ntp_servers” : [ “<>” ],
      “dns_servers” : [ “<>” ],
      “enable_ssh” : true,
      “allow_ssh_root_login” : true,
      “placement_type” : “VsphereClusterNodeVMDeploymentConfig”
    }
  }, {
    “vm_id” : <>,


To confirm, if that worked, ran below command
curl -X GET https://localhost/api/v1/cluster/nodes/deployments -u admin:<admin_password> -k

Re-tried deploying nsx manager node and this time, I was able to deploy with the same name that I wanted to use.

Hope this helps!