VCF 4.0 – force removal of ERROR hosts from SDDC Manager

It may happen that decommission a host task in SDDC Manager will fail and no matter what you try to do it’s not possible to remove it successfully.

This blog post explains how to connect to the embedded vPostgres Database of a SDDC Manager and remove ‘orphaned’ hosts objects with ERROR status.

NOTE!!! you shouldn’t do that on prod. If you are unsure about removing db records, contact VMware Support for assistance. Modify at your own risk!

Before interacting with the embedded SDDC Manager database, ensure you have working backups and/or snapshots of the SDDC Manager vm.

Unfortunately, it is not possible to remove ‘orphaned’ objects like hosts from SDDC Manager GUI and that’s why you need to manipulate vPostgres database manually.

To remove ‘orphaned’ hosts from SDDC Manager db, records from host, host_and_cluster, host_and_domain, host_and_network_pool, and host_and_vcenter tables have to be deleted.

1. First ssh to SDDC Manager and switch to root. Connect to the embedded vPostgres platform database, use the psql command:

psql --host=localhost -U postgres -d platform

2. To enlist the available tables in the current database use \dt command.

3. Find all hosts with ERROR status  (possible status: ERROR, DEACTIVATING). Write down their ids.

select id, hostname, status from host where status='ERROR';

4. Delete all hosts from host table where status=’ERROR’;

delete from host where status='ERROR';

5. Delete ERROR hosts from host_and_cluster table where host_id=’xxxxxxxx’;

delete from host_and_cluster where host_id='xxxxxxxx';

6. Delete ERROR hosts from host_and_domain table where host_id=’xxxxxxxxx’;

delete from host_and_domain where host_id='xxxxxxxxx';

7. Delete ERROR hosts from host_and_network_pool table where host_id=’xxxxxxxx’;

delete from host_and_network_pool where host_id='xxxxxxxx';

8. And finally: delete all ERROR hosts from host_and_vcenter table where host_id=’xxxxxxxx’;

delete from host_and_vcenter where host_id='xxxxxxxx';

And preety much that’s it. If you go back to SDDC Manager GUI you will notice that all hosts with ERROR status are gone.

If you have any questions feel free to ping me:)