-
Notifications
You must be signed in to change notification settings - Fork 34
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
sriov: Add WithRdmaMode method #790
base: main
Are you sure you want to change the base?
Conversation
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.
looks good just a couple minor comments
pkg/sriov/poolconfig.go
Outdated
} | ||
|
||
if mode == "" { | ||
builder.errorMsg = "RdmaMode cannot be empty" |
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.
could you please add a glog statement to both of the mode check if statements? something like
glog.V(100).Info("PoolConfig RdmaMode cannot be empty")
pkg/sriov/poolconfig.go
Outdated
} | ||
|
||
if mode != "shared" && mode != "exclusive" { | ||
builder.errorMsg = "Invalid value for rdmaMode. It should be 'shared' or 'exclusive'" |
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.
and for both of the error messages could you please change them to start with a lowercase letter?
builder.errorMsg = "Invalid value for rdmaMode. It should be 'shared' or 'exclusive'" | |
builder.errorMsg = "invalid value for rdmaMode. It should be 'shared' or 'exclusive'" |
3bd4056
to
fb25e1b
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.
/lgtm
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.
/lgtm
pkg/sriov/poolconfig.go
Outdated
@@ -255,6 +255,33 @@ func (builder *PoolConfigBuilder) WithMaxUnavailable(maxUnavailable intstrutil.I | |||
return builder | |||
} | |||
|
|||
// WithRdmaMode method sets rdmaMode to shared/exclusive. | |||
func (builder *PoolConfigBuilder) WithRdmaMode(mode string) *PoolConfigBuilder { |
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.
nit: RDMA is acronym so worth using capital letters
func (builder *PoolConfigBuilder) WithRdmaMode(mode string) *PoolConfigBuilder { | |
func (builder *PoolConfigBuilder) WithRDMAMode(mode string) *PoolConfigBuilder { |
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.
done. PTAL
pkg/sriov/poolconfig_test.go
Outdated
@@ -240,6 +240,40 @@ func TestWithMaxUnavailable(t *testing.T) { | |||
} | |||
} | |||
|
|||
func TestWithRdmaMode(t *testing.T) { |
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.
another nit, but this could be updated to match the capitalization of the function
func TestWithRdmaMode(t *testing.T) { | |
func TestWithRDMAMode(t *testing.T) { |
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.
done. ptal
No description provided.