-
Notifications
You must be signed in to change notification settings - Fork 178
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
Support for acquiring DDP profile using devlink #387
Support for acquiring DDP profile using devlink #387
Conversation
LGTM |
/cc @SchSeba |
@ipatrykx Would you mind updating this PR? I assume some of the util functions have been merged in netlink go library. Thank you! |
Hi @zshi-redhat , sure, sorry for the delay on that. I am right now on a tight schedule, but will try to do this until Tuesday. |
cbfaa77
to
1ea4df3
Compare
Pull Request Test Coverage Report for Build 3329880032Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
48535fc
to
9161854
Compare
@zshi-redhat I know, I've said I'll deliver it until Tuesday, but Thursday isn't bad as well, isn't it? 🥳 Anyway, I've rebased this PR on top of the current master, fixed some issues and added unit tests. Hope we can get it merged soon. |
@Eoghan1232 @ipatrykx is there a plan to re-kindle this work ? |
Hi @adrianchiris , yes of course. |
Co-Authored-By: Eoghan1232 <[email protected]> Co-Authored-By: ipatrykx <[email protected]>
9161854
to
9091c2f
Compare
@SchSeba @adrianchiris PTAL |
As discussed in community, a test is needed to verify if the DDP Tool can be removed from the Dockerfile, as this PR should remove the dependency. |
Moving the changes into the GetDDPProfiles function Signed-off-by: Eoghan Russell <[email protected]>
@SchSeba @adrianchiris I've updated this PR. PTAL |
removed gocyclo as method is no longer changed Signed-off-by: Eoghan Russell <[email protected]>
at some point we would need to switch to interfaces here like we did with sriov-network-operator. |
Signed-off-by: Eoghan Russell <[email protected]>
@adrianchiris thanks for the feedback! I've updated the PR, PTAL |
Signed-off-by: Eoghan Russell <[email protected]>
pkg/utils/devlink.go
Outdated
) | ||
|
||
// IsDevlinkDDPSupportedByPCIDevice checks if DDP of PCI device can be acquired with devlink info command | ||
func IsDevlinkDDPSupportedByPCIDevice(device string) bool { |
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.
what is the different between the two functions?
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.
IsDevlinkDDPSupportedByPCIDevice
:
This function is intended to check if DDP is supported specifically for PCI devices.
IsDevlinkDDPSupportedByDevice
:
This function is more generic and checks if DDP is supported for any type of device.
I guess since IsDevlinkDDPSupportedByPCIDevice
is just a wrapper that calls IsDevlinkDDPSupportedByDevice
, we could remove IsDevlinkDDPSupportedByPCIDevice
in replace of IsDevlinkDDPSupportedByDevice
WDYT?
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 have removed IsDevlinkDDPSupportedByPCIDevice
and used IsDevlinkDDPSupportedByDevice
throughout instead
will update this PR in next day - also update docs to call out support for E800 series but issue with current ddptool means E700 series may not work. |
just testing my changes - will push commit after |
Signed-off-by: Eoghan Russell <[email protected]>
@SchSeba @adrianchiris PTAL |
Signed-off-by: Eoghan Russell <[email protected]>
pkg/utils/devlink.go
Outdated
) | ||
|
||
var ( | ||
netlinkDevlinkGetDeviceInfoByNameAsMap = netlink.DevlinkGetDeviceInfoByNameAsMap |
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.
we already have a netlink provider [1] shouldnt we extend it with the new method ? it already has netlink calls to devlink.
then, the rest of the functions in this file would be moved to ddp.go as they are pretty specific for ddp.
in tests (ddp_test.go) we would use a mocked version of NetlinkProvider instead of defining a fake function.
[1]
GetDevLinkDeviceEswitchAttrs(ifName string) (*nl.DevlinkDevEswitchAttr, 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.
Hi @adrianchiris yes 100% agree.
I migrated the code, but have hit an issue with the mockery.
2024/05/23 14:26:14 internal error: package "bytes" without types was imported from "github.com/k8snetworkplumbingwg/sriov-network-device-plugin/pkg/utils"
I am trying to figure out the reason, but this is blocking me from making the changes, as I cannot regenerate the mocked version of the NetlinkProvider Interface.
I also did a test of moving the code to a test project and trying to compile but still hit the same issues with mockery.
Has anyone come across an issue like this with mockery before?
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 found this one argoproj/argo-workflows#8251
can you try to build the mockery version please?
@Eoghan1232 i gave another round, left a comment to make things a bit more consistent with other places in device plugin code. hoping to get this sorted soon so i can tag a release. |
extended netlink provider updated unit tests regenerated mocked interfaces addressed comments Signed-off-by: Eoghan Russell <[email protected]>
a2a85a8
to
b018ba3
Compare
trying to fix lint issue..... |
@adrianchiris @SchSeba PTAL |
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
BUT please squash all the commits to reasonable ones :)
bd0a56d
into
k8snetworkplumbingwg:master
Squashed to single commit, edited commit msg to contain brief description. |
This PR introduces support for devlink commands to be used to acquire DDP profile name on supported hardware. First, the devlink will be used, and if it is not supported then it will fallback to DDPTool as it was before.
Some of the devlink related code will be possibly moved to vishvananda/netlink library if the PR there will be accepted.
Later this can be used to add support for DDP profiles in k8snetworkplumbingwg/sriov-network-operator.