-
Notifications
You must be signed in to change notification settings - Fork 239
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
disk: fix and cleanup NodeExpandVolume #1013
Conversation
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 Once the patch is verified, the new status will be reflected by the 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. |
d29532f
to
4b735f0
Compare
pkg/disk/nodeserver.go
Outdated
@@ -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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
pkg/disk/nodeserver.go
Outdated
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
0ac59a4
to
2819cba
Compare
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
2819cba
to
d01b77c
Compare
There was a problem hiding this 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
for both readability and accuracy.
538ba73
to
735dd38
Compare
/ok-to-test |
/lgtm |
[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 |
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?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: