util

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MinDiskSize       = 250 << 30
	MinPersistentSize = 150 << 30
	MiByteMultiplier  = 1 << 20
	GiByteMultiplier  = 1 << 30
)

Variables

View Source
var (
	HarvesterNodeRoleLabelPrefix = "node-role.harvesterhci.io/"
	HarvesterWitnessNodeLabelKey = HarvesterNodeRoleLabelPrefix + "witness"
	HarvesterMgmtNodeLabelKey    = HarvesterNodeRoleLabelPrefix + "management"
	HarvesterWorkerNodeLabelKey  = HarvesterNodeRoleLabelPrefix + "worker"
)

Functions

func ByteToGi added in v1.2.0

func ByteToGi(byte uint64) uint64

func ByteToMi added in v1.2.0

func ByteToMi(byte uint64) uint64

func CompareByShadow

func CompareByShadow(key, shadowLine string) bool

func DupStrings

func DupStrings(src []string) []string

func GetDiskSizeBytes added in v0.2.6

func GetDiskSizeBytes(devPath string) (uint64, error)

Get disk size in bytes

func GetEncryptedPasswd added in v1.1.2

func GetEncryptedPasswd(key string) (string, error)

func GiToByte added in v1.2.0

func GiToByte(gi uint64) uint64

func LoadFixture

func LoadFixture(t *testing.T, name string) []byte

LoadFixture loads a testing fixture from testdata dir

func MiToByte added in v1.2.0

func MiToByte(mi uint64) uint64

func ParsePartitionSize added in v1.2.0

func ParsePartitionSize(diskSizeBytes uint64, partitionSize string) (uint64, error)

func ReadCmdline

func ReadCmdline(prefix string) (map[string]interface{}, error)

ReadCmdline parses /proc/cmdline and returns a map contains kernel parameters

func RenderTemplate added in v0.2.0

func RenderTemplate(templ string, context interface{}) (string, error)

RenderTemplate renders a template that has no template reference in it

func SleepAndReboot

func SleepAndReboot() error

SleepAndReboot do sleep and exec reboot

func StringSliceContains

func StringSliceContains(sSlice []string, s string) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

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