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
- func IsChanClosed(ch <-chan struct{}) bool
- func SocketPath(deviceName string) string
- type DeviceHandler
- type DeviceStarter
- type DeviceUtilsHandler
- func (h *DeviceUtilsHandler) GetDeviceDriver(basepath string, pciAddress string) (string, error)
- func (h *DeviceUtilsHandler) GetDeviceIOMMUGroup(basepath string, pciAddress string) (string, error)
- func (h *DeviceUtilsHandler) GetDeviceNumaNode(basepath string, pciAddress string) (numaNode int)
- func (h *DeviceUtilsHandler) GetDevicePCIID(basepath string, pciAddress string) (string, error)
- type PCIDevice
- type PCIDevicePlugin
- func (dp *PCIDevicePlugin) AddDevice(pd *v1beta1.PCIDevice, pdc *v1beta1.PCIDeviceClaim) error
- func (dpi *PCIDevicePlugin) Allocate(_ context.Context, r *pluginapi.AllocateRequest) (*pluginapi.AllocateResponse, error)
- func (dp *PCIDevicePlugin) GetCount() int
- func (dpi *PCIDevicePlugin) GetDeviceName() string
- func (dpi *PCIDevicePlugin) GetDevicePath() string
- func (dpi *PCIDevicePlugin) GetDevicePluginOptions(_ context.Context, _ *pluginapi.Empty) (*pluginapi.DevicePluginOptions, error)
- func (dpi *PCIDevicePlugin) GetInitialized() bool
- func (dp *PCIDevicePlugin) GetPCIDevices() []*PCIDevice
- func (dpi *PCIDevicePlugin) ListAndWatch(_ *pluginapi.Empty, s pluginapi.DevicePlugin_ListAndWatchServer) error
- func (dp *PCIDevicePlugin) MarkPCIDeviceAsHealthy(resourceName string, pciAddress string)
- func (dp *PCIDevicePlugin) MarkPCIDeviceAsUnhealthy(pciAddress string)
- func (dpi *PCIDevicePlugin) PreStartContainer(_ context.Context, _ *pluginapi.PreStartContainerRequest) (*pluginapi.PreStartContainerResponse, error)
- func (dp *PCIDevicePlugin) RemoveDevice(pd *v1beta1.PCIDevice, pdc *v1beta1.PCIDeviceClaim) error
- func (dpi *PCIDevicePlugin) Restart() string
- func (dpi *PCIDevicePlugin) SetStarted(stop chan struct{})
- func (dpi *PCIDevicePlugin) Start(stop <-chan struct{}) (err error)
- func (dpi *PCIDevicePlugin) Started() bool
- func (dpi *PCIDevicePlugin) Stop() error
Constants ¶
const (
PCIResourcePrefix = "PCI_RESOURCE"
)
Variables ¶
This section is empty.
Functions ¶
func IsChanClosed ¶
func IsChanClosed(ch <-chan struct{}) bool
func SocketPath ¶
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 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 (dpi *PCIDevicePlugin) Allocate(_ context.Context, r *pluginapi.AllocateRequest) (*pluginapi.AllocateResponse, error)
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 (dpi *PCIDevicePlugin) ListAndWatch(_ *pluginapi.Empty, s pluginapi.DevicePlugin_ListAndWatchServer) error
func (*PCIDevicePlugin) MarkPCIDeviceAsHealthy ¶
func (dp *PCIDevicePlugin) MarkPCIDeviceAsHealthy(resourceName string, pciAddress string)
func (*PCIDevicePlugin) MarkPCIDeviceAsUnhealthy ¶
func (dp *PCIDevicePlugin) MarkPCIDeviceAsUnhealthy(pciAddress string)
func (*PCIDevicePlugin) PreStartContainer ¶
func (dpi *PCIDevicePlugin) PreStartContainer(_ context.Context, _ *pluginapi.PreStartContainerRequest) (*pluginapi.PreStartContainerResponse, error)
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