utils

package
v0.0.0-...-96e6a5e Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CONFIG_FILE_SIZE_LIMIT_IN_BYTES = 10485760 //10 MB
	SRIOV_PREFIX                    = "SRIOV_FEC_"
	PCI_PF_STUB_DASH                = "pci-pf-stub"
	PCI_PF_STUB_UNDERSCORE          = "pci_pf_stub"
	VFIO_PCI                        = "vfio-pci"
	VFIO_PCI_UNDERSCORE             = "vfio_pci"
	IGB_UIO                         = "igb_uio"
)

Variables

View Source
var GetPCIDevices = func() ([]*ghw.PCIDevice, error) {
	pci, err := ghw.PCI()
	if err != nil {
		return nil, fmt.Errorf("Failed to get PCI info: %v", err)
	}

	devices := pci.ListDevices()
	if len(devices) == 0 {
		return nil, fmt.Errorf("Got 0 devices")
	}
	return devices, nil
}

Functions

func Filter

func Filter[T any](slice []T, filter func(T) bool) []T

func FindAccelerator

func FindAccelerator(cfgPath string) (bool, string, error)

func IsSingleNodeCluster

func IsSingleNodeCluster(c client.Client) (bool, error)

func NewLogWrapper

func NewLogWrapper() *logrusWrapper

func NewLogger

func NewLogger() *logrus.Logger

func SetOsEnvIfNotSet

func SetOsEnvIfNotSet(key, value string, logger logr.Logger) error

Types

type AcceleratorDiscoveryConfig

type AcceleratorDiscoveryConfig struct {
	VendorID  map[string]string
	Class     string
	SubClass  string
	Devices   map[string]string
	NodeLabel string
}

func LoadDiscoveryConfig

func LoadDiscoveryConfig(cfgPath string) (AcceleratorDiscoveryConfig, error)

Jump to

Keyboard shortcuts

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