Internal Server Error when deleting vApp snapshot: violates foreign key constraint "fk_vm_snap_disk2vm_snapshot"
search cancel

Internal Server Error when deleting vApp snapshot: violates foreign key constraint "fk_vm_snap_disk2vm_snapshot"

book

Article ID: 432341

calendar_today

Updated On:

Products

VMware Cloud Director

Issue/Introduction

  • Deleting a vApp snapshot fails with the following error after 5 minutes:

    [ ########-####-####-####-############ ] Internal Server Error
    - Could not execute JDBC batch update; SQL [/* Method: unknown */ /* delete com.vmware.vcloud.common.model.VAppSnapshotModel */ delete from vapp_snapshot where id=?]; constraint [fk_vm_snap_disk2vm_snapshot]; nested exception is org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
    - Batch entry 0 /* Method: unknown */ /* Method: unknown */ /* delete com.vmware.vcloud.common.model.VAppSnapshotModel */ delete from vapp_snapshot where id=('########-####-####-####-############'::uuid) was aborted: ERROR: update or delete on table "vm_snapshot" violates foreign key constraint "fk_vm_snap_disk2vm_snapshot" on table "vm_snapshot_disk"
      Detail: Key (id)=(########-####-####-####-############) is still referenced from table "vm_snapshot_disk".  Call getNextException to see other errors in the batch.


  • The snapshot deletion task keeps running on the vCenter Server.

Environment

VMware Cloud Director 10.6.x

Cause

This issue occurs because Cloud Director prematurely considers the virtual machine snapshot deletion task as completed after 5 minutes, even though the task is still running on vCenter.
Consequently, deleting the vApp snapshot fails with a foreign key constraint violation because the VM snapshot data still exists in the database.

Resolution

This issue is planned to be resolved in a future release.

Even if this error occurs, the snapshot deletion process continues on the vCenter Server.
Once the snapshot deletion is completed on the vCenter Server, the snapshot information is reflected in Cloud Director, and the vApp snapshot will no longer be displayed.
Therefore, this error can be safely ignored.

Additional Information

If the vCenter snapshot deletion takes over 20 minutes, Cloud Director cancels the task, leaving the VM in a "Consolidation Needed" status.
If this happens, there are two options.

Option 1: Consolidate the disks from Cloud Director while the VM is powered off
Power off the virtual machine in Cloud Director, then select All Actions > Consolidate Disks to perform the consolidation.
(Note: The virtual machine cannot be powered on until the consolidation process is complete.)

Option 2: Extend the VCD snapshot removal timeout
Extend the snapshot removal timeout value in Cloud Director, then create and delete a snapshot to clear the state.
As changing the default timeout involves making modifications to the Cloud Director database, please contact Technical Support and note this Knowledge Article ID (432341) in the problem description. For more information, see Creating and managing Broadcom cases.