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

disk: fix and cleanup NodeExpandVolume #1013

Merged
merged 3 commits into from
Apr 10, 2024

Conversation

huww98
Copy link
Contributor

@huww98 huww98 commented Apr 4, 2024

What type of PR is this?

/kind bug
/kind cleanup

What this PR does / why we need it:

fix NodeExpandVolume always return error

remove unnessesary statfs
remove float math
remove the unused parameter FILE_SYSTEM_LOSE_PERCENT
optimize error message
fix false error if req.CapacityRange is not specified

Which issue(s) this PR fixes:

Fixes #1008
Fixes 377c9e9

Special notes for your reviewer:

Does this PR introduce a user-facing change?

FILE_SYSTEM_LOSE_PERCENT env is now deprecated and not used.

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. 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 Apr 4, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @huww98. 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/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Apr 4, 2024
pkg/disk/nodeserver.go Show resolved Hide resolved
@@ -959,7 +945,8 @@ func (ns *nodeServer) NodeExpandVolume(ctx context.Context, req *csi.NodeExpandV
if bytes.Contains(output, []byte("it cannot be grown")) || bytes.Contains(output, []byte("could only be grown by")) {
deviceCapacity := getBlockDeviceCapacity(devicePath)
rootCapacity := getBlockDeviceCapacity(rootPath)
log.Infof("NodeExpandVolume: Volume %s with Device Partition %s no need to grown, with requestSize: %v, rootBlockSize: %v, partition BlockDevice size: %v", diskID, devicePath, requestGB, rootCapacity, deviceCapacity)
log.Infof("NodeExpandVolume: Volume %s with Device Partition %s no need to grown, with requestSize: %v, rootBlockSize: %v, partition BlockDevice size: %v",
diskID, devicePath, requestBytes, rootCapacity, deviceCapacity)
Copy link
Contributor

Choose a reason for hiding this comment

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

Change the log capacity units to GB, for better readability.

Copy link
Contributor Author

@huww98 huww98 Apr 7, 2024

Choose a reason for hiding this comment

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

How about using hex? I have seen a lot of hex in ceph log. Once we need to read the log, we value simple and precise than readability for diagnosis purpose. And hex can be converted to different unit faster by hand. e.g.:

Decimal: 22014345216
GB: 20.502456665039062
Hex: 0x520284000
resource: 21498384Ki

Copy link
Contributor

Choose a reason for hiding this comment

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

hex may be more versatile, but it's basically useless in a container scenario, and you can check that logs in kubernetes repo basically don't use hex. keep using GiB would be fine. Accuracy issue could be ignore

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you can check that logs in kubernetes repo basically don't use hex

Yes, but they also don't use floating point numbers. I'm searching for regex Infof.+size, all of them using either decimal bytes, or resource. Resource is not convenient when comparing different sizes in the log, so decimal bytes should be the way to go if we really want to follow Kubernetes.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok, please follow Kubernetes logging format

return nil, status.Errorf(codes.Aborted, "requested %v, but actual block size %v is smaller. Not updated yet?",
resource.NewQuantity(requestBytes, resource.BinarySI), resource.NewQuantity(deviceCapacity, resource.BinarySI))
}
log.Infof("NodeExpandVolume:: Expand %s to %dB successful", diskID, deviceCapacity)
Copy link
Contributor

Choose a reason for hiding this comment

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

same as above

@huww98 huww98 force-pushed the disk-expand-cleanup branch 3 times, most recently from 0ac59a4 to 2819cba Compare April 8, 2024 07:23
remove unnessesary statfs
remove float math
remove the unused parameter FILE_SYSTEM_LOSE_PERCENT
optimize error message
fix false error if req.CapacityRange is not specified
Copy link
Contributor Author

@huww98 huww98 left a comment

Choose a reason for hiding this comment

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

Resolved conflict on import

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 9, 2024
for both readability and accuracy.
@mowangdk
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 Apr 10, 2024
@mowangdk
Copy link
Contributor

/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 Apr 10, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: huww98, mowangdk

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 10, 2024
@k8s-ci-robot k8s-ci-robot merged commit d07b303 into kubernetes-sigs:master Apr 10, 2024
7 checks passed
@huww98 huww98 deleted the disk-expand-cleanup branch April 26, 2024 16:54
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. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. 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.

None yet

3 participants