Skip to content

Commit

Permalink
engine: Fix duplicate VM backup entry error when creating incremental…
Browse files Browse the repository at this point in the history
… backup

Fixes an issue that originates from ed023e5

 The following error occured when trying to create an incremental backup:

 ------
 ERROR [org.ovirt.engine.core.bll.storage.backup.HybridBackupCommand] (default task-1) [full_cold_vm_backup] Command 'org.ovirt.engine.core.bll.storage.backup.HybridBackupCommand' failed: CallableStatementCallback; SQL [{call insertvmbackup(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)}]; ERROR: duplicate key value violates unique constraint "vm_backups_pkey"
   Detail: Key (backup_id)=(1733241d-4a0b-4205-9e52-5383eb7a82f2) already exists.
 -----

 This was caused by using vmBackupDao.save() instead of vmBackupDao.update(), because the backup already existed when the setVmBackupSnapshot method is executed.

Signed-off-by: Brooklyn Dewolf <contact@brooklyn.gent>
  • Loading branch information
BrooklynDewolf authored and sandrobonazzola committed Jun 6, 2024
1 parent 80d6b0f commit 40a9a01
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ private void setVmBackupSnapshot(Guid snapshotId) {
VmBackup vmBackup = getParameters().getVmBackup();
vmBackup.setSnapshotId(snapshotId);
getParameters().setVmBackup(vmBackup);
vmBackupDao.save(vmBackup);
vmBackupDao.update(vmBackup);
persistCommandIfNeeded();
}
}

0 comments on commit 40a9a01

Please sign in to comment.