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.
- \d+ ui_vm_lease_list_view
- \d+ admin_vm_view
- Scroll down until you see the reference View definition: and copy everything between the following SELECT and the ending semicolon ‘;’.
- You should have two separate sets of SQL which you will need later to recreate the views.
- Drop the two views.
- drop view if exists ui_vm_lease_list_view;
- drop view if exists admin_vm_view;
- Increase the column length of the offending base table.
- 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.
- create view ui_vm_lease_list_view as<SELECT and the ending semicolon ‘;’>
- create view admin_vm_view as<SELECT and the ending semicolon ‘;’>
- Change the ownership of the Views to vcloud.
- alter view ui_vm_lease_list_view owner to vcloud;
- 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.