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 committed Jun 15, 2022
1 parent fde32a1 commit 43b2b39
Showing 1 changed file with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,31 @@ private void auditLog(AuditLogType type) {
auditLogDirector.log(this, type);
}

@Override
public AuditLogType getAuditLogTypeValue() {
VmBackup vmBackup = getParameters().getVmBackup();
addCustomValue("VmName", getVm().getName());
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:
if (!getSucceeded()) {
return AuditLogType.VM_BACKUP_FAILED;
}
if (vmBackup.getPhase() == VmBackupPhase.SUCCEEDED) {
return AuditLogType.VM_BACKUP_SUCCEEDED;
}
}
return null;
}

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

0 comments on commit 43b2b39

Please sign in to comment.