Friday, July 31, 2015

Unable to add standalone host - Already exists

So here were few hosts whose IP addresses were messed up that what it was in the host file (or in your case it might be DNS) and i corrected them via vCLI. After that i tried to add them but it was always throwing this error saying the ip already exists even though i was trying to add it using the hostname.
Then i just checked the vCenter server database---->Table---->dbo.vpx.host.  ---Right click and select 1000 rows and there they were, the ip address, the hostname. These are not in the vcenter anymore but they are in the vcenter server database.
I wanted to delete these entries here and then try to re add but my colleague ravi suggested an alternative.
I cleaned off the hostfile for these 2 clusters where these hosts (in maintenance mode) were there and then remove the clusters in which these hosts were supposed to be there. Automagically the stale entries in the database were gone. Now I was able to peacefully add the hosts back to the vcenter and the clusters in which they reside.
you might have to remove the entries for these hosts in the DNS and then do the same to get around it.