mirror of
https://github.com/aljazceru/kata-containers.git
synced 2026-01-03 14:34:21 +01:00
gpu: Add ColdPlug of VFIO devices with devManager
If we have a VFIO device and cold-plug is enabled we mark each device as ColdPlug=true and let the VFIO module do the attaching. Signed-off-by: Zvonko Kaiser <zkaiser@nvidia.com>
This commit is contained in:
@@ -116,7 +116,7 @@ func (dm *deviceManager) createDevice(devInfo config.DeviceInfo) (dev api.Device
|
||||
if devInfo.ID, err = dm.newDeviceID(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if isVFIO(devInfo.HostPath) {
|
||||
if IsVFIO(devInfo.HostPath) {
|
||||
return drivers.NewVFIODevice(&devInfo), nil
|
||||
} else if isVhostUserBlk(devInfo) {
|
||||
if devInfo.DriverOptions == nil {
|
||||
|
||||
@@ -17,8 +17,8 @@ const (
|
||||
vfioPath = "/dev/vfio/"
|
||||
)
|
||||
|
||||
// isVFIO checks if the device provided is a vfio group.
|
||||
func isVFIO(hostPath string) bool {
|
||||
// IsVFIO checks if the device provided is a vfio group.
|
||||
func IsVFIO(hostPath string) bool {
|
||||
// Ignore /dev/vfio/vfio character device
|
||||
if strings.HasPrefix(hostPath, filepath.Join(vfioPath, "vfio")) {
|
||||
return false
|
||||
|
||||
@@ -31,7 +31,7 @@ func TestIsVFIO(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, d := range data {
|
||||
isVFIO := isVFIO(d.path)
|
||||
isVFIO := IsVFIO(d.path)
|
||||
assert.Equal(t, d.expected, isVFIO)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user