Documentation ¶
Index ¶
- type Device
- type Discover
- func CreateCreateSymlinkHook(nvidiaCDIHookPath string, links []string) Discover
- func FirstValid(discoverers ...Discover) Discover
- func Merge(d ...Discover) Discover
- func NewCharDeviceDiscoverer(logger logger.Interface, devRoot string, devices []string) Discover
- func NewDRMNodesDiscoverer(logger logger.Interface, devices image.VisibleDevices, devRoot string, ...) (Discover, error)
- func NewGDRCopyDiscoverer(logger logger.Interface, devRoot string) (Discover, error)
- func NewGDSDiscoverer(logger logger.Interface, driverRoot string, devRoot string) (Discover, error)
- func NewGraphicsMountsDiscoverer(logger logger.Interface, driver *root.Driver, nvidiaCDIHookPath string) (Discover, error)
- func NewIPCDiscoverer(logger logger.Interface, driverRoot string) (Discover, error)
- func NewLDCacheUpdateHook(logger logger.Interface, mounts Discover, ...) (Discover, error)
- func NewMOFEDDiscoverer(logger logger.Interface, devRoot string) (Discover, error)
- func NewMounts(logger logger.Interface, lookup lookup.Locator, root string, required []string) Discover
- func NewNvSwitchDiscoverer(logger logger.Interface, devRoot string) (Discover, error)
- func WithCache(d Discover) Discover
- func WithDriverDotSoSymlinks(mounts Discover, version string, nvidiaCDIHookPath string) Discover
- type DiscoverMock
- func (mock *DiscoverMock) Devices() ([]Device, error)
- func (mock *DiscoverMock) DevicesCalls() []struct{}
- func (mock *DiscoverMock) Hooks() ([]Hook, error)
- func (mock *DiscoverMock) HooksCalls() []struct{}
- func (mock *DiscoverMock) Mounts() ([]Mount, error)
- func (mock *DiscoverMock) MountsCalls() []struct{}
- type Filter
- type Hook
- type Mount
- type None
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Discover ¶
type Discover interface { Devices() ([]Device, error) Mounts() ([]Mount, error) Hooks() ([]Hook, error) }
Discover defines an interface for discovering the devices, mounts, and hooks available on a system
func CreateCreateSymlinkHook ¶ added in v1.13.0
CreateCreateSymlinkHook creates a hook which creates a symlink from link -> target.
func FirstValid ¶ added in v1.17.0
FirstValid returns a discoverer that returns the first non-error result from a list of discoverers.
func Merge ¶ added in v1.11.0
Merge creates a discoverer that is the composite of a list of discoverers.
func NewCharDeviceDiscoverer ¶ added in v1.11.0
NewCharDeviceDiscoverer creates a discoverer which locates the specified set of device nodes.
func NewDRMNodesDiscoverer ¶ added in v1.15.0
func NewDRMNodesDiscoverer(logger logger.Interface, devices image.VisibleDevices, devRoot string, nvidiaCDIHookPath string) (Discover, error)
NewDRMNodesDiscoverer returns a discoverer for the DRM device nodes associated with the specified visible devices.
TODO: The logic for creating DRM devices should be consolidated between this and the logic for generating CDI specs for a single device. This is only used when applying OCI spec modifications to an incoming spec in "legacy" mode.
func NewGDRCopyDiscoverer ¶ added in v1.15.0
func NewGDSDiscoverer ¶ added in v1.11.0
NewGDSDiscoverer creates a discoverer for GPUDirect Storage devices and mounts.
func NewGraphicsMountsDiscoverer ¶ added in v1.12.0
func NewGraphicsMountsDiscoverer(logger logger.Interface, driver *root.Driver, nvidiaCDIHookPath string) (Discover, error)
NewGraphicsMountsDiscoverer creates a discoverer for the mounts required by graphics tools such as vulkan.
func NewIPCDiscoverer ¶ added in v1.13.0
NewIPCDiscoverer creats a discoverer for NVIDIA IPC sockets.
func NewLDCacheUpdateHook ¶
func NewLDCacheUpdateHook(logger logger.Interface, mounts Discover, nvidiaCDIHookPath, ldconfigPath string) (Discover, error)
NewLDCacheUpdateHook creates a discoverer that updates the ldcache for the specified mounts. A logger can also be specified
func NewMOFEDDiscoverer ¶ added in v1.11.0
NewMOFEDDiscoverer creates a discoverer for MOFED devices.
func NewMounts ¶ added in v1.11.0
func NewMounts(logger logger.Interface, lookup lookup.Locator, root string, required []string) Discover
NewMounts creates a discoverer for the required mounts using the specified locator.
func NewNvSwitchDiscoverer ¶ added in v1.15.0
NewNvSwitchDiscoverer creates a discoverer for NVSWITCH devices.
type DiscoverMock ¶
type DiscoverMock struct { // DevicesFunc mocks the Devices method. DevicesFunc func() ([]Device, error) // HooksFunc mocks the Hooks method. HooksFunc func() ([]Hook, error) // MountsFunc mocks the Mounts method. MountsFunc func() ([]Mount, error) // contains filtered or unexported fields }
DiscoverMock is a mock implementation of Discover.
func TestSomethingThatUsesDiscover(t *testing.T) { // make and configure a mocked Discover mockedDiscover := &DiscoverMock{ DevicesFunc: func() ([]Device, error) { panic("mock out the Devices method") }, HooksFunc: func() ([]Hook, error) { panic("mock out the Hooks method") }, MountsFunc: func() ([]Mount, error) { panic("mock out the Mounts method") }, } // use mockedDiscover in code that requires Discover // and then make assertions. }
func (*DiscoverMock) Devices ¶
func (mock *DiscoverMock) Devices() ([]Device, error)
Devices calls DevicesFunc.
func (*DiscoverMock) DevicesCalls ¶
func (mock *DiscoverMock) DevicesCalls() []struct { }
DevicesCalls gets all the calls that were made to Devices. Check the length with:
len(mockedDiscover.DevicesCalls())
func (*DiscoverMock) Hooks ¶
func (mock *DiscoverMock) Hooks() ([]Hook, error)
Hooks calls HooksFunc.
func (*DiscoverMock) HooksCalls ¶
func (mock *DiscoverMock) HooksCalls() []struct { }
HooksCalls gets all the calls that were made to Hooks. Check the length with:
len(mockedDiscover.HooksCalls())
func (*DiscoverMock) Mounts ¶
func (mock *DiscoverMock) Mounts() ([]Mount, error)
Mounts calls MountsFunc.
func (*DiscoverMock) MountsCalls ¶
func (mock *DiscoverMock) MountsCalls() []struct { }
MountsCalls gets all the calls that were made to Mounts. Check the length with:
len(mockedDiscover.MountsCalls())
type Hook ¶
Hook represents a discovered hook.
func CreateLDCacheUpdateHook ¶ added in v1.12.0
CreateLDCacheUpdateHook locates the NVIDIA Container Toolkit CLI and creates a hook for updating the LD Cache
func CreateNvidiaCDIHook ¶ added in v1.16.0
CreateNvidiaCDIHook creates a hook which invokes the NVIDIA Container CLI hook subcommand.
func (Hook) Devices ¶ added in v1.13.0
Devices returns an empty list of devices for a Hook discoverer.