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

vhost-vdpa: fix DeviceInfo file content #493

Merged
merged 1 commit into from
Jul 20, 2023

Conversation

lmilleri
Copy link
Contributor

@lmilleri lmilleri commented Jul 3, 2023

This PR fixes an issue in the DeviceInfo file generation for vhost-vdpa devices.

For details please check the following issue:
#492

@lmilleri
Copy link
Contributor Author

/retest

@lmilleri
Copy link
Contributor Author

@SchSeba @bn222 Can you please have a look and merge if looks good to you?

@bn222
Copy link
Contributor

bn222 commented Jul 13, 2023

Return error instead and handle it at the call sites.

@lmilleri
Copy link
Contributor Author

@bn222 AFAIK there is no error condition to be handled at the call site. Let's say, if a path is returned, it'll be used to fill some structs, otherwise an empty path will be stored instead. The glog.Infof is just for convenience.

@bn222
Copy link
Contributor

bn222 commented Jul 13, 2023

It seems to me that whenever this function returns "", it was due to it being called on something that doesn't have this path, i.e. it should not have been called on it the first place?

@lmilleri
Copy link
Contributor Author

Added error handling for GetPath function

@lmilleri lmilleri force-pushed the vhost-vdpa branch 2 times, most recently from 4f4bf71 to f26c266 Compare July 14, 2023 14:06
@bn222
Copy link
Contributor

bn222 commented Jul 14, 2023

/lgtm

Copy link
Collaborator

@e0ne e0ne left a comment

Choose a reason for hiding this comment

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

LGTM

vdpaPath, err := vip.dev.GetPath()
if err != nil {
glog.Errorf("Unexpected error when fetching the vdpa device path: %s", err)
return devSpecs
Copy link
Contributor

@adrianchiris adrianchiris Jul 18, 2023

Choose a reason for hiding this comment

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

shouldn't we return nil explicitly like above ? (When device not healthy)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it would be safer, will do the change thanks!

The path attribute in the DeviceInfo specification is now set
to something like '/dev/vhost-vdpa-0'.
See issue k8snetworkplumbingwg#492

Signed-off-by: Leonardo Milleri <lmilleri@redhat.com>
@coveralls
Copy link
Collaborator

Pull Request Test Coverage Report for Build 5588346567

  • 18 of 30 (60.0%) changed or added relevant lines in 3 files are covered.
  • 3 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.2%) to 78.223%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/infoprovider/vdpaInfoProvider.go 2 5 40.0%
pkg/devices/vdpa.go 0 4 0.0%
pkg/netdevice/netResourcePool.go 16 21 76.19%
Files with Coverage Reduction New Missed Lines %
pkg/netdevice/netResourcePool.go 3 79.52%
Totals Coverage Status
Change from base Build 5378078974: -0.2%
Covered Lines: 1954
Relevant Lines: 2498

💛 - Coveralls

@adrianchiris adrianchiris merged commit 1818a1c into k8snetworkplumbingwg:master Jul 20, 2023
10 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.

None yet

6 participants