check vsc null pointer

Signed-off-by: 李龙峰 <lilongfeng@inspur.com>
This commit is contained in:
李龙峰
2022-08-16 09:28:57 +08:00
committed by Ming
parent 61b247419c
commit 3de8be83f4
2 changed files with 5 additions and 0 deletions

View File

@@ -0,0 +1 @@
check vsc null pointer

View File

@@ -940,6 +940,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
}