Fix VFIO device path missing from env variables#692
Fix VFIO device path missing from env variables#692SchSeba wants to merge 1 commit intok8snetworkplumbingwg:masterfrom
Conversation
The vfioInfoProvider was not including the VFIO device path
(e.g., /dev/vfio/162) in the environment variables because
GetEnvVal() was called before GetDeviceSpecs() during allocation.
The VFIO device file path was computed in GetDeviceSpecs() and stored
in vfioDevContainer, but since GetEnvVal() runs first in the Allocate()
flow, the field was always empty when building env vars.
Fix: Move the VFIO device file computation to the constructor
(NewVfioInfoProvider) so the values are available immediately for
both GetEnvVal() and GetDeviceSpecs() regardless of call order.
Before: {"vfio":{"mount":"/dev/vfio/vfio"}}
After: {"vfio":{"mount":"/dev/vfio/vfio","dev-mount":"/dev/vfio/162"}}
Signed-off-by: Author <author@example.com>
Summary of ChangesHello @SchSeba, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a bug in the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request correctly fixes a bug where the VFIO device path was missing from environment variables due to an incorrect initialization order. By moving the VFIO device file computation to the NewVfioInfoProvider constructor, the device path is now available regardless of the call order of GetEnvVal() and GetDeviceSpecs(). The change is logical, well-explained, and the updated tests properly validate the fix. I have one suggestion regarding error handling that could improve the robustness of the code.
Pull Request Test Coverage Report for Build 20917905849Details
💛 - Coveralls |
The vfioInfoProvider was not including the VFIO device path (e.g., /dev/vfio/162) in the environment variables because GetEnvVal() was called before GetDeviceSpecs() during allocation.
The VFIO device file path was computed in GetDeviceSpecs() and stored in vfioDevContainer, but since GetEnvVal() runs first in the Allocate() flow, the field was always empty when building env vars.
Fix: Move the VFIO device file computation to the constructor (NewVfioInfoProvider) so the values are available immediately for both GetEnvVal() and GetDeviceSpecs() regardless of call order.
Before: {"vfio":{"mount":"/dev/vfio/vfio"}}
After: {"vfio":{"mount":"/dev/vfio/vfio","dev-mount":"/dev/vfio/162"}}