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>
(cherry picked from commit b810121)
  • Loading branch information
mantissahz authored and David Ko committed Oct 31, 2023
1 parent b099f98 commit 2598e7a
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 @@ -325,8 +325,10 @@ func (bvc *BackupVolumeController) reconcile(backupVolumeName string) (err error
"backupvolume": backupVolumeName,
"backuptarget": backupURL}).Warnf("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 2598e7a

Please sign in to comment.