Workload Domain Import Fails Due to Stale ESXi Host Entries in SDDC Manager
search cancel

Workload Domain Import Fails Due to Stale ESXi Host Entries in SDDC Manager

book

Article ID: 436010

calendar_today

Updated On:

Products

VMware SDDC Manager / VCF Installer

Issue/Introduction

  • Workload domain import fails when attempting to reuse the same vCenter and ESXi host names after a previous workload domain deletion and component reset.
  • The SDDC Manager logs report an InventoryAlreadyExistsException in the /var/log/vmware/vcf/commonsvcs/vcf-commonsvcs.log file, indicating that the ESXi hosts are still registered in the inventory: 

    ERROR [common,######-###-###-###-############ ,39##] [c.v.e.s.i.s.EsxiInventoryServiceImpl,http-nio-##########-###-92] ESXi <hostname> already exist: ######-###-###-###-############  <hostname> already exists

    ERROR [common,######-###-###-###-############ ,39##] [c.v.e.s.i.s.e.DomainExtensionsImpl,http-nio-##########-###-92] Failed to post domain inventory com.vmware.evo.sddc.inventory.model.InventoryAlreadyExistsException: ######-###-###-###-############  <hostname> already exists

Environment

VMware Cloud Foundation 9.0.1

Cause

The issue is caused by stale ESXi host records persisting in the SDDC Manager PostgreSQL database following the deletion of the original workload domain. Although the workload domain was removed, the associated host entries were not correctly cleared, resulting in a database conflict during subsequent import attempts using the same host names.

Resolution

Safety Warning: Take a snapshot of the SDDC Manager VM via vCenter before performing any database operations.

  1. SSH into the SDDC Manager as the vcf user, then elevate to root privileges.
  2. Connect to the platform database:
    • psql --host=localhost -U postgres -d platform

  3. Identify the stale host record(s) using the following queries:
    • If the FQDN of ESXi host is known
      • select id, hostname, status from host where hostname='<FQDN>';
    • If the FQDN is unknown, then 
      • select id, hostname, status from host where status='ERROR';
      • select id, hostname, status from host where status='DEACTIVATING';
  4.  If any hosts show a status of ERROR or DEACTIVATING, do not proceed with manual deletion. Refer to the knowledge base article, Unable to remove ESXi host from VCF SDDC manager due to database mismatch | Steps to remove ESXi Hosts from the SDDC Manager DB
  5. To list all hosts and their current status:
    •  SELECT id, hostname, management_ip_address, status FROM host;
  6. If the host is confirmed as stale, remove the record::
    • DELETE FROM host WHERE hostname='<hostname_of_stale_host>';
  7. Exit the database by typing \q
  8. Restart all SDDC Manager services and wait several minutes for them to initialize before retrying the workload domain import.
    • /opt/vmware/vcf/operationsmanager/scripts/cli/sddcmanager_restart_services.sh