device_manager

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 26, 2024 License: Apache-2.0 Imports: 32 Imported by: 4

Documentation

Index

Constants

View Source
const (
	DeviceNamespace = "devices.kubevirt.io"
)

Variables

This section is empty.

Functions

func IsChanClosed added in v0.36.0

func IsChanClosed(ch <-chan struct{}) bool

func SocketPath added in v0.16.0

func SocketPath(deviceName string) string

Types

type Device added in v0.51.0

type Device interface {
	Start(stop <-chan struct{}) (err error)
	GetDeviceName() string
	GetInitialized() bool
}

func PermanentHostDevicePlugins added in v0.51.0

func PermanentHostDevicePlugins(maxDevices int, permissions string) []Device

type DeviceController

type DeviceController struct {
	// contains filtered or unexported fields
}

func NewDeviceController

func NewDeviceController(
	host string,
	maxDevices int,
	permissions string,
	permanentPlugins []Device,
	clusterConfig *virtconfig.ClusterConfig,
	clientset k8scli.CoreV1Interface,
) *DeviceController

func (*DeviceController) Initialized added in v0.33.0

func (c *DeviceController) Initialized() bool

func (*DeviceController) NodeHasDevice added in v0.29.0

func (c *DeviceController) NodeHasDevice(devicePath string) bool

func (*DeviceController) RefreshMediatedDeviceTypes added in v0.58.2

func (c *DeviceController) RefreshMediatedDeviceTypes()

func (*DeviceController) Run

func (c *DeviceController) Run(stop chan struct{}) error

type DeviceControllerInterface added in v0.40.0

type DeviceControllerInterface interface {
	Initialized() bool
	RefreshMediatedDeviceTypes()
}

type DeviceHandler added in v0.36.0

type DeviceHandler interface {
	GetDeviceIOMMUGroup(basepath string, pciAddress string) (string, error)
	GetDeviceDriver(basepath string, pciAddress string) (string, error)
	GetDeviceNumaNode(basepath string, pciAddress string) (numaNode int)
	GetDevicePCIID(basepath string, pciAddress string) (string, error)
	GetMdevParentPCIAddr(mdevUUID string) (string, error)
	CreateMDEVType(mdevType string, parentID string) error
	RemoveMDEVType(mdevUUID string) error
	ReadMDEVAvailableInstances(mdevType string, parentID string) (int, error)
}
var Handler DeviceHandler

type DeviceUtilsHandler added in v0.36.0

type DeviceUtilsHandler struct{}

func (*DeviceUtilsHandler) CreateMDEVType added in v0.45.0

func (h *DeviceUtilsHandler) CreateMDEVType(mdevType string, parentID string) error

func (*DeviceUtilsHandler) GetDeviceDriver added in v0.36.0

func (h *DeviceUtilsHandler) GetDeviceDriver(basepath string, pciAddress string) (string, error)

gets device driver

func (*DeviceUtilsHandler) GetDeviceIOMMUGroup added in v0.36.0

func (h *DeviceUtilsHandler) GetDeviceIOMMUGroup(basepath string, pciAddress string) (string, error)

getDeviceIOMMUGroup gets devices iommu_group e.g. /sys/bus/pci/devices/0000\:65\:00.0/iommu_group -> ../../../../../kernel/iommu_groups/45

func (*DeviceUtilsHandler) GetDeviceNumaNode added in v0.36.0

func (h *DeviceUtilsHandler) GetDeviceNumaNode(basepath string, pciAddress string) (numaNode int)

func (*DeviceUtilsHandler) GetDevicePCIID added in v0.36.0

func (h *DeviceUtilsHandler) GetDevicePCIID(basepath string, pciAddress string) (string, error)

func (*DeviceUtilsHandler) GetMdevParentPCIAddr added in v0.36.0

func (h *DeviceUtilsHandler) GetMdevParentPCIAddr(mdevUUID string) (string, error)

/sys/class/mdev_bus/0000:00:03.0/53764d0e-85a0-42b4-af5c-2046b460b1dc

func (*DeviceUtilsHandler) ReadMDEVAvailableInstances added in v0.45.0

func (h *DeviceUtilsHandler) ReadMDEVAvailableInstances(mdevType string, parentID string) (int, error)

func (*DeviceUtilsHandler) RemoveMDEVType added in v0.45.0

func (h *DeviceUtilsHandler) RemoveMDEVType(mdevUUID string) error

type GenericDevicePlugin

type GenericDevicePlugin struct {
	// contains filtered or unexported fields
}

func NewGenericDevicePlugin

func NewGenericDevicePlugin(deviceName string, devicePath string, maxDevices int, permissions string, preOpen bool) *GenericDevicePlugin

func (*GenericDevicePlugin) Allocate

func (*GenericDevicePlugin) GetDeviceName added in v0.8.0

func (dpi *GenericDevicePlugin) GetDeviceName() string

func (*GenericDevicePlugin) GetDevicePluginOptions

func (dpi *GenericDevicePlugin) GetDevicePluginOptions(_ context.Context, _ *pluginapi.Empty) (*pluginapi.DevicePluginOptions, error)

func (*GenericDevicePlugin) GetInitialized added in v0.33.0

func (dpi *GenericDevicePlugin) GetInitialized() bool

func (*GenericDevicePlugin) ListAndWatch

func (*GenericDevicePlugin) Start

func (dpi *GenericDevicePlugin) Start(stop <-chan struct{}) (err error)

Start starts the device plugin

type LocalDevices added in v1.1.0

type LocalDevices struct {
	// contains filtered or unexported fields
}

type MDEV added in v0.36.0

type MDEV struct {
	UUID string
	// contains filtered or unexported fields
}

type MDEVTypesManager added in v0.45.0

type MDEVTypesManager struct {
	// contains filtered or unexported fields
}

func NewMDEVTypesManager added in v0.45.0

func NewMDEVTypesManager() *MDEVTypesManager

type MediatedDevicePlugin added in v0.36.0

type MediatedDevicePlugin struct {
	// contains filtered or unexported fields
}

func NewMediatedDevicePlugin added in v0.36.0

func NewMediatedDevicePlugin(mdevs []*MDEV, resourceName string) *MediatedDevicePlugin

func (*MediatedDevicePlugin) Allocate added in v0.36.0

func (*MediatedDevicePlugin) GetDeviceName added in v0.36.0

func (dpi *MediatedDevicePlugin) GetDeviceName() string

func (*MediatedDevicePlugin) GetDevicePluginOptions added in v0.36.0

func (dpi *MediatedDevicePlugin) GetDevicePluginOptions(_ context.Context, _ *pluginapi.Empty) (*pluginapi.DevicePluginOptions, error)

func (*MediatedDevicePlugin) GetInitialized added in v0.36.0

func (dpi *MediatedDevicePlugin) GetInitialized() bool

func (*MediatedDevicePlugin) ListAndWatch added in v0.36.0

func (*MediatedDevicePlugin) PreStartContainer added in v0.36.0

func (*MediatedDevicePlugin) Start added in v0.36.0

func (dpi *MediatedDevicePlugin) Start(stop <-chan struct{}) (err error)

Start starts the device plugin

type MockDeviceHandler added in v0.36.0

type MockDeviceHandler struct {
	// contains filtered or unexported fields
}

Mock of DeviceHandler interface

func NewMockDeviceHandler added in v0.36.0

func NewMockDeviceHandler(ctrl *gomock.Controller) *MockDeviceHandler

func (*MockDeviceHandler) CreateMDEVType added in v0.45.0

func (_m *MockDeviceHandler) CreateMDEVType(mdevType string, parentID string) error

func (*MockDeviceHandler) EXPECT added in v0.36.0

func (_m *MockDeviceHandler) EXPECT() *_MockDeviceHandlerRecorder

func (*MockDeviceHandler) GetDeviceDriver added in v0.36.0

func (_m *MockDeviceHandler) GetDeviceDriver(basepath string, pciAddress string) (string, error)

func (*MockDeviceHandler) GetDeviceIOMMUGroup added in v0.36.0

func (_m *MockDeviceHandler) GetDeviceIOMMUGroup(basepath string, pciAddress string) (string, error)

func (*MockDeviceHandler) GetDeviceNumaNode added in v0.36.0

func (_m *MockDeviceHandler) GetDeviceNumaNode(basepath string, pciAddress string) int

func (*MockDeviceHandler) GetDevicePCIID added in v0.36.0

func (_m *MockDeviceHandler) GetDevicePCIID(basepath string, pciAddress string) (string, error)

func (*MockDeviceHandler) GetMdevParentPCIAddr added in v0.36.0

func (_m *MockDeviceHandler) GetMdevParentPCIAddr(mdevUUID string) (string, error)

func (*MockDeviceHandler) ReadMDEVAvailableInstances added in v0.45.0

func (_m *MockDeviceHandler) ReadMDEVAvailableInstances(mdevType string, parentID string) (int, error)

func (*MockDeviceHandler) RemoveMDEVType added in v0.45.0

func (_m *MockDeviceHandler) RemoveMDEVType(mdevUUID string) error

type PCIDevice added in v0.36.0

type PCIDevice struct {
	// contains filtered or unexported fields
}

type PCIDevicePlugin added in v0.36.0

type PCIDevicePlugin struct {
	// contains filtered or unexported fields
}

func NewPCIDevicePlugin added in v0.36.0

func NewPCIDevicePlugin(pciDevices []*PCIDevice, resourceName string) *PCIDevicePlugin

func (*PCIDevicePlugin) Allocate added in v0.36.0

func (*PCIDevicePlugin) GetDeviceName added in v0.36.0

func (dpi *PCIDevicePlugin) GetDeviceName() string

func (*PCIDevicePlugin) GetDevicePluginOptions added in v0.36.0

func (dpi *PCIDevicePlugin) GetDevicePluginOptions(_ context.Context, _ *pluginapi.Empty) (*pluginapi.DevicePluginOptions, error)

func (*PCIDevicePlugin) GetInitialized added in v0.36.0

func (dpi *PCIDevicePlugin) GetInitialized() bool

func (*PCIDevicePlugin) ListAndWatch added in v0.36.0

func (*PCIDevicePlugin) PreStartContainer added in v0.36.0

func (*PCIDevicePlugin) Start added in v0.36.0

func (dpi *PCIDevicePlugin) Start(stop <-chan struct{}) (err error)

Start starts the device plugin

type PluginDevices added in v1.1.0

type PluginDevices struct {
	ID string

	Devices []*USBDevice
	// contains filtered or unexported fields
}

type SocketDevicePlugin added in v1.0.0

type SocketDevicePlugin struct {
	// contains filtered or unexported fields
}

func NewSocketDevicePlugin added in v1.0.0

func NewSocketDevicePlugin(socketName, socketDir, socket string, maxDevices int) *SocketDevicePlugin

func (*SocketDevicePlugin) Allocate added in v1.0.0

func (*SocketDevicePlugin) GetDeviceName added in v1.0.0

func (dpi *SocketDevicePlugin) GetDeviceName() string

func (*SocketDevicePlugin) GetDevicePluginOptions added in v1.0.0

func (dpi *SocketDevicePlugin) GetDevicePluginOptions(_ context.Context, _ *pluginapi.Empty) (*pluginapi.DevicePluginOptions, error)

func (*SocketDevicePlugin) GetInitialized added in v1.0.0

func (dpi *SocketDevicePlugin) GetInitialized() bool

func (*SocketDevicePlugin) ListAndWatch added in v1.0.0

func (*SocketDevicePlugin) PreStartContainer added in v1.0.0

func (*SocketDevicePlugin) Start added in v1.0.0

func (dpi *SocketDevicePlugin) Start(stop <-chan struct{}) (err error)

Start starts the device plugin

type USBDevice added in v1.1.0

type USBDevice struct {
	Name         string
	Manufacturer string
	Vendor       int
	Product      int
	BCD          int
	Bus          int
	DeviceNumber int
	Serial       string
	DevicePath   string
}

The sysfs metadata wrapper for the USB devices

func (*USBDevice) GetID added in v1.1.0

func (dev *USBDevice) GetID() string

The uniqueness in the system comes from bus and device number but having the vendor:product information can help a lot. Not all usb devices provide or export a serial number.

type USBDevicePlugin added in v1.1.0

type USBDevicePlugin struct {
	// contains filtered or unexported fields
}

The actual plugin

func NewUSBDevicePlugin added in v1.1.0

func NewUSBDevicePlugin(resourceName string, pluginDevices []*PluginDevices) *USBDevicePlugin

func (*USBDevicePlugin) Allocate added in v1.1.0

Interface to allocate requested Device, exported by ListAndWatch

func (*USBDevicePlugin) FindDevice added in v1.1.0

func (plugin *USBDevicePlugin) FindDevice(pluginDeviceID string) *PluginDevices

func (*USBDevicePlugin) FindDeviceByUSBID added in v1.1.0

func (plugin *USBDevicePlugin) FindDeviceByUSBID(usbID string) *PluginDevices

func (*USBDevicePlugin) GetDeviceName added in v1.1.0

func (plugin *USBDevicePlugin) GetDeviceName() string

func (*USBDevicePlugin) GetDevicePluginOptions added in v1.1.0

func (plugin *USBDevicePlugin) GetDevicePluginOptions(ctx context.Context, _ *pluginapi.Empty) (*pluginapi.DevicePluginOptions, error)

func (*USBDevicePlugin) GetInitialized added in v1.1.0

func (plugin *USBDevicePlugin) GetInitialized() bool

func (*USBDevicePlugin) ListAndWatch added in v1.1.0

Interface to expose Devices: IDs, health and Topology

func (*USBDevicePlugin) PreStartContainer added in v1.1.0

func (*USBDevicePlugin) Start added in v1.1.0

func (plugin *USBDevicePlugin) Start(stop <-chan struct{}) error

Directories

Path Synopsis
deviceplugin

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL