Documentation ¶
Index ¶
- Constants
- Variables
- func BindDefaultDriver(pciAddr string) error
- func BindDpdkDriver(pciAddr, driver string) error
- func Chroot(path string) (func() error, error)
- func DiscoverSriovDevices(withUnsupported bool) ([]sriovnetworkv1.InterfaceExt, error)
- func DiscoverSriovDevicesVirtual(devicesInfo OSPDevicesInfo) ([]sriovnetworkv1.InterfaceExt, error)
- func GetNicSriovMode(pciAddress string) (string, error)
- func GetOpenstackData() (metaData *OSPMetaData, networkData *OSPNetworkData, err error)
- func GetPhysPortName(name string) (string, error)
- func GetPhysSwitchID(name string) (string, error)
- func IsKernelLockdownMode(chroot bool) bool
- func IsSingleNodeCluster(c client.Client) (bool, error)
- func IsSwitchdevModeSpec(spec sriovnetworkv1.SriovNetworkNodeStateSpec) bool
- func LoadKernelModule(name string, args ...string) error
- func RebindVfToDefaultDriver(vfAddr string) error
- func RunCommand(command string, args ...string) (string, error)
- func Shutdown()
- func SkipConfigVf(ifSpec sriovnetworkv1.Interface, ifStatus sriovnetworkv1.InterfaceExt) bool
- func SyncNodeState(newState *sriovnetworkv1.SriovNetworkNodeState) error
- func SyncNodeStateVirtual(newState *sriovnetworkv1.SriovNetworkNodeState) error
- func Unbind(pciAddr string) error
- func WriteSwitchdevConfFile(newState *sriovnetworkv1.SriovNetworkNodeState) (update bool, err error)
- type OSPDeviceInfo
- type OSPDevicesInfo
- type OSPMetaData
- type OSPMetaDataDevice
- type OSPNetwork
- type OSPNetworkData
- type OSPNetworkLink
- type PlatformType
Constants ¶
const ( ResyncPeriod = 5 * time.Minute DefaultConfigName = "default" ConfigDaemonPath = "./bindata/manifests/daemon" InjectorWebHookPath = "./bindata/manifests/webhook" OperatorWebHookPath = "./bindata/manifests/operator-webhook" ServiceCAConfigMapAnnotation = "service.beta.openshift.io/inject-cabundle" InjectorWebHookName = "network-resources-injector-config" OperatorWebHookName = "sriov-operator-webhook-config" DeprecatedOperatorWebHookName = "operator-webhook-config" PluginPath = "./bindata/manifests/plugins" DaemonPath = "./bindata/manifests/daemon" DefaultPolicyName = "default" ConfigMapName = "device-plugin-config" DPConfigFileName = "config.json" OVSHWOLMachineConfigNameSuffix = "ovs-hw-offload" LinkTypeEthernet = "ether" LinkTypeInfiniband = "infiniband" )
const ( ClusterTypeOpenshift = "openshift" ClusterTypeKubernetes = "kubernetes" VendorMellanox = "15b3" DeviceBF2 = "a2d6" )
Variables ¶
var ClusterType string
var DpdkDrivers = []string{"igb_uio", "vfio-pci", "uio_pci_generic"}
var InitialState sriovnetworkv1.SriovNetworkNodeState
var ( // PlatformMap contains supported platforms for virtual VF PlatformMap = map[string]PlatformType{ "openstack": VirtualOpenStack, } )
Functions ¶
func BindDefaultDriver ¶
BindDefaultDriver bind driver for one device Bind the device given by "pciAddr" to the default driver
func BindDpdkDriver ¶
BindDpdkDriver bind dpdk driver for one device Bind the device given by "pciAddr" to the driver "driver"
func DiscoverSriovDevices ¶
func DiscoverSriovDevices(withUnsupported bool) ([]sriovnetworkv1.InterfaceExt, error)
func DiscoverSriovDevicesVirtual ¶
func DiscoverSriovDevicesVirtual(devicesInfo OSPDevicesInfo) ([]sriovnetworkv1.InterfaceExt, error)
DiscoverSriovDevicesVirtual discovers VFs on a virtual platform
func GetNicSriovMode ¶
func GetOpenstackData ¶ added in v1.2.0
func GetOpenstackData() (metaData *OSPMetaData, networkData *OSPNetworkData, err error)
GetOpenstackData gets the metadata and network_data
func GetPhysPortName ¶
func GetPhysSwitchID ¶
func IsKernelLockdownMode ¶ added in v1.1.0
IsKernelLockdownMode returns true when kernel lockdown mode is enabled
func IsSwitchdevModeSpec ¶
func IsSwitchdevModeSpec(spec sriovnetworkv1.SriovNetworkNodeStateSpec) bool
func LoadKernelModule ¶
func RebindVfToDefaultDriver ¶ added in v1.2.0
Workaround function to handle a case where the vf default driver is stuck and not able to create the vf kernel interface. This function unbind the VF from the default driver and try to bind it again bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2045087
func RunCommand ¶ added in v1.1.0
RunCommand runs a command
func SkipConfigVf ¶ added in v1.2.0
func SkipConfigVf(ifSpec sriovnetworkv1.Interface, ifStatus sriovnetworkv1.InterfaceExt) bool
SkipConfigVf Use systemd service to configure switchdev mode or BF-2 NICs in OpenShift
func SyncNodeState ¶
func SyncNodeState(newState *sriovnetworkv1.SriovNetworkNodeState) error
SyncNodeState Attempt to update the node state to match the desired state
func SyncNodeStateVirtual ¶
func SyncNodeStateVirtual(newState *sriovnetworkv1.SriovNetworkNodeState) error
SyncNodeStateVirtual attempt to update the node state to match the desired state
in virtual platforms
func WriteSwitchdevConfFile ¶
func WriteSwitchdevConfFile(newState *sriovnetworkv1.SriovNetworkNodeState) (update bool, err error)
Types ¶
type OSPDeviceInfo ¶ added in v1.2.0
type OSPDevicesInfo ¶ added in v1.2.0
type OSPDevicesInfo map[string]*OSPDeviceInfo
func CreateOpenstackDevicesInfo ¶ added in v1.2.0
func CreateOpenstackDevicesInfo(metaData *OSPMetaData, networkData *OSPNetworkData) (OSPDevicesInfo, error)
CreateOpenstackDevicesInfo create the openstack device info map
func CreateOpenstackDevicesInfoFromNodeStatus ¶ added in v1.2.0
func CreateOpenstackDevicesInfoFromNodeStatus(networkState *sriovnetworkv1.SriovNetworkNodeState) OSPDevicesInfo
type OSPMetaData ¶
type OSPMetaData struct { UUID string `json:"uuid,omitempty"` AdminPass string `json:"admin_pass,omitempty"` Name string `json:"name,omitempty"` LaunchIndex int `json:"launch_index,omitempty"` AvailabilityZone string `json:"availability_zone,omitempty"` ProjectID string `json:"project_id,omitempty"` Devices []OSPMetaDataDevice `json:"devices,omitempty"` }
OSPMetaData -- Openstack meta_data.json format
type OSPMetaDataDevice ¶
type OSPMetaDataDevice struct { Vlan int `json:"vlan,omitempty"` VfTrusted bool `json:"vf_trusted,omitempty"` Type string `json:"type,omitempty"` Mac string `json:"mac,omitempty"` Bus string `json:"bus,omitempty"` Address string `json:"address,omitempty"` Tags []string `json:"tags,omitempty"` }
OSPMetaDataDevice -- Device structure within meta_data.json
type OSPNetwork ¶
type OSPNetwork struct { ID string `json:"id"` Type string `json:"type"` Link string `json:"link"` NetworkID string `json:"network_id"` }
OSPNetwork OSP Network metadata
type OSPNetworkData ¶
type OSPNetworkData struct { Links []OSPNetworkLink `json:"links,omitempty"` Networks []OSPNetwork `json:"networks,omitempty"` }
OSPNetworkData OSP Network metadata
type OSPNetworkLink ¶
type OSPNetworkLink struct { ID string `json:"id"` VifID string `json:"vif_id,omitempty"` Type string `json:"type"` Mtu int `json:"mtu,omitempty"` EthernetMac string `json:"ethernet_mac_address"` }
OSPNetworkLink OSP Link metadata
type PlatformType ¶
type PlatformType int
PlatformType ...
const ( // Baremetal platform Baremetal PlatformType = iota // VirtualOpenStack ... VirtualOpenStack )
func (PlatformType) String ¶
func (e PlatformType) String() string