[cinder-csi-plugin] Fix panic when backup lookup fails in CreateSnapshot#3143
[cinder-csi-plugin] Fix panic when backup lookup fails in CreateSnapshot#3143immanuwell wants to merge 1 commit into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Welcome @immanuwell! |
|
Hi @immanuwell. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Tip We noticed you've done this a few times! Consider joining the org to skip this step and gain Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
What this PR does / why we need it:
This fixes a nil pointer panic in the cinder CSI backup snapshot path.
If
CreateSnapshotruns withsnapshotType=backup,ListBackupsfinds one match, andGetBackupByIDthen errors, the code dereferencesbackup.IDand blows up. Kinda nasty.The fix logs the already known backup ID from
ListBackupsand returnscodes.Internalcleanly.Which issue this PR fixes(if applicable):
fixes #
Special notes for reviewers:
Repro before this patch:
go test ./pkg/csi/cinder -run TestCreateSnapshotBackupGetBackupByIDError -count=1Before the fix this panics in
CreateSnapshot.With this patch it returns a normal gRPC internal error, so no crash, nice and boring.
Release note: