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

Fix the cache save #298

Merged
merged 1 commit into from
May 26, 2024
Merged

Conversation

SchSeba
Copy link
Collaborator

@SchSeba SchSeba commented May 16, 2024

before we send a pointer to the netConf object so the marshal function didn't parse all the information needed

@SchSeba
Copy link
Collaborator Author

SchSeba commented May 16, 2024

Hi @zeeke @Eoghan1232 please review CRITICAL bug in the cni

@SchSeba
Copy link
Collaborator Author

SchSeba commented May 16, 2024

without this PR this is the info saved in the cache folder

cat /var/lib/cni/sriov/ae5482e8bc9691863727dbae943daebf6c0f91263f9e35905cf5b55d4b11c1ea-net1 
{"capabilities":{"ips":true,"mac":true},"cniVersion":"1.0.0","ipam":{"type":"static"},"name":"test-sriov-static-usual","type":"sriov"}

we don't have DeviceID so the cni failed on cmdDel function

@coveralls
Copy link

coveralls commented May 16, 2024

Pull Request Test Coverage Report for Build 9212724446

Details

  • 17 of 28 (60.71%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+1.4%) to 50.923%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/utils/utils.go 2 3 66.67%
pkg/types/types.go 15 25 60.0%
Totals Coverage Status
Change from base Build 9019301759: 1.4%
Covered Lines: 662
Relevant Lines: 1300

💛 - Coveralls

@mlguerrero12
Copy link
Contributor

what changed? The marshal of an interface that holds a pointer is the value that the pointer points to. This has been here for a while. What am I missing?

@SchSeba
Copy link
Collaborator Author

SchSeba commented May 16, 2024

Hi @mlguerrero12 thanks for the comment!

I don't know exactly. I am trying to understand I was able to find that the MTU PR was the one that introduced the change

@SchSeba
Copy link
Collaborator Author

SchSeba commented May 16, 2024

/hold

@SchSeba
Copy link
Collaborator Author

SchSeba commented May 16, 2024

Hi @mlguerrero12 I found the issue. the bump of the CNI package.

the CNI package overrides the default marshal function

https://github.com/containernetworking/cni/blob/main/pkg/types/types.go#L86

/hold cancel

@SchSeba SchSeba force-pushed the fix_cache branch 2 times, most recently from 75588f1 to eb606ae Compare May 16, 2024 20:01
@mlguerrero12
Copy link
Contributor

Good catch @SchSeba. I suggest to change the signature of SaveNetConf to func SaveNetConf(cid, dataDir, podIfName string, conf types.NetConf) to make it explicit that it should not be a pointer.

I was going to suggest, as a nit, to ignore the field MTU for marshalling/unmarshalling by adding json:"-" and then I realized that DPDKMode also have it. So, in cmdDel, this is always false even when it is dpdk. I ran a small test for LoadConfFromCache. I haven´t checked the actual logs, but it seems to me that during a delete for dpdk, the first time it fails in ReleaseVF (line 288) and then the next iteration succeeds since we delete the cache and return nil. Only the deletion of the allocator is missing to execute which is not a big problem. Anyway, this is outside of the scope of this pr.

@zeeke
Copy link
Member

zeeke commented May 17, 2024

Good catch @SchSeba. I suggest to change the signature of SaveNetConf to func SaveNetConf(cid, dataDir, podIfName string, conf types.NetConf) to make it explicit that it should not be a pointer.

+1 on changing the signature of SaveNetConf: conf interface{} -> conf types.NetConf

other than that. LGTM

@SchSeba
Copy link
Collaborator Author

SchSeba commented May 17, 2024

Hi @mlguerrero12 @zeeke thanks for the comment please take another look when you have time

Copy link
Contributor

@mlguerrero12 mlguerrero12 left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -4,6 +4,7 @@ import (
"bytes"
"encoding/json"
"fmt"
sriovtypes "github.com/k8snetworkplumbingwg/sriov-cni/pkg/types"
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: move it outside of this group

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yep for some reason my IDE stop creating the nice groups...

done :)

pkg/utils/utils.go Outdated Show resolved Hide resolved
pkg/utils/utils.go Outdated Show resolved Hide resolved
Copy link
Contributor

@adrianchiris adrianchiris left a comment

Choose a reason for hiding this comment

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

Awsome! LGTM.

@SchSeba
Copy link
Collaborator Author

SchSeba commented May 23, 2024

I just squash the commits waiting for a clean CI and I will merge this one

before we send a pointer to the netConf object so the marshal
function didn't parse all the information needed

Signed-off-by: Sebastian Sch <[email protected]>
@adrianchiris adrianchiris merged commit 36570f5 into k8snetworkplumbingwg:master May 26, 2024
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants