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

[cinder-csi-plugin] NodeGetVolumeStats() implementation #941

Merged
merged 6 commits into from
Apr 1, 2020

Conversation

zuzzas
Copy link
Contributor

@zuzzas zuzzas commented Feb 19, 2020

The binaries affected:

  • openstack-cloud-controller-manager
  • cinder-csi-plugin
  • k8s-keystone-auth
  • client-keystone-auth
  • octavia-ingress-controller
  • manila-csi-plugin
  • manila-provisioner
  • magnum-auto-healer
  • barbican-kms-plugin

What this PR does / why we need it:
Knowing Volume capabilities helps to sleep at night (also, capacity planning).

Which issue this PR fixes:
fixes #669

Special notes for reviewers:

The test is ugly right now. Should I mock a resizefs call?

Release note:

cinder-csi-plugin: Added support for GET_VOLUME_STATS node capability

This change is Reviewable

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Feb 19, 2020
@k8s-ci-robot
Copy link
Contributor

Hi @zuzzas. 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.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Feb 19, 2020
@theopenlab-ci
Copy link

theopenlab-ci bot commented Feb 19, 2020

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Feb 19, 2020

Build succeeded.

@jichenjc
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Feb 19, 2020
@theopenlab-ci
Copy link

theopenlab-ci bot commented Feb 19, 2020

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Feb 19, 2020

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Feb 19, 2020

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Feb 19, 2020

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Feb 19, 2020

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Feb 19, 2020

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Feb 19, 2020

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Feb 19, 2020

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Feb 19, 2020

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Feb 19, 2020

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Feb 19, 2020

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Feb 19, 2020

Build succeeded.

@lingxiankong
Copy link
Contributor

@ramineni please review this PR when you get time, thanks

Copy link
Contributor

@ramineni ramineni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zuzzas Thanks for the PR. Some initial comments inline

func (ns *nodeServer) NodeGetVolumeStats(ctx context.Context, req *csi.NodeGetVolumeStatsRequest) (*csi.NodeGetVolumeStatsResponse, error) {
return nil, status.Error(codes.Unimplemented, fmt.Sprintf("NodeGetVolumeStats is not yet implemented"))
func (ns *nodeServer) NodeGetVolumeStats(_ context.Context, req *csi.NodeGetVolumeStatsRequest) (*csi.NodeGetVolumeStatsResponse, error) {
klog.V(4).Infof("NodeExpandVolume: called with args %+v", *req)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/NodeExpandVolume/NodeGetVolumeStats

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed!

func (ns *nodeServer) NodeGetVolumeStats(_ context.Context, req *csi.NodeGetVolumeStatsRequest) (*csi.NodeGetVolumeStatsResponse, error) {
klog.V(4).Infof("NodeExpandVolume: called with args %+v", *req)

volumePath := req.GetVolumePath()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function should comply with csi spec on required fields etc.
please run make test-cinder-csi-sanity and fix the issues respective to this function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All sanity test errors related to NodeGetVolumeStats are fixed. Some tests fail on other methods, but it seems to be out of the scope of this PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, Awesome!! Thanks.

}
return &csi.NodeGetVolumeStatsResponse{
Usage: []*csi.VolumeUsage{
{Total: capacity, Available: available, Used: usage, Unit: 1},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does Unit:1 mean?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Magic numbers are bad. Fixed!

@theopenlab-ci
Copy link

theopenlab-ci bot commented Feb 25, 2020

Build failed.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Feb 25, 2020

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Mar 27, 2020

Build failed.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Mar 27, 2020

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Mar 27, 2020

Build failed.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Mar 27, 2020

Build failed.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Mar 27, 2020

Build succeeded.

@zuzzas
Copy link
Contributor Author

zuzzas commented Mar 27, 2020

@lingxiankong
Now the unit tests fail. The log output is extremely hard to understand, is there an issue on my side?

@lingxiankong
Copy link
Contributor

020-03-27 05:12:38.225611 | ubuntu-xenial-citynetwork | 	github.com/codegangsta/cli: github.com/codegangsta/cli@v1.22.3: parsing go.mod:
2020-03-27 05:12:38.225717 | ubuntu-xenial-citynetwork | 	module declares its path as: github.com/urfave/cli
2020-03-27 05:12:38.225813 | ubuntu-xenial-citynetwork | 	        but was required as: github.com/codegangsta/cli

@zuzzas
Copy link
Contributor Author

zuzzas commented Mar 27, 2020

@lingxiankong
It fails with the same error in your PR as well. Any tips on fixing this?
#991 (comment)

@kayrus
Copy link
Contributor

kayrus commented Mar 27, 2020

Issue is related to theopenlab/openlab-zuul-jobs#837

UsedInodes int64
}

func (m *Mount) PathExists(volumePath string) (bool, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:nit: i think this func exists in k8s.io/util/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has an additional check for a "corrupted mount". I'm not sure that this is required and this may introduce a potential false-positive.

https://github.com/kubernetes/utils/blob/d1ab8797c55812f4fefe2c7b00a0d04a4740a93c/mount/mount_helper_common.go#L99-L100

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 27, 2020
@ramineni
Copy link
Contributor

/test cloud-provider-openstack-e2e-test-csi-cinder

@ramineni
Copy link
Contributor

Thanks for the work on this
/lgtm

@ramineni
Copy link
Contributor

/test cloud-provider-openstack-e2e-test-csi-cinder

@theopenlab-ci
Copy link

theopenlab-ci bot commented Mar 27, 2020

Build succeeded.

@lingxiankong
Copy link
Contributor

Please wait for theopenlab/openlab-zuul-jobs#841 merged.

@zuzzas
Copy link
Contributor Author

zuzzas commented Mar 28, 2020

/test cloud-provider-openstack-unittest

@theopenlab-ci
Copy link

theopenlab-ci bot commented Mar 28, 2020

Build succeeded.

@lingxiankong
Copy link
Contributor

/test cloud-provider-openstack-acceptance-test-csi-cinder

@theopenlab-ci
Copy link

theopenlab-ci bot commented Mar 28, 2020

Build succeeded.

@zuzzas
Copy link
Contributor Author

zuzzas commented Mar 28, 2020

Love these green checkmarks.

@lingxiankong
Copy link
Contributor

/lgtm
/approve

Given this PR got a +1 previously, merge now.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lingxiankong

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 1, 2020
@k8s-ci-robot k8s-ci-robot merged commit 90488ac into kubernetes:master Apr 1, 2020
@zuzzas zuzzas deleted the csi-cinder-get-volume-stats branch April 2, 2020 05:14
powellchristoph pushed a commit to powellchristoph/cloud-provider-openstack that referenced this pull request Jan 19, 2022
* NodeGetVolumeStats() implementation

Signed-off-by: Andrey Klimentyev <andrey.klimentyev@flant.com>

* Sanity checks and removal of magic numbers

Signed-off-by: Andrey Klimentyev <andrey.klimentyev@flant.com>

* Rewrite

Signed-off-by: Andrey Klimentyev <andrey.klimentyev@flant.com>

* +

* +

* Latest fixes

Signed-off-by: Andrey Klimentyev <andrey.klimentyev@flant.com>
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement GET_VOLUME_STATS node capability
6 participants