-
Notifications
You must be signed in to change notification settings - Fork 200
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
fix(usage): add nil checks to avoid panic #1720
Conversation
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.
lgtm
@@ -85,7 +85,10 @@ func (s *HTTPServer) volumeV1alpha1SpecificRequest(resp http.ResponseWriter, req | |||
switch req.Method { | |||
case "POST": | |||
cvol, err := volOp.create() | |||
pvc := cvol.ObjectMeta.Labels["openebs.io/persistent-volume-claim"] | |||
pvc := "" |
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.
rename to pvcName ?
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.
lgtm
Once a PVC create request is processed by the CAST, the response is inspected to fetch the PVC name and other details to generate an analytics log. This was done as part of the PR: #1708 This commit adds a nil check to handle the case of error response to avoid a panic. Signed-off-by: kmova <kiran.mova@mayadata.io>
Signed-off-by: kmova <kiran.mova@mayadata.io>
Signed-off-by: kmova <kiran.mova@mayadata.io>
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.
looks good.
Once a PVC create request is processed by the CAST, the response is inspected to fetch the PVC name and other details to generate an analytics log. This was done as part of the PR: #1708 This commit adds a nil check to handle the case of an error response to avoid a panic. Signed-off-by: kmova <kiran.mova@mayadata.io> (cherry picked from commit d70090d)
Signed-off-by: kmova kiran.mova@mayadata.io
Why is this PR required? What issue does it fix?:
openebs/openebs#3064
What this PR does?:
Adds nil checks to catch provisioning errors.
Does this PR require any upgrade changes?:
No
If the changes in this PR are manually verified, list down the scenarios covered::
Verified by creating a PVC with name > 63 chars long. The output shows the following error when
kubectl describe pvc
is executed.Verified by creating a PVC with name < 63 chars long. Volume gets created successfully.
Any additional information for your reviewer? :
Mention if this PR is part of any design or a continuation of previous PRs
Checklist:
<type>(<scope>): <subject>