-
Notifications
You must be signed in to change notification settings - Fork 152
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
Change iops params directly convert string to int64 #1128
Change iops params directly convert string to int64 #1128
Conversation
Skipping CI for Draft Pull Request. |
/ok-to-test |
b31ccaa
to
601f482
Compare
/assign @mattcary |
pkg/common/utils.go
Outdated
last := string(str[len(str)-1]) | ||
|
||
switch last { | ||
case "k": |
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.
Do we need to account for base 2 vs base 10?
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.
Why do we care about base 2?
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.
In SI notation, k = 1000 and Ki = 2^10
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.
Oh I was asking why do we need support for base 2 input, because it is unnatural for humans. Do our customers ask for that?
// ConvertGiBStringToInt64 converts a GiB string to int64 | ||
func ConvertGiBStringToInt64(str string) (int64, error) { | ||
// ConvertStringToInt64 converts a string to int64 | ||
func ConvertStringToInt64(str string) (int64, error) { |
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.
It may be better to use kubernetes resource quantity parsing instead of rolling your own: https://pkg.go.dev/k8s.io/apimachinery/pkg/api/resource#Quantity
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.
But they do not have our use case. They do not convert these values to both million and thousand?
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.
I'm not sure I understand. It looks like this function is converting from a string, possibly abbreviated in SI notation, to the raw number right?
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.
Yes and we want to support:
"1000" -> int64(1000)
"1K"-> int64(1000)
"1M" -> int64(1,000,000)
Maybe "1G" -> int64(1,000,000,000)
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.
The "K" is not supported in resource#Quantity. But other than that mostly covered. We do not need to support the "K"?
f23141f
to
1afd9ed
Compare
3ff0e83
to
e8d9a5c
Compare
e8d9a5c
to
50853f3
Compare
\o/ /lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mattcary, sunnylovestiramisu 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 feature
What this PR does / why we need it:
After discussion, the iops fields should not be handling GB/MB etc. because PD is treating this value as a configuration for the whole disk
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?:
The change of HdX and HdT is not released yet.