Close

vCenter gets disconnected in vCloud Director

In this article, I am going to guide you how to implement workaround to reconnect vCenter in vCloud Director

Symptoms

  • vCenter Server disconnects from Cloud Director every few minutes
  • Within the log file /opt/vmware/vcloud-director/logs/vcloud-container-debug.log file the following error is observed.

2023-10-19 07:14:02,188 | DEBUG    | pc-activity-pool-24520    | CJob                           | updateFailedJob(com.vmware.ssdc.util.LMException) with locale=null |
com.vmware.ssdc.util.LMException: Error caused vCenter Server disconnect
        at com.vmware.ssdc.backend.vimeventlistener.VirtualCenterListener.onVirtualCenterConnectionStateChanged(VirtualCenterListener.java:108)
        at com.vmware.vcloud.inventory.events.impl.VirtualCenterConnectionChangedEvent.dispatchTo(VirtualCenterConnectionChangedEvent.java:39)
Caused by: java.sql.BatchUpdateException: Batch entry 0 /* Method: unknown */ /* Method: unknown */ /* update com.vmware.vcloud.common.model.inventory.VirtualMachineInvModel */ update vm_inv set <values>::uuid was aborted: ERROR: value too long for type character varying(128)  Call getNextException to see other errors in the batch.

Caused by: org.postgresql.util.PSQLException: ERROR: value too long for type character varying(128)

Cause

This issue occurs when the VcPropertyCollectorJob tries to sync a Virtual Machine which has a Guest OS name which is longer than 128 characters.

To resolve the issue upgrade to Cloud Director 10.5.1

Workaround

  • Take backup the Cloud Director database.’
  • SSH to the Primary Cell
  • Run the command: sudo -i -u postgres psql vcloud
  • Gather the definitions of the following views: admin_vm_view, ui_vm_lease_list_view.
    1. \d+ ui_vm_lease_list_view
    2. \d+ admin_vm_view
    3. Scroll down until you see the reference View definition: and copy everything between the following SELECT and the ending semicolon ‘;’.
    4. You should have two separate sets of SQL which you will need later to recreate the views.
  • Drop the two views.
    1. drop view if exists ui_vm_lease_list_view;
    2. drop view if exists admin_vm_view;
  • Increase the column length of the offending base table.
    1. ALTER TABLE vm_inv ALTER COLUMN tools_guest_full_name TYPE varchar(512);
  • Recreate admin_vm_view and ui_vm_lease_list_view using the data collected in the earlier step above.
    1. create view ui_vm_lease_list_view as<SELECT and the ending semicolon ‘;’>
    2. create view admin_vm_view as<SELECT and the ending semicolon ‘;’>
  • Change the ownership of the Views to vcloud.
    1. alter view ui_vm_lease_list_view owner to vcloud;
    2. alter view admin_vm_view owner to vcloud;
  • Reconnect vCenter Server within Cloud Director.

I hope this article has been informative. thank you for reading.

Leave a Reply

Your email address will not be published. Required fields are marked *