mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-27 11:31:05 +00:00
gpu: Handle VFIO devices with DevicePlugin and CDI
We can provide devices during cold-plug with CDI annotation on a Pod level and add per container device information wit the device plugin. Since the sandbox has already attached the VFIO device remove them from consideration and just apply the inner runtime CDI annotation. Signed-off-by: Zvonko Kaiser <zkaiser@nvidia.com>
This commit is contained in:
parent
486244b292
commit
3946435291
@ -842,6 +842,20 @@ func (c *Container) createDevices(contConfig *ContainerConfig) error {
|
||||
coldPlugDevices := []config.DeviceInfo{}
|
||||
|
||||
for i, vfio := range deviceInfos {
|
||||
// If device is already attached during sandbox creation, e.g.
|
||||
// with an CDI annotation, skip it in the container creation and
|
||||
// only create the proper CDI annotation for the kata-agent
|
||||
for _, dev := range config.PCIeDevicesPerPort["root-port"] {
|
||||
if dev.HostPath == vfio.ContainerPath {
|
||||
c.Logger().Warnf("device %s already attached to the sandbox, skipping", vfio.ContainerPath)
|
||||
}
|
||||
}
|
||||
for _, dev := range config.PCIeDevicesPerPort["switch-port"] {
|
||||
if dev.HostPath == vfio.ContainerPath {
|
||||
c.Logger().Warnf("device %s already attached to the sandbox, skipping", vfio.ContainerPath)
|
||||
}
|
||||
}
|
||||
|
||||
// Only considering VFIO updates for Port and ColdPlug or
|
||||
// HotPlug updates
|
||||
isVFIODevice := deviceManager.IsVFIODevice(vfio.ContainerPath)
|
||||
|
Loading…
Reference in New Issue
Block a user