check vsc null pointer

Signed-off-by: 李龙峰 <lilongfeng@inspur.com>
This commit is contained in:
李龙峰
2022-08-22 14:44:17 +08:00
parent 5b6d361bc9
commit 5cddaeae6c
2 changed files with 5 additions and 0 deletions
@@ -0,0 +1 @@
check vsc null pointer
+4
View File
@@ -951,6 +951,10 @@ func (c *backupController) deleteVolumeSnapshot(volumeSnapshots []*snapshotv1api
if vs.Status.BoundVolumeSnapshotContentName != nil &&
len(*vs.Status.BoundVolumeSnapshotContentName) > 0 {
vsc = vscMap[*vs.Status.BoundVolumeSnapshotContentName]
if nil == vsc {
logger.Errorf("Not find %s from the vscMap", vs.Status.BoundVolumeSnapshotContentName)
return
}
if vsc.Spec.DeletionPolicy == snapshotv1api.VolumeSnapshotContentDelete {
modifyVSCFlag = true
}