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: resize filesystem if cloned volume capacity is larger than the source volume #657

Merged
merged 1 commit into from
Jan 15, 2021

Conversation

sunpa93
Copy link
Contributor

@sunpa93 sunpa93 commented Jan 6, 2021

What type of PR is this?
/kind bug

What this PR does / why we need it:
Which issue(s) this PR fixes:

Fixes #528

Requirements:

Special notes for your reviewer:

Release note:

none

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jan 6, 2021
@k8s-ci-robot
Copy link
Contributor

Welcome @sunpa93!

It looks like this is your first PR to kubernetes-sigs/azuredisk-csi-driver 🎉. 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-sigs/azuredisk-csi-driver 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
Copy link
Contributor

Hi @sunpa93. 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 needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 6, 2021
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 6, 2021
@sunpa93 sunpa93 changed the title Filesystem resize fix: resize filesystem if cloned volume capacity is larger than the source volume Jan 6, 2021
@sunpa93 sunpa93 marked this pull request as ready for review January 6, 2021 00:52
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 6, 2021
Copy link
Member

@andyzhangx andyzhangx left a comment

Choose a reason for hiding this comment

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

/ok-to-test

test/e2e/dynamic_provisioning_test.go Outdated Show resolved Hide resolved
pkg/azuredisk/controllerserver.go Outdated Show resolved Hide resolved
pkg/azuredisk/controllerserver.go Outdated Show resolved Hide resolved
pkg/azuredisk/controllerserver.go Outdated Show resolved Hide resolved
@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 6, 2021
pkg/azuredisk/nodeserver.go Outdated Show resolved Hide resolved
pkg/azuredisk/nodeserver.go Outdated Show resolved Hide resolved
Copy link
Member

@andyzhangx andyzhangx left a comment

Choose a reason for hiding this comment

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

thanks, with this PR, volume cloning feature should be ready.
And don't forget to git rebase -i HEAD~7 to squash all commits for this PR.

pkg/azuredisk/nodeserver.go Show resolved Hide resolved
pkg/azuredisk/controllerserver.go Outdated Show resolved Hide resolved
pkg/azuredisk/nodeserver.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jan 8, 2021
@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 9, 2021
@andyzhangx
Copy link
Member

@nearora-msft that reminds me that we should filter out all os disks(has _OsDisk_ in disk name), ListVolumes should not return os disk, that's a bug:

I0112 01:42:55.898001    7895 utils.go:84] GRPC call: /csi.v1.Controller/ListVolumes
I0112 01:42:55.898027    7895 utils.go:85] GRPC request: {}
I0112 01:42:55.973836    7895 utils.go:90] GRPC response: {"entries":[{"status":{},"volume":{"volume_id":"/subscriptions/0e46bd28-a80f-4d3a-8200-d9eb8d80cb2e/resourceGroups/azuredisk-csi-driver-test-520f6f1e-5477-11eb-88d4-7ec16ad5bdf3/providers/Microsoft.Compute/disks/sanity"}},{"status":{"published_node_ids":["sanity-test-node"]},"volume":{"volume_id":"/subscriptions/0e46bd28-a80f-4d3a-8200-d9eb8d80cb2e/resourceGroups/azuredisk-csi-driver-test-520f6f1e-5477-11eb-88d4-7ec16ad5bdf3/providers/Microsoft.Compute/disks/sanity-test-node_OsDisk_1_0c5cbb6a1bbe4e8e9d400c5ed05a1fa8"}}]}

Is filtering on the diskName the only option? Isn't there a flag or property that we can use to filter it?

I don't see there is other way since os disk is just a normal disk returned by ListByResourceGroup

@nearora-msft
Copy link
Contributor

@nearora-msft that reminds me that we should filter out all os disks(has _OsDisk_ in disk name), ListVolumes should not return os disk, that's a bug:

I0112 01:42:55.898001    7895 utils.go:84] GRPC call: /csi.v1.Controller/ListVolumes
I0112 01:42:55.898027    7895 utils.go:85] GRPC request: {}
I0112 01:42:55.973836    7895 utils.go:90] GRPC response: {"entries":[{"status":{},"volume":{"volume_id":"/subscriptions/0e46bd28-a80f-4d3a-8200-d9eb8d80cb2e/resourceGroups/azuredisk-csi-driver-test-520f6f1e-5477-11eb-88d4-7ec16ad5bdf3/providers/Microsoft.Compute/disks/sanity"}},{"status":{"published_node_ids":["sanity-test-node"]},"volume":{"volume_id":"/subscriptions/0e46bd28-a80f-4d3a-8200-d9eb8d80cb2e/resourceGroups/azuredisk-csi-driver-test-520f6f1e-5477-11eb-88d4-7ec16ad5bdf3/providers/Microsoft.Compute/disks/sanity-test-node_OsDisk_1_0c5cbb6a1bbe4e8e9d400c5ed05a1fa8"}}]}

Is filtering on the diskName the only option? Isn't there a flag or property that we can use to filter it?

I don't see there is other way since os disk is just a normal disk returned by ListByResourceGroup

Probably we can use this parameter to check if its an OS disk or not. What do you say? This param is only populated for OS disks as per the docs.
https://docs.microsoft.com/en-us/rest/api/compute/disks/list#hypervgeneration

Created an issue for tracking : #678

@andyzhangx
Copy link
Member

@nearora-msft that's a little tricky IMO, filter out by diskName should be clear enough

@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jan 13, 2021
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 13, 2021
@sunpa93 sunpa93 force-pushed the filesystem-resize branch 2 times, most recently from dad288a to ceee3ad Compare January 13, 2021 02:20
@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jan 13, 2021
@sunpa93 sunpa93 force-pushed the filesystem-resize branch 2 times, most recently from ceee3ad to cbc2a0b Compare January 14, 2021 19:29
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 14, 2021
@sunpa93 sunpa93 force-pushed the filesystem-resize branch 2 times, most recently from 83a64ec to d91a9cd Compare January 14, 2021 20:06
add additional field in CreateVolumeRespone to denote whether filesystem needs to be resized or not and resize filesystem in nodeserver accordingly

added e2e test for cloning a volume larger than the source volume

test: add unit test for getDevicePathWithMountPath

add unit test for GetSourceDiskSize; edit error message
@sunpa93
Copy link
Contributor Author

sunpa93 commented Jan 14, 2021

/retest

2 similar comments
@sunpa93
Copy link
Contributor Author

sunpa93 commented Jan 14, 2021

/retest

@sunpa93
Copy link
Contributor Author

sunpa93 commented Jan 15, 2021

/retest

Copy link
Member

@andyzhangx andyzhangx left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: andyzhangx, sunpa93

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 15, 2021
@andyzhangx andyzhangx merged commit 19d1497 into kubernetes-sigs:master Jan 15, 2021
sozercan pushed a commit to sozercan/azuredisk-csi-driver that referenced this pull request Aug 16, 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. kind/bug Categorizes issue or PR as related to a bug. 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.

Mounted volume size issue when cloning a larger size pvc
4 participants