host

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2025 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HostManager

type HostManager interface {
	// DiscoverNicDevices discovers Nvidia NIC devices on the host and returns back a map of serial numbers to device statuses
	DiscoverNicDevices() (map[string]v1alpha1.NicDeviceStatus, error)
	// ValidateDeviceNvSpec will validate device's non-volatile spec against already applied configuration on the host
	// returns bool - nv config update required
	// returns bool - reboot required
	// returns error - there are errors in device's spec
	ValidateDeviceNvSpec(ctx context.Context, device *v1alpha1.NicDevice) (bool, bool, error)
	// ApplyDeviceNvSpec calculates device's missing nv spec configuration and applies it to the device on the host
	// returns bool - reboot required
	// returns error - there were errors while applying nv configuration
	ApplyDeviceNvSpec(ctx context.Context, device *v1alpha1.NicDevice) (bool, error)
	// ApplyDeviceRuntimeSpec calculates device's missing runtime spec configuration and applies it to the device on the host
	// returns error - there were errors while applying nv configuration
	ApplyDeviceRuntimeSpec(device *v1alpha1.NicDevice) error
	// DiscoverOfedVersion retrieves installed OFED version
	// returns string - installed OFED version
	// returns empty string - OFED isn't installed or version couldn't be determined
	DiscoverOfedVersion() string
	// ResetNicFirmware resets NIC's firmware
	// Operation can be long, required context to be able to terminate by timeout
	// IB devices need to communicate with other nodes for confirmation
	// return err - there were errors while resetting NIC firmware
	ResetNicFirmware(ctx context.Context, device *v1alpha1.NicDevice) error
}

HostManager contains logic for managing NIC devices on the host

func NewHostManager

func NewHostManager(nodeName string, hostUtils HostUtils, eventRecorder record.EventRecorder) HostManager

type HostUtils

type HostUtils interface {
	// GetPCIDevices returns a list of PCI devices on the host
	GetPCIDevices() ([]*pci.Device, error)
	// GetPartAndSerialNumber uses mstvpd util to retrieve Part and Serial numbers of the PCI device
	GetPartAndSerialNumber(pciAddr string) (string, string, error)
	// GetFirmwareVersionAndPSID uses mstflint tool to retrieve FW version and PSID of the device
	GetFirmwareVersionAndPSID(pciAddr string) (string, string, error)
	// GetPCILinkSpeed return PCI bus speed in GT/s
	GetPCILinkSpeed(pciAddr string) (int, error)
	// GetMaxReadRequestSize returns MaxReadRequest size for PCI device
	GetMaxReadRequestSize(pciAddr string) (int, error)
	// GetTrustAndPFC returns trust and pfc settings for network interface
	GetTrustAndPFC(interfaceName string) (string, string, error)
	// GetRDMADeviceName returns a RDMA device name for the given PCI address
	GetRDMADeviceName(pciAddr string) string
	// GetInterfaceName returns a network interface name for the given PCI address
	GetInterfaceName(pciAddr string) string
	// GetLinkType return the link type of the net device (Ethernet / Infiniband)
	GetLinkType(name string) string
	// IsSriovVF return true if the device is a SRIOV VF, false otherwise
	IsSriovVF(pciAddr string) bool
	// QueryNvConfig queries nv config for a mellanox device and returns default, current and next boot configs
	QueryNvConfig(ctx context.Context, pciAddr string) (types.NvConfigQuery, error)
	// SetNvConfigParameter sets a nv config parameter for a mellanox device
	SetNvConfigParameter(pciAddr string, paramName string, paramValue string) error
	// ResetNvConfig resets NIC's nv config
	ResetNvConfig(pciAddr string) error
	// ResetNicFirmware resets NIC's firmware
	// Operation can be long, required context to be able to terminate by timeout
	// IB devices need to communicate with other nodes for confirmation
	ResetNicFirmware(ctx context.Context, pciAddr string) error
	// SetMaxReadRequestSize sets max read request size for PCI device
	SetMaxReadRequestSize(pciAddr string, maxReadRequestSize int) error
	// SetTrustAndPFC sets trust and PFC settings for a network interface
	SetTrustAndPFC(interfaceName string, trust string, pfc string) error
	// ScheduleReboot schedules reboot on the host
	ScheduleReboot() error
	// GetOfedVersion retrieves installed OFED version
	GetOfedVersion() string
	// GetHostUptimeSeconds returns the host uptime in seconds
	GetHostUptimeSeconds() (time.Duration, error)
}

HostUtils is an interface that contains util functions that perform operations on the actual host

func NewHostUtils

func NewHostUtils() HostUtils

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳