util

package
v0.24.3 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MountPointDevMinorTable sync.Map
)

Functions

func CheckDynamicPV added in v0.16.0

func CheckDynamicPV(name string) (bool, error)

func CheckExpectValue added in v0.18.0

func CheckExpectValue(m map[string]string, key string, targetValue string) bool

CheckExpectValue Check if the key has the expected value

func ContainsPrefix added in v0.17.2

func ContainsPrefix(slice []string, s string) bool

ContainsPrefix String checks if a string slice contains a string with a given prefix

func ContainsString added in v0.10.0

func ContainsString(slice []string, s string) bool

ContainsString checks if a string is in a string slice.

func DevMinor added in v0.23.6

func DevMinor(dev uint64) uint32

DevMinor returns the minor component of a Linux device number.

func DevMinorTableDelete added in v0.24.3

func DevMinorTableDelete(k any)

func DevMinorTableLoad added in v0.24.3

func DevMinorTableLoad(k any) (uint32, bool)

func DevMinorTableStore added in v0.24.3

func DevMinorTableStore(k any, dev uint64)

func DoWithContext added in v0.17.1

func DoWithContext(ctx context.Context, f func() error) error

func DoWithTimeout added in v0.17.1

func DoWithTimeout(parent context.Context, timeout time.Duration, f func() error) error

func GetDiskUsage added in v0.23.4

func GetDiskUsage(path string) (uint64, uint64, uint64, uint64)

func GetMountDeviceRefs added in v0.13.2

func GetMountDeviceRefs(pathname string, corrupted bool) ([]string, error)

GetMountDeviceRefs Get all mountpoints whose source is the device of `pathname` mountpoint, the `pathname` will be excluded. The `pathname` must be a mountpoint, and if the `corrupted` is true, the `pathname` is a corrupted mountpoint.

func GetMountPathOfPod added in v0.10.7

func GetMountPathOfPod(pod corev1.Pod) (string, string, error)

func GetReferenceKey added in v0.10.7

func GetReferenceKey(target string) string

func GetTime added in v0.13.0

func GetTime(str string) (time.Time, error)

func GetTimeAfterDelay added in v0.13.0

func GetTimeAfterDelay(delayStr string) (string, error)

GetTimeAfterDelay get time which after delay

func ImageResol added in v0.19.0

func ImageResol(image string) (hasCE, hasEE bool)

ImageResol check if image contains CE or EE ce image starts with "ce-" (latest image is CE) ee image starts with "ee-" Compatible with previous images: has both ce and ee

func NewPrometheus added in v0.23.4

func NewPrometheus(nodeName string) (prometheus.Registerer, *prometheus.Registry)

func ParseEndpoint

func ParseEndpoint(endpoint string) (string, string, error)

func ParseMntPath added in v0.10.7

func ParseMntPath(cmd string) (string, string, error)

ParseMntPath return mntPath, volumeId (/jfs/volumeId, volumeId err)

func ParseToBytes added in v0.23.6

func ParseToBytes(value string) (uint64, error)

ParseToBytes parses a string with a unit suffix (e.g. "1M", "2G") to bytes. default unit is M

func QuoteForShell added in v0.13.0

func QuoteForShell(cmd string) string

func RandStringRunes added in v0.14.1

func RandStringRunes(n int) string

func StripPasswd added in v0.13.0

func StripPasswd(uri string) string

func StripReadonlyOption added in v0.17.4

func StripReadonlyOption(options []string) []string

func UmountPath added in v0.17.1

func UmountPath(ctx context.Context, sourcePath string)

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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