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 regression with managing claim-specific CDI devices #193

Merged
merged 1 commit into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions cmd/nvidia-dra-plugin/cdi.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ func (cdi *CDIHandler) CreateClaimSpecFile(claimUID string, preparedDevices Prep
// Generate claim specific specs for each device.
var deviceSpecs []cdispec.Device
for _, group := range preparedDevices {
// If there are no edits passed back as prt of the device config state, skip it
// If there are no edits passed back as part of the device config state, skip it
if group.ConfigState.containerEdits == nil {
continue
}
Expand Down Expand Up @@ -290,6 +290,9 @@ func (cdi *CDIHandler) GetStandardDevice(device *AllocatableDevice) string {
return cdiparser.QualifiedName(cdiVendor, cdiDeviceClass, device.CanonicalName())
}

func (cdi *CDIHandler) GetClaimDevice(claimUID string, device *AllocatableDevice) string {
func (cdi *CDIHandler) GetClaimDevice(claimUID string, device *AllocatableDevice, containerEdits *cdiapi.ContainerEdits) string {
if containerEdits == nil {
return ""
}
return cdiparser.QualifiedName(cdiVendor, cdiClaimClass, fmt.Sprintf("%s-%s", claimUID, device.CanonicalName()))
}
2 changes: 1 addition & 1 deletion cmd/nvidia-dra-plugin/device_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ func (s *DeviceState) prepareDevices(ctx context.Context, claim *resourceapi.Res
if d := s.cdi.GetStandardDevice(s.allocatable[result.Device]); d != "" {
cdiDevices = append(cdiDevices, d)
}
if d := s.cdi.GetClaimDevice(string(claim.UID), s.allocatable[result.Device]); d != "" {
if d := s.cdi.GetClaimDevice(string(claim.UID), s.allocatable[result.Device], preparedDeviceGroupConfigState[c].containerEdits); d != "" {
cdiDevices = append(cdiDevices, d)
}

Expand Down