Skip to content

Commit

Permalink
Merge pull request kata-containers#10276 from Apokleos/fix-runtime-cdi
Browse files Browse the repository at this point in the history
runtime: Fix runtime/cdi panic with assignment to entry in nil map
  • Loading branch information
Apokleos authored Sep 11, 2024
2 parents 3f541af + 1684c19 commit d096803
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/runtime/virtcontainers/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -1010,6 +1010,9 @@ func (c *Container) siblingAnnotation(devPath string, siblings []DeviceRelation)
vfioNum := filepath.Base(devPath)
annoKey := fmt.Sprintf("cdi.k8s.io/vfio%s", vfioNum)
annoValue := fmt.Sprintf("nvidia.com/gpu=%d", sibling.Index)
if c.config.CustomSpec.Annotations == nil {
c.config.CustomSpec.Annotations = make(map[string]string)
}
c.config.CustomSpec.Annotations[annoKey] = annoValue
c.Logger().Infof("annotated container with %s: %s", annoKey, annoValue)
}
Expand Down

0 comments on commit d096803

Please sign in to comment.