-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
check vsc null pointer #5217
check vsc null pointer #5217
Conversation
The changelog filename doesn't match the PR, since a new PR was created. You need to rename "changelogs/unreleased/5213-lilongfeng0902" to "changelogs/unreleased/5217-lilongfeng0902" in this PR. |
Thanks for your review, I have did it. |
271a0d3
to
3cb0d9c
Compare
Codecov Report
@@ Coverage Diff @@
## main #5217 +/- ##
==========================================
+ Coverage 41.60% 41.67% +0.07%
==========================================
Files 215 216 +1
Lines 18643 18794 +151
==========================================
+ Hits 7756 7833 +77
- Misses 10309 10377 +68
- Partials 578 584 +6
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Thanks for the effort. |
66b8ed8
to
e38635c
Compare
I squash the commit into one, and force push the commit. Thanks. |
pkg/controller/backup_controller.go
Outdated
@@ -951,8 +951,11 @@ func (c *backupController) deleteVolumeSnapshot(volumeSnapshots []*snapshotv1api | |||
if vs.Status.BoundVolumeSnapshotContentName != nil && | |||
len(*vs.Status.BoundVolumeSnapshotContentName) > 0 { | |||
vsc = vscMap[*vs.Status.BoundVolumeSnapshotContentName] | |||
if vsc.Spec.DeletionPolicy == snapshotv1api.VolumeSnapshotContentDelete { | |||
if nil != vsc && vsc.Spec.DeletionPolicy == snapshotv1api.VolumeSnapshotContentDelete { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I didn't notice this in last review. It should be something like this.
if nil == vsc {
logger.Errorf("Not find %s from the vscMap", vs.Status.BoundVolumeSnapshotContentName)
return
}
if vsc.Spec.DeletionPolicy == snapshotv1api.VolumeSnapshotContentDelete {
modifyVSCFlag = true
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I didn't notice this in last review. It should be something like this.
if nil == vsc { logger.Errorf("Not find %s from the vscMap", vs.Status.BoundVolumeSnapshotContentName) return } if vsc.Spec.DeletionPolicy == snapshotv1api.VolumeSnapshotContentDelete { modifyVSCFlag = true }
Yes,that's look like good, I have did that. Please check again. Thank you.
bd70913
to
961bea6
Compare
pkg/controller/backup_controller.go
Outdated
@@ -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 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it be nil== vsc
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you're right. Too careless……
Signed-off-by: 李龙峰 <[email protected]>
479200b
to
5cddaea
Compare
Thank you for contributing to Velero!
Please add a summary of your change
Fix a little problem, add a null pointer to judge.
Does your change fix a particular issue?
none
Fixes #(issue)
none
Please indicate you've done the following:
/kind changelog-not-required
as a comment on this pull request.site/content/docs/main
.Signed-off-by: 李龙峰 [email protected]