Documentation
¶
Index ¶
- type Device
- type Interface
- type MockNvmdev
- func (m *MockNvmdev) AddMockA100Mdev(uuid string, mdevType string, mdevTypeDir string, parentDeviceDir string) error
- func (m *MockNvmdev) AddMockA100Parent(address string, numaNode int) error
- func (m *MockNvmdev) Cleanup()
- func (m MockNvmdev) GetAllDevices() ([]*Device, error)
- func (m MockNvmdev) GetAllParentDevices() ([]*ParentDevice, error)
- func (n MockNvmdev) NewDevice(root string, uuid string) (*Device, error)
- func (m MockNvmdev) NewParentDevice(devicePath string) (*ParentDevice, error)
- type Option
- type ParentDevice
- func (p *ParentDevice) CreateMDEVDevice(mdevType string, id string) error
- func (p *ParentDevice) DeleteMDEVDevice(id string) error
- func (p *ParentDevice) GetAvailableMDEVInstances(mdevType string) (int, error)
- func (p *ParentDevice) GetPhysicalFunction() *nvpci.NvidiaPCIDevice
- func (p *ParentDevice) IsMDEVTypeAvailable(mdevType string) (bool, error)
- func (p *ParentDevice) IsMDEVTypeSupported(mdevType string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Device ¶
type Device struct {
Path string
UUID string
MDEVType string
Driver string
IommuGroup int
Parent *ParentDevice
}
Device represents an NVIDIA MDEV (vGPU) device.
func (*Device) GetPhysicalFunction ¶
func (m *Device) GetPhysicalFunction() *nvpci.NvidiaPCIDevice
GetPhysicalFunction gets the physical PCI device that a vGPU is created on.
type Interface ¶
type Interface interface {
GetAllDevices() ([]*Device, error)
GetAllParentDevices() ([]*ParentDevice, error)
}
Interface allows us to get a list of NVIDIA MDEV (vGPU) and parent devices.
type MockNvmdev ¶
type MockNvmdev struct {
// contains filtered or unexported fields
}
MockNvmdev mock mdev device.
func NewMock ¶
func NewMock() (mock *MockNvmdev, rerr error)
NewMock creates new mock mediated (vGPU) and parent PCI devices and removes old devices.
func (*MockNvmdev) AddMockA100Mdev ¶
func (m *MockNvmdev) AddMockA100Mdev(uuid string, mdevType string, mdevTypeDir string, parentDeviceDir string) error
AddMockA100Mdev creates an A100 like MDEV (vGPU) mock device. The corresponding mocked parent A100 device must be created beforehand.
func (*MockNvmdev) AddMockA100Parent ¶
func (m *MockNvmdev) AddMockA100Parent(address string, numaNode int) error
AddMockA100Parent creates an A100 like parent GPU mock device.
func (*MockNvmdev) Cleanup ¶
func (m *MockNvmdev) Cleanup()
Cleanup removes the mocked mediated (vGPU) and parent PCI devices root folders.
func (MockNvmdev) GetAllDevices ¶
GetAllDevices returns all NVIDIA mdev (vGPU) devices on the system.
func (MockNvmdev) GetAllParentDevices ¶
func (m MockNvmdev) GetAllParentDevices() ([]*ParentDevice, error)
GetAllParentDevices returns all NVIDIA Parent PCI devices on the system.
func (MockNvmdev) NewDevice ¶ added in v0.6.1
NewDevice constructs a Device, which represents an NVIDIA mdev (vGPU) device.
func (MockNvmdev) NewParentDevice ¶ added in v0.6.1
func (m MockNvmdev) NewParentDevice(devicePath string) (*ParentDevice, error)
NewParentDevice constructs a ParentDevice.
type Option ¶ added in v0.6.1
type Option func(*nvmdev)
Option defines a function for passing options to the New() call.
func WithNvpciLib ¶ added in v0.6.1
WithNvpciLib provides an Option to set the nvpci library.
type ParentDevice ¶
type ParentDevice struct {
*nvpci.NvidiaPCIDevice
// contains filtered or unexported fields
}
ParentDevice represents an NVIDIA parent PCI device.
func (*ParentDevice) CreateMDEVDevice ¶
func (p *ParentDevice) CreateMDEVDevice(mdevType string, id string) error
CreateMDEVDevice creates a mediated device (vGPU) on the parent GPU.
func (*ParentDevice) DeleteMDEVDevice ¶
func (p *ParentDevice) DeleteMDEVDevice(id string) error
DeleteMDEVDevice deletes a mediated device (vGPU).
func (*ParentDevice) GetAvailableMDEVInstances ¶
func (p *ParentDevice) GetAvailableMDEVInstances(mdevType string) (int, error)
GetAvailableMDEVInstances returns the available instances for mdevType. Return -1 if mdevType is not supported for the device.
func (*ParentDevice) GetPhysicalFunction ¶
func (p *ParentDevice) GetPhysicalFunction() *nvpci.NvidiaPCIDevice
GetPhysicalFunction gets the physical PCI device backing a 'parent' device.
func (*ParentDevice) IsMDEVTypeAvailable ¶
func (p *ParentDevice) IsMDEVTypeAvailable(mdevType string) (bool, error)
IsMDEVTypeAvailable checks if a vGPU instance of mdevType can be created on the parent GPU.
func (*ParentDevice) IsMDEVTypeSupported ¶
func (p *ParentDevice) IsMDEVTypeSupported(mdevType string) bool
IsMDEVTypeSupported checks if the mdevType is supported by the GPU.