Skip to content

Commit

Permalink
fix: volume might be nil when returning an error
Browse files Browse the repository at this point in the history
`volume` might be nil when returning an erorr of the function
`loadVolume` and `deltaOps.UpdateBackupStatus` needs `volume.Name`
when leaving the function.

Signed-off-by: James Lu <[email protected]>
  • Loading branch information
mantissahz committed Mar 5, 2024
1 parent 1f642a5 commit 072417d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion deltablock.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,10 @@ func CreateDeltaBlockBackup(backupName string, config *DeltaBackupConfig) (isInc
defer func() {
if err != nil {
log.WithError(err).Error("Failed to create delta block backup")
deltaOps.UpdateBackupStatus(snapshot.Name, volume.Name, string(types.ProgressStateError), 0, "", err.Error())
updateError := deltaOps.UpdateBackupStatus(snapshot.Name, config.Volume.Name, string(types.ProgressStateError), 0, "", err.Error())
if updateError != nil {
log.WithError(updateError).Error("Failed to update the Backup status by deltaOps.")
}
}
}()

Expand Down

0 comments on commit 072417d

Please sign in to comment.