utils

package
v1.1.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	OwnerReadWriteExecuteOthersReadExecuteAttrs = 0755
	OwnerReadWriteOthersReadAttrs               = 0644
)
View Source
const (
	IPoIBAddrLengthBytes       = 20
	OwnerReadWriteExecuteAttrs = 0700
	OwnerReadWriteAttrs        = 0600
)

Variables

View Source
var (

	// NetDirectory sysfs net directory
	NetDirectory = "/sys/class/net"
	// SysBusPci is sysfs pci device directory
	SysBusPci = "/sys/bus/pci/devices"
)

Functions

func CleanCachedNetConf

func CleanCachedNetConf(cRefPath string) error

CleanCachedNetConf removed cached NetConf from disk

func CreateTmpSysFs

func CreateTmpSysFs() error

CreateTmpSysFs create mock sysfs for testing

func EnsureRdmaSystemMode

func EnsureRdmaSystemMode() error

Ensure RDMA subsystem mode is set to exclusive.

func GetGUIDFromHwAddr

func GetGUIDFromHwAddr(hwAddr net.HardwareAddr) string

Return GUID string, extracted from hardware address if it is IPoIB, or empty string

func GetPciAddress

func GetPciAddress(ifName string, vf int) (string, error)

GetPciAddress takes in a interface(ifName) and VF id and returns returns its pci addr as string

func GetPfName

func GetPfName(vf string) (string, error)

GetPfName returns PF net device name of a given VF pci address

func GetSriovNumVfs

func GetSriovNumVfs(ifName string) (int, error)

GetSriovNumVfs takes in a PF name(ifName) as string and returns number of VF configured as int

func GetVFLinkNames

func GetVFLinkNames(pciAddr string) (string, error)

GetVFLinkNames returns VF's network interface name given it's PCI addr

func GetVFLinkNamesFromVFID

func GetVFLinkNamesFromVFID(pfName string, vfID int) ([]string, error)

GetVFLinkNamesFromVFID returns VF's network interface name given it's PF name as string and VF id as int

func GetVfid

func GetVfid(addr, pfName string) (int, error)

GetVfid takes in VF's PCI address(addr) and pfName as string and returns VF's ID as int

func IsAllOnesGUID

func IsAllOnesGUID(guid string) bool

IsAllOnesGUID check if the guid is all ones

func IsAllZeroGUID

func IsAllZeroGUID(guid string) bool

IsAllZeroGUID check if the guid is all zero which is invalid guid

func IsValidGUID

func IsValidGUID(guid string) bool

IsValidGUID check if the guid is valid

func MoveRdmaDevFromNs

func MoveRdmaDevFromNs(rdmaDev string, sourceNs ns.NetNS) error

Move RDMA device from namespace to current (default) namespace

func MoveRdmaDevToNs

func MoveRdmaDevToNs(rdmaDev string, targetNs ns.NetNS) error

Move RDMA device to namespace

func MoveRdmaDevToNsPci

func MoveRdmaDevToNsPci(pciDev string, targetNs ns.NetNS) (string, error)

Move RDMA device to namespace

func ReadScratchNetConf

func ReadScratchNetConf(cRefPath string) ([]byte, error)

ReadScratchNetConf takes in container ID, Pod interface name and data dir as string and returns a pointer to Conf

func RemoveTmpSysFs

func RemoveTmpSysFs() error

RemoveTmpSysFs removes mocked sysfs

func SaveNetConf

func SaveNetConf(cid, dataDir, podIfName string, conf interface{}) error

SaveNetConf takes in container ID, data dir and Pod interface name as string and a json encoded struct Conf and save this Conf in data dir

Types

This section is empty.

Jump to

Keyboard shortcuts

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