deviceplugins

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

* This file was part of the KubeVirt project, copied to this project * to get around private package issues. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Copyright 2023 SUSE, LLC. *

Index

Constants

View Source
const (
	PCIResourcePrefix = "PCI_RESOURCE"
)

Variables

This section is empty.

Functions

func IsChanClosed

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

func SocketPath

func SocketPath(deviceName string) string

Types

type DeviceHandler

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)
}
var Handler DeviceHandler

type DeviceStarter

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

type DeviceUtilsHandler

type DeviceUtilsHandler struct{}

func (*DeviceUtilsHandler) GetDeviceDriver

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

gets device driver

func (*DeviceUtilsHandler) GetDeviceIOMMUGroup

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

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

func (*DeviceUtilsHandler) GetDevicePCIID

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

type PCIDevice

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

func (*PCIDevice) GetID

func (d *PCIDevice) GetID() string

type PCIDevicePlugin

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

func Create

func Create(
	resourceName string,
	pciAddressInitial string,
	pdsWithSameResourceName []*v1beta1.PCIDevice,
) *PCIDevicePlugin

Creates a new PCIDevicePlugin with that resourceName, and returns it

func Find

func Find(
	resourceName string,
	dps map[string]*PCIDevicePlugin,
) *PCIDevicePlugin

Looks for a PCIDevicePlugin with that resourceName, and returns it, or an error if it doesn't exist

func NewPCIDevicePlugin

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

func (*PCIDevicePlugin) AddDevice

func (dp *PCIDevicePlugin) AddDevice(pd *v1beta1.PCIDevice, pdc *v1beta1.PCIDeviceClaim) error

This function adds the PCIDevice to the device plugin, or creates the device plugin if it doesn't exist

func (*PCIDevicePlugin) Allocate

func (*PCIDevicePlugin) GetCount

func (dp *PCIDevicePlugin) GetCount() int

Not adding more data to the struct, it's big enough already

func (*PCIDevicePlugin) GetDeviceName

func (dpi *PCIDevicePlugin) GetDeviceName() string

func (*PCIDevicePlugin) GetDevicePath

func (dpi *PCIDevicePlugin) GetDevicePath() string

func (*PCIDevicePlugin) GetDevicePluginOptions

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

func (*PCIDevicePlugin) GetInitialized

func (dpi *PCIDevicePlugin) GetInitialized() bool

func (*PCIDevicePlugin) GetPCIDevices

func (dp *PCIDevicePlugin) GetPCIDevices() []*PCIDevice

func (*PCIDevicePlugin) ListAndWatch

func (*PCIDevicePlugin) MarkPCIDeviceAsHealthy

func (dp *PCIDevicePlugin) MarkPCIDeviceAsHealthy(resourceName string, pciAddress string)

func (*PCIDevicePlugin) MarkPCIDeviceAsUnhealthy

func (dp *PCIDevicePlugin) MarkPCIDeviceAsUnhealthy(pciAddress string)

func (*PCIDevicePlugin) RemoveDevice

func (dp *PCIDevicePlugin) RemoveDevice(pd *v1beta1.PCIDevice, pdc *v1beta1.PCIDeviceClaim) error

This function adds the PCIDevice to the device plugin, or creates the device plugin if it doesn't exist

func (*PCIDevicePlugin) Restart

func (dpi *PCIDevicePlugin) Restart() string

func (*PCIDevicePlugin) SetStarted

func (dpi *PCIDevicePlugin) SetStarted(stop chan struct{})

Set Started is used after a call to Start. It's purpose is to set the private starter properly

func (*PCIDevicePlugin) Start

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

Start starts the device plugin

func (*PCIDevicePlugin) Started

func (dpi *PCIDevicePlugin) Started() bool

func (*PCIDevicePlugin) Stop

func (dpi *PCIDevicePlugin) Stop() error

Jump to

Keyboard shortcuts

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