Skip to content

Commit

Permalink
fix(backup): backupInfo might be nil
Browse files Browse the repository at this point in the history
The backupInfo would be nil when we try to pull the backups from
remote backup target.

Ref: 6998

Signed-off-by: James Lu <james.lu@suse.com>
  • Loading branch information
mantissahz authored and David Ko committed Oct 31, 2023
1 parent d046b13 commit b810121
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions controller/backup_volume_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,10 @@ func (bvc *BackupVolumeController) reconcile(backupVolumeName string) (err error
"backupvolume": backupVolumeName,
"backuptarget": backupURL}).Warn("Failed to get backupInfo from remote backup target")
} else {
if accessMode, exist := backupInfo.Labels[types.GetLonghornLabelKey(types.LonghornLabelVolumeAccessMode)]; exist {
backupLabelMap[types.GetLonghornLabelKey(types.LonghornLabelVolumeAccessMode)] = accessMode
if backupInfo != nil && backupInfo.Labels != nil {
if accessMode, exist := backupInfo.Labels[types.GetLonghornLabelKey(types.LonghornLabelVolumeAccessMode)]; exist {
backupLabelMap[types.GetLonghornLabelKey(types.LonghornLabelVolumeAccessMode)] = accessMode
}
}
}

Expand Down

0 comments on commit b810121

Please sign in to comment.