Configuring a new replication fails for a virtual machine with multiple disks in Cloud Director Availability 4.x
search cancel

Configuring a new replication fails for a virtual machine with multiple disks in Cloud Director Availability 4.x

book

Article ID: 315057

calendar_today

Updated On:

Products

VMware Cloud Director

Issue/Introduction

Symptoms:

  • When configuring a new replication, the task fails and you see an error similar to:
Operation aborted due to an unexpected error.
  • This issue occurs when the source virtual machine has multiple disks.
  • In the /opt/vmware/h4/replcator/log/replicator.log file on the destination Replicator Appliance, you see entries similar to:
2022-11-17 16:31:46.080  WARN - [UI-########-####-####-####-########e6ea-r11650-Cy-IV-6T-Il] [job-15] o.h.engine.jdbc.spi.SqlExceptionHelper   : SQL Error: 0, SQLState: 23505
2022-11-17 16:31:46.080 ERROR - [UI-########-####-####-####-########e6ea-r11650-Cy-IV-6T-Il] [job-15] o.h.engine.jdbc.spi.SqlExceptionHelper   : ERROR: duplicate key value violates unique constraint "replication_disk_pkey"
  Detail: Key (disk_id, replication_replication_id)=(########-####-####-####-########9f65, H4-########-####-####-####-########9df5) already exists.
2022-11-17 16:31:46.081  INFO - [UI-########-####-####-####-########e6ea-r11650-Cy-IV-6T-Il] [job-15] o.h.e.j.b.internal.AbstractBatchImpl     : HHH000010: On release of batch it still contained JDBC statements
2022-11-17 16:31:46.083 ERROR - [UI-########-####-####-####-########e6ea-r11650-Cy-IV-6T-Il] [job-15] com.vmware.h4.jobengine.JobExecution     : Task ########-####-####-####-########a377 (WorkflowInfo{type='setupDestination', resourceType='replication', resourceId='H4-########-####-####-####-########9df5', isPrivate=false, resourceName='null'}) has failed

org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [replication_disk_pkey]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement
        at org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:276)
        at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:233)
        at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:566)
        ...
Caused by: org.hibernate.exception.ConstraintViolationException: could not execute statement
        at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:109)
        at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:37)
        at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113)
        ...
Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "replication_disk_pkey"
  Detail: Key (disk_id, replication_replication_id)=(########-####-####-####-########9f65, H4-########-####-####-####-########9df5) already exists.
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2675)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2365)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:355)
        ...
  • Alternatively, in the /opt/vmware/h4/replcator/log/replicator.log file on the destination Replicator Appliance, you may instead see an entry similar to:
2022-11-17 16:37:54.357 ERROR - [UI-########-####-####-####-########e6ea-r12246-Bt-2F-Vd-kT] [job-20] com.vmware.h4.jobengine.JobExecution     : Task ########-####-####-####-########c928 (WorkflowInfo{type='setupDestination', resourceType='replication', resourceId='H4-########-####-####-####-########2883', isPrivate=false, resourceName='null'}) has failed

org.springframework.dao.DataIntegrityViolationException: A different object with the same identifier value was already associated with the session : [com.vmware.h4.replicator.model.ReplicaDiskEntity#com.vmware.h4.replicator.model.ReplicaDiskEntity$ReplicationDiskUuid@5c2d1264]; nested exception is javax.persistence.EntityExistsException: A different object with the same identifier value was already associated with the session : [com.vmware.h4.replicator.model.ReplicaDiskEntity#com.vmware.h4.replicator.model.ReplicaDiskEntity$ReplicationDiskUuid@5c2d1264]
        at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:400)
        at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:235)
        at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:566)
        ...
Caused by: javax.persistence.EntityExistsException: A different object with the same identifier value was already associated with the session : [com.vmware.h4.replicator.model.ReplicaDiskEntity#com.vmware.h4.replicator.model.ReplicaDiskEntity$ReplicationDiskUuid@5c2d1264]
        at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:123)
        at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:181)
        at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:188)
        ...


Note: The preceding log excerpts are only examples. Date, time, and environmental variables may vary depending on your environment.

Environment

VMware Cloud Director Availability 4.x

Cause

This issue occurs when two or more of the source virtual machine's disks have the same UUID. Cloud Director Availability does not allow the same disk UUID to be used multiple times per replication group to ensure each of the virtual machine's disks are replicated only once.

Resolution

To resolve this issue, change the UUID of the impacted disks on the source virtual machine so that each disk as a unique UUID.

Note: This procedure results in downtime for the impacted virtual machine as it requires for the machine to be powered off to perform the necessary actions.
  1. In the source site, power off the source virtual machine.
  2. SSH to the ESXi host that manages the virtual machine and log in as root.
  3. List the UUIDs for each of the virtual machine's disk descriptor files:
vmkfstools -J getuuid /vmfs/volumes/datastoreName/vmName/vmName.vmdk
  1. For a disk with a duplicate UUID, run the following command to generate a new UUID:
vmkfstools -J setuuid /vmfs/volumes/datastoreName/vmName/vmName.vmdk
  1. Obtain the inventory ID (Vmid) for the virtual machine:
vim-cmd vmsvc/getallvms | grep vmName
  1. Using the inventory ID reload the vmx file to ensure vCenter Server is aware of the disk UUID changes:
vim-cmd vmsvc/reload Vmid
  1. Power on the virtual machine.
  2. With each of the disks now having unique UUIDs, you can attempt to configure it for replication again.