Error: 'ERROR: update or delete on table "vdc_compute_policy" violates foreign key constraint "fk_vapp_vm2vdc_comp_poli" on table "vapp_vm" ' when trying to remove an OrgVDC from Cloud DIrector
search cancel

Error: 'ERROR: update or delete on table "vdc_compute_policy" violates foreign key constraint "fk_vapp_vm2vdc_comp_poli" on table "vapp_vm" ' when trying to remove an OrgVDC from Cloud DIrector

book

Article ID: 367453

calendar_today

Updated On:

Products

VMware Cloud Director

Issue/Introduction

  • Unable to delete old OrgVDC or merge Provider VDC. Errors when deleting OrgVDC after performing V2T Cloud or merging Provider VDCs:

    [UUID ] Internal Server Error
     - could not delete: [com.vmware.vcloud.common.model.logicalresource.StorageClassVdcLogicalResourceModel#UUID]
     - ERROR: update or delete on table "vdc_logical_resource" violates foreign key constraint "fk_vap_vm_scl_me2vdc_logi_reso" on table "vapp_vm_sclass_metrics"
      Detail: Key (id)=(UUID) is still referenced from table "vapp_vm_sclass_metrics".

  • You can receive the below error too:

    [ UUID ] Internal Server Error
    - could not execute update query; SQL [delete from vdc_compute_policy where is_auto_generated=? and (id in (? , ?))]; constraint [fk_vapp_vm2vdc_comp_poli]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute update query- could not execute update query - ERROR: update or delete on table "vdc_compute_policy" violates foreign key constraint "fk_vapp_vm2vdc_comp_poli" on table "vapp_vm"
      Detail: Key (id)=(UUID) is still referenced from table "vapp_vm".

Environment

VMware Cloud Director 10.6.1

Cause

V2T migration can cause incorrect data in Cloud Director Database where the storage metrics table or the compute tables do not contain the correct information.

Resolution

Correcting this issue requires database edits.  To work around this issue, open a new case with the Broadcom VMware Cloud Foundation Support Team providing the kb number(367453) . For more information, see How to Submit a Support Request