Skip to content

Conversation

@zvonkok
Copy link
Collaborator

@zvonkok zvonkok commented Jan 19, 2026

Similar to P_GPU_ALIAS add NVSWTICH_ALIAS to override he name that is originally given by the DP

> k describe node 
        ...
  nvidia.com/nvswitch:                        4
  nvidia.com/pgpu:                            8
       ...

Depends On: #26

Copilot AI review requested due to automatic review settings January 19, 2026 23:20
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for NVSwitch devices and introduces an NVSWITCH_ALIAS environment variable to override device naming, similar to the existing P_GPU_ALIAS for GPUs. The implementation refactors device discovery to use the go-nvlib library and adds CDI (Container Device Interface) spec generation for both GPUs and NVSwitches.

Changes:

  • Added NVSWITCH_ALIAS environment variable support for customizing NVSwitch device naming
  • Refactored device discovery to use go-nvlib instead of manual PCI filesystem operations
  • Implemented CDI spec generation for discovered VFIO devices
  • Enhanced test coverage with mock-based testing approach

Reviewed changes

Copilot reviewed 8 out of 3090 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
cmd/main.go Added environment variable reading for NVSWITCH_ALIAS
pkg/device_plugin/device_plugin.go Refactored to use go-nvlib for device discovery and added NVSwitch support
pkg/device_plugin/device_plugin_test.go Updated tests to use mocks instead of filesystem fixtures
pkg/device_plugin/generic_device_plugin.go Simplified allocation logic and removed deprecated helper functions
pkg/device_plugin/generic_device_plugin_test.go Updated test fixtures to use new data structures
pkg/device_plugin/constants.go Added CDI-related constants and removed deprecated basePath
pkg/device_plugin/cdi.go New file implementing CDI spec generation
go.mod Updated Go version and added new dependencies

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Collaborator

@rajatchopra rajatchopra left a comment

Choose a reason for hiding this comment

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

LGTM

@zvonkok zvonkok force-pushed the nvswitch-alias branch 4 times, most recently from 1a0ce46 to 68066df Compare January 23, 2026 19:35
Similar to P_GPU_ALIAS add NVSWTICH_ALIAS to override
the name that is originally given by the DP

  nvidia.com/nvswitch:                        4
  nvidia.com/pgpu:                            8

Signed-off-by: Zvonko Kaiser <zkaiser@nvidia.com>
@zvonkok zvonkok merged commit 53f039a into NVIDIA:main Jan 23, 2026
8 checks passed
@coveralls
Copy link

coveralls commented Jan 23, 2026

Pull Request Test Coverage Report for Build 21154246385

Details

  • 0 of 11 (0.0%) changed or added relevant lines in 3 files are covered.
  • 52 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-13.3%) to 41.777%

Changes Missing Coverage Covered Lines Changed/Added Lines %
cmd/main.go 0 1 0.0%
pkg/device_plugin/cdi.go 0 5 0.0%
pkg/device_plugin/device_plugin.go 0 5 0.0%
Files with Coverage Reduction New Missed Lines %
pkg/device_plugin/device_plugin.go 26 75.66%
pkg/device_plugin/generic_device_plugin.go 26 39.11%
Totals Coverage Status
Change from base Build 21079233964: -13.3%
Covered Lines: 221
Relevant Lines: 529

💛 - Coveralls

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.

3 participants