Skip to content

Commit

Permalink
core: produce successful event if backup finished successfully
Browse files Browse the repository at this point in the history
Even if we were unable to remove the auto-generated snapshot, the backup
will be considered successful. This patch produces the right audit log
entry to indicate the backup did not fail.

Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
  • Loading branch information
bennyz authored and ahadas committed Jun 21, 2022
1 parent b4dda15 commit a44d239
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,25 @@ private void auditLog(AuditLogType type) {
auditLogDirector.log(this, type);
}

@Override
public AuditLogType getAuditLogTypeValue() {
VmBackup vmBackup = getParameters().getVmBackup();
addCustomValue("backupId", vmBackup.getId().toString());
switch (getActionState()) {
case EXECUTE:
return AuditLogType.VM_BACKUP_STARTED;
case END_FAILURE:
if (vmBackup.getPhase() == VmBackupPhase.SUCCEEDED) {
return AuditLogType.VM_BACKUP_SUCCEEDED;
}

return AuditLogType.VM_BACKUP_FAILED;
case END_SUCCESS:
return AuditLogType.VM_BACKUP_SUCCEEDED;
}
return null;
}

@Override
protected void restoreCommandState() {
Guid backupId = getParameters().getVmBackup().getId();
Expand Down

0 comments on commit a44d239

Please sign in to comment.