utils

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ProcPath is a vfs storing process info for Linux.
	ProcPath = "/proc"
	// HostProcPath is the convention path where host `/proc` is mounted.
	HostProcPath = "/host/proc"
	// DiskRemoveTag indicates a Longhorn is pending to remove.
	DiskRemoveTag = "harvester-ndm-disk-remove"
)

Variables

This section is empty.

Functions

func CallerWithCondLock

func CallerWithCondLock[T any](cond *sync.Cond, f func() T) T

CallerWithLock is a helper function to call a function with a condition lock

func ContainsIgnoredCase

func ContainsIgnoredCase(s []string, k string) bool

func GetFullDevPath

func GetFullDevPath(shortPath string) string

func IsFSCorrupted

func IsFSCorrupted(err error) bool

func IsHostProcMounted

func IsHostProcMounted() (bool, error)

IsHostProcMounted checks if host's proc info `/proc` is mounted on `/host/proc`

func IsSupportedFileSystem

func IsSupportedFileSystem(fsType string) bool

func MakeExt4DiskFormatting

func MakeExt4DiskFormatting(devPath, uuid string) error

func MatchesIgnoredCase

func MatchesIgnoredCase(s []string, k string) bool

func MountDisk

func MountDisk(devPath, mountPoint string) error

MountDisk mounts the specified ext4 volume device to the specified path

func UmountDisk

func UmountDisk(path string) error

UmountDisk unmounts the specified volume device to the specified path

func XMLWriter added in v0.5.3

func XMLWriter(targetFilePath string, xmlData any) error

XMLWriter write XML to target file, make sure your xmlData should valid

Types

type Disk added in v0.5.3

type Disk struct {
	XMLName xml.Name `xml:"disk"`
	Type    string   `xml:"type,attr"`
	Device  string   `xml:"device,attr"`
	Driver  Driver   `xml:"driver"`
	Source  Source   `xml:"source"`
	Target  Target   `xml:"target"`
	WWN     string   `xml:"wwn"`
}

func DiskXMLReader added in v0.5.3

func DiskXMLReader(filePath string) (Disk, error)

DiskXMLReader can read the libvirt disk xml file and return a Disk struct

type Driver added in v0.5.3

type Driver struct {
	Name string `xml:"name,attr"`
	Type string `xml:"type,attr"`
}

type Source added in v0.5.3

type Source struct {
	File string `xml:"file,attr"`
}

type Target added in v0.5.3

type Target struct {
	Dev string `xml:"dev,attr"`
	Bus string `xml:"bus,attr"`
}

Jump to

Keyboard shortcuts

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