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

NodeExpandVolume no-op for raw block #695

Merged

Conversation

AndyXiangLi
Copy link
Contributor

@AndyXiangLi AndyXiangLi commented Jan 13, 2021

Is this a bug fix or adding new feature?
Fixes #346
Fixes #339
What is this PR about? / Why do we need it?
NodeExpandVolume will check volume type (mount point or block device)and skip resize on block volume.
What testing is done?
Sanity test passed
Added unit tests

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 13, 2021
@k8s-ci-robot
Copy link
Contributor

Hi @AndyXiangLi. Thanks for your PR.

I'm waiting for a kubernetes-sigs 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 the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jan 13, 2021
@coveralls
Copy link

coveralls commented Jan 13, 2021

Pull Request Test Coverage Report for Build 1479

  • 22 of 37 (59.46%) changed or added relevant lines in 1 file are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.02%) to 81.196%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/driver/node.go 22 37 59.46%
Files with Coverage Reduction New Missed Lines %
pkg/driver/node.go 1 70.58%
Totals Coverage Status
Change from base Build 1472: 0.02%
Covered Lines: 1697
Relevant Lines: 2090

💛 - Coveralls

@wongma7
Copy link
Contributor

wongma7 commented Jan 13, 2021

/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 Jan 13, 2021
@@ -254,14 +254,43 @@ func (d *nodeService) NodeExpandVolume(ctx context.Context, req *csi.NodeExpandV
if len(volumeID) == 0 {
return nil, status.Error(codes.InvalidArgument, "Volume ID not provided")
}
volumePath := req.GetVolumePath()
if len(volumePath) == 0 {
return nil, status.Error(codes.InvalidArgument, "volume path must be provided")
Copy link
Contributor

Choose a reason for hiding this comment

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

So prior to this PR, we don't have this requirement (at least here). We have to make sure this is not a breaking change. Did we verify that behavior stays the same when volumePath is absent?

Copy link
Contributor

Choose a reason for hiding this comment

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

volume_path is required, so we should be fine I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

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


if blk := volumeCapability.GetBlock(); blk != nil {
// Noop for Block NodeExpandVolume
klog.V(4).Infof("NodeExpandVolume succeeded on %v to %s, capability is block so this is a no-op", volumeID, volumePath)
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm I feel like we should reword this. Maybe something like "NodeExpandVolume called for %v at %s. Since %v is a block device, ignoring..."

What do you think?

if isBlock {
// Skip resizing for Block NodeExpandVolume
klog.V(4).Infof("NodeExpandVolume succeeded on %v to %s, given volumePath is a block device so will not resize volume", volumeID, volumePath)
return &csi.NodeExpandVolumeResponse{}, nil
Copy link
Contributor

Choose a reason for hiding this comment

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

Not that kubernetes will use the returned size(at least right now), but is better to return the expanded size if possible. We may have fixes coming up which uses returned size.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also if you do make the change to returned expanded size, we should return expanded block size not the fs size.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @ayberk What do you think here?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's a great suggestion. We should future-proof wherever we can.

Mode: csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER,
},
},
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use losetup and dd to check the other case of volume_path being a block device?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried to use losetup and dd to create loop device when setup testing but with no luck. It failed to find an available loop device when I ran it in linux instance.. This should not be a blocker as I tested the functionality e2e on the cluster. Testing code is here, I will follow up on this later.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm going to approve to unblock you, but yeah let's follow up.

@ayberk
Copy link
Contributor

ayberk commented Jan 15, 2021

/retitle NodeExpandVolume no-op for raw block

@k8s-ci-robot k8s-ci-robot changed the title NodeExpandVolume no-op for raw blcok NodeExpandVolume no-op for raw block Jan 15, 2021
@ayberk
Copy link
Contributor

ayberk commented Jan 21, 2021

/approve
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 21, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: AndyXiangLi, ayberk

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 Jan 21, 2021
@k8s-ci-robot k8s-ci-robot merged commit 6dcd6d0 into kubernetes-sigs:master Jan 21, 2021
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. 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.

Fix raw block volume resizing for EBS Add unit test for NodeExpand
6 participants