Skip to content
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 nil pointer dereference error in volume_stat_calculator #79851

Merged
merged 1 commit into from Jul 25, 2019

Conversation

@jparklab
Copy link
Contributor

commented Jul 6, 2019

volume_stat_calculator expects GetMetrics function to return MetricsError error
with ErrCodeNotSupported code when driver for the volume
does not support metrics
Updated csi_metrics to return error when underlying csi
driver does not have GET_VOLUME_STATS capability

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespaces from that line:

/kind api-change

/kind bug

/kind cleanup
/kind design
/kind documentation
/kind failing-test
/kind feature
/kind flake

What this PR does / why we need it:

kubelet panics inside volume_stat_calculator since the function expects GetMetrics function to return non nil value for metrics when err is nil. However, csi_metrics returns nil for both metrics, and error when the driver does not support metrics.

Which issue(s) this PR fixes:

Fixes #79719

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

Fixed a bug in the CSI metrics that does not return not supported error when a CSI driver does not support metrics.
Return MetricsError with ErrCodeNotSupported code
GetMetrics function expects MetricsError error
with ErrCodeNotSupported code when driver for the volume
does not support metrics
Updated csi_metrics to return error when underlying csi
driver does not have GET_VOLUME_STATS capability
@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

commented Jul 6, 2019

Welcome @jparklab!

It looks like this is your first PR to kubernetes/kubernetes 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/kubernetes has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

commented Jul 6, 2019

Hi @jparklab. 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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions 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/test-infra repository.

@neolit123

This comment has been minimized.

Copy link
Member

commented Jul 7, 2019

/ok-to-test
/priority backlog

@msau42

This comment has been minimized.

Copy link
Member

commented Jul 19, 2019

@humblec

This comment has been minimized.

Copy link
Contributor

commented Jul 25, 2019

@jparklab If I remember the discussions we had while working on metrics PR, its perfectly fine to return nil in error if the plugin does not support metrics. If thats the case, it should be volume stat calculator who should accommodate this scenario. @gnufied can give final word on this.

@gnufied can you review this PR and issue?

@gnufied

This comment has been minimized.

Copy link
Member

commented Jul 25, 2019

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm label Jul 25, 2019

@gnufied

This comment has been minimized.

Copy link
Member

commented Jul 25, 2019

/approve

@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

commented Jul 25, 2019

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gnufied, jparklab

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@gnufied

This comment has been minimized.

Copy link
Member

commented Jul 25, 2019

@jparklab can you also backport to 1.15 ? Thank you!

@gnufied

This comment has been minimized.

Copy link
Member

commented Jul 25, 2019

@jparklab can you add a release-note since we are going to backport this to 1.15.

@k8s-ci-robot k8s-ci-robot merged commit 0e3b593 into kubernetes:master Jul 25, 2019

22 of 23 checks passed

pull-kubernetes-kubemark-e2e-gce-big Job triggered.
Details
cla/linuxfoundation jparklab authorized
Details
pull-kubernetes-bazel-build Job succeeded.
Details
pull-kubernetes-bazel-test Job succeeded.
Details
pull-kubernetes-conformance-image-test Skipped.
pull-kubernetes-cross Skipped.
pull-kubernetes-dependencies Job succeeded.
Details
pull-kubernetes-e2e-gce Job succeeded.
Details
pull-kubernetes-e2e-gce-100-performance Job succeeded.
Details
pull-kubernetes-e2e-gce-csi-serial Job succeeded.
Details
pull-kubernetes-e2e-gce-device-plugin-gpu Job succeeded.
Details
pull-kubernetes-e2e-gce-iscsi Skipped.
pull-kubernetes-e2e-gce-iscsi-serial Skipped.
pull-kubernetes-e2e-gce-storage-slow Job succeeded.
Details
pull-kubernetes-godeps Skipped.
pull-kubernetes-integration Job succeeded.
Details
pull-kubernetes-local-e2e Skipped.
pull-kubernetes-node-e2e Job succeeded.
Details
pull-kubernetes-node-e2e-containerd Job succeeded.
Details
pull-kubernetes-typecheck Job succeeded.
Details
pull-kubernetes-verify Job succeeded.
Details
pull-publishing-bot-validate Skipped.
tide In merge pool.
Details
@jparklab

This comment has been minimized.

Copy link
Contributor Author

commented Jul 26, 2019

@gnufied Of course! I created PR for backporting to 1.15 #80614

Thanks for reminding me of the release note. I added one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.