Documentation
¶
Overview ¶
Copyright 2024 The Scitix Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2024 The Scitix Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2024 The Scitix Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2024 The Scitix Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2024 The Scitix Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2024 The Scitix Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- func DisableACS(ctx context.Context, BDF string) error
- func EnableACS(ctx context.Context, deviceBDF string) error
- func ExecCommand(ctx context.Context, command string, args ...string) ([]byte, error)
- func ExtractClusterName() string
- func GetACSCapablePCIEDevices(ctx context.Context) ([]string, error)
- func GetACSStatus(ctx context.Context, BDF string) (string, error)
- func GetAllPCIeBDF(ctx context.Context) ([]string, error)
- func GetTerminalWidth() (int, error)
- func HasIOMMUGroups() (bool, error)
- func InitLogger(level logrus.Level, isJSON bool)
- func InitLoggerWithConfig(level logrus.Level, isJSON bool, config LogConfig)
- func IsACSDisabled(ctx context.Context, BDF string) (bool, string, error)
- func IsInfinibandExist() bool
- func IsKernalModuleHolder(holder, module string) (bool, error)
- func IsKernalModuleLoaded(moduleName string) (bool, error)
- func IsLowSpeedIBBond(ibDev string) bool
- func IsNvidiaGPUExist() bool
- func IsRoot() bool
- func IsRunningInKubernetes() bool
- func JSON(c interface{}) (string, error)
- func LoadFromYaml(file string, c interface{}) error
- func ParseBoolToFloat(b bool) float64
- func ParseStringToFloat(str string) float64
- func PrintTitle(text, paddingChar string)
- func TimeTrack(start time.Time, name string)
- func Yaml(c interface{}) (string, error)
- type LogConfig
- type PCIeACS
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecCommand ¶
func ExtractClusterName ¶ added in v0.7.2
func ExtractClusterName() string
func GetTerminalWidth ¶
func HasIOMMUGroups ¶
HasIOMMUGroups checks if IOMMU groups are present in /sys/kernel/iommu_groups
func InitLogger ¶
func InitLoggerWithConfig ¶
InitLoggerWithConfig initializes logger with file rotation support
func IsInfinibandExist ¶
func IsInfinibandExist() bool
func IsKernalModuleHolder ¶
IsKernalModuleHolder checks if a specific module is holding another module
func IsKernalModuleLoaded ¶
IsKernalModuleLoaded checks if a specific kernel module is loaded
func IsLowSpeedIBBond ¶ added in v0.7.8
IsLowSpeedIBBond returns true if the given IB device name looks like a bond (contains "bond") and its IB port rate is <= 100 Gb/sec, which indicates a non-HCA management bond (e.g. two 25G NIC slaves aggregated) rather than a business RoCE LAG / IB bond over high-speed HCAs.
Detection uses /sys/class/infiniband/<ibDev>/ports/1/rate — available inside containers that expose /sys/class/infiniband — instead of the ethernet-bond slave speed path which is often not visible there.
When the rate file cannot be read or parsed, returns false so callers conservatively keep the device rather than silently dropping a potential business port.
func IsNvidiaGPUExist ¶
func IsNvidiaGPUExist() bool
func IsRunningInKubernetes ¶
func IsRunningInKubernetes() bool
func LoadFromYaml ¶
func ParseBoolToFloat ¶
func ParseStringToFloat ¶
func PrintTitle ¶
func PrintTitle(text, paddingChar string)
Types ¶
type LogConfig ¶
type LogConfig struct {
// LogFile is the path to the log file. If empty, logs will only go to stdout
LogFile string
// MaxSize is the maximum size in megabytes of the log file before it gets rotated
MaxSize int // megabytes
// MaxBackups is the maximum number of old log files to retain
MaxBackups int
// MaxAge is the maximum number of days to retain old log files
MaxAge int // days
// Compress determines if the rotated log files should be compressed
Compress bool
// AlsoOutputToStdout determines if logs should also be written to stdout in addition to file
AlsoOutputToStdout bool
}
LogConfig holds configuration for logger