utils

package
v3.0.0+incompatible Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectPluginWatchMode

func DetectPluginWatchMode(sockDir string) bool

DetectPluginWatchMode returns true if plugins registry directory exist

func GetDriverName

func GetDriverName(pciAddr string) (string, error)

GetDriverName returns current driver attached to a pci device from its pci address

func GetNetNames

func GetNetNames(pciAddr string) ([]string, error)

GetNetNames returns host net interface names as string for a PCI device from its pci address

func GetPciAddrFromVFID

func GetPciAddrFromVFID(pf string, vf int) (pciAddr string, err error)

GetPciAddrFromVFID returns PCI address for VF ID

func GetPfAddr

func GetPfAddr(pciAddr string) (string, error)

GetPfAddr returns SRIOV PF pci address if a device is VF given its pci address. If device it not VF then this will return its own address as PF

func GetPfName

func GetPfName(pciAddr string) (string, error)

GetPfName returns SRIOV PF name for the given VF If device is not VF then it will return its own ifname if exist else empty string

func GetSriovVFcapacity

func GetSriovVFcapacity(pf string) int

GetSriovVFcapacity returns SRIOV VF capacity

func GetUIODeviceFile

func GetUIODeviceFile(dev string) (devFile string, err error)

GetUIODeviceFile returns a vfio device files for vfio-pci bound PCI device's PCI address

func GetVFIODeviceFile

func GetVFIODeviceFile(dev string) (devFile string, err error)

GetVFIODeviceFile returns a vfio device files for vfio-pci bound PCI device's PCI address

func GetVFList

func GetVFList(pf string) (vfList []string, err error)

GetVFList returns a List containing PCI addr for all VF discovered in a given PF

func GetVFconfigured

func GetVFconfigured(pf string) int

GetVFconfigured returns number of VF configured for a PF

func IsNetlinkStatusUp

func IsNetlinkStatusUp(dev string) bool

IsNetlinkStatusUp returns 'false' if 'operstate' is not "up" for a Linux network device. This function will only return 'false' if the 'operstate' file of the device is readable and holds value anything other than "up". Or else we assume link is up.

func IsSriovPF

func IsSriovPF(pciAddr string) bool

IsSriovPF check if a pci device SRIOV capable given its pci address

func IsSriovVF

func IsSriovVF(pciAddr string) bool

IsSriovVF check if a pci device has link to a PF

func SriovConfigured

func SriovConfigured(addr string) bool

SriovConfigured returns true if sriov_numvfs reads > 0 else false

func ValidPciAddr

func ValidPciAddr(addr string) (string, error)

ValidPciAddr validates PciAddr given as string with host system

func ValidResourceName

func ValidResourceName(name string) bool

ValidResourceName returns true if it contains permitted characters otherwise false

Types

type FakeFilesystem

type FakeFilesystem struct {
	RootDir  string
	Dirs     []string
	Files    map[string][]byte
	Symlinks map[string]string
}

FakeFilesystem allows to setup isolated fake files structure used for the tests.

func (*FakeFilesystem) Use

func (fs *FakeFilesystem) Use() func()

Use function creates entire files structure and returns a function to tear it down. Example usage: defer fs.Use()()

Jump to

Keyboard shortcuts

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