I ran into an issue with NSX in the home lab where a new NSX controller was deploying and a power outage interrupted the deployment. This left me in a state of deploying forever. After waiting a day and being in the same state I removed the inoperable virtual machine from vCenter. The issue persisted in NSX.
As you can see controller-18 is forever deploying. The NSX manager command line showed it as deploying so it’s a database issue somewhere. Since the deployment action was in place it was impossible to remove the controller and the cluster health was bad with only two controllers. I don’t have any magic method for working with the NSX manager database (I assume it’s postgres but I really don’t know) other than the API. So off to the API I went. First I wanted to query for all controllers to make sure I had the correct name (ID field in picture above). So I setup my REST connection for
https://IP_of_Manager/api/2.0/vdn/controller
I returned that the ID is indeed controller-18. Once I knew the controller number is was a simple delete method with the right command line:
Removal via
https://nsx_manager_ip/api/2.0/vdn/controller/controller-18?forceRemoval=True
After this command I queried again to confirm it was gone:
Since 18 was my last controller it returned nothing. Hopefully if you have a stuck deploying NSX controller this article will help you remove it.
Thanks. This has been bothering me for a long time, but I never took the time to actually find how to do it via REST.
Glad it helped
Thanks. That really helped me figure out how this thing works.
Thanks for reading and posting a comment