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: correct device filter initialization order #857

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Nimbus318
Copy link
Contributor

Found an initialization order issue where FilterDeviceToRegister always returns false because DevicePluginFilterDevice is not initialized when the function is called. This happens because NewNVMLResourceManagers (which uses FilterDeviceToRegister) is called before the config file is read in NewNvidiaDevicePlugin.

What type of PR is this?
/kind bug

What this PR does / why we need it:
Changes:

  • Added InitDeviceFilter function in plugin package to handle device filter initialization
  • Modified GetPlugins to ensure device filter is initialized before creating resource managers
  • Added necessary error handling

Which issue(s) this PR fixes:
Fixes #856

Special notes for your reviewer:
Testing:

  1. Verified device filtering works correctly with test config
  2. Confirmed existing functionality remains unchanged
  3. Added device filter config works as expected
    CleanShot 2025-02-10 at 16 43 07@2x
    CleanShot 2025-02-10 at 16 43 44@2x
    CleanShot 2025-02-10 at 17 24 16@2x

This fix ensures the device filtering feature works as intended without any side effects on existing functionality.

Does this PR introduce a user-facing change?:
No

Ensure DevicePluginFilterDevice is initialized before FilterDeviceToRegister.
This fixes the initialization sequence to make device filtering work.

Signed-off-by: Nimbus318 <[email protected]>
@wawa0210 wawa0210 added the kind/bug Something isn't working label Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Device filtering not working due to incorrect initialization order
2 participants