Documentation
¶
Index ¶
- Constants
- Variables
- func CallerWithCondLock[T any](cond *sync.Cond, f func() T) T
- func ContainsIgnoredCase(s []string, k string) bool
- func ForceUmountWithTimeout(path string, timeout time.Duration) error
- func GenHash() string
- func GetFullDevPath(shortPath string) string
- func GetHostNamespacePath(hostProcPath string) string
- func GetMapperDeviceFromDM(dmDevice string) (string, error)
- func IsFSCorrupted(err error) bool
- func IsHostProcMounted() (bool, error)
- func IsManagedByMultipath(deviceName string) (string, error)
- func IsMultipathDevice(path string) (string, error)
- func IsSupportedFileSystem(fsType string) bool
- func MakeExt4DiskFormatting(devPath, uuid string) error
- func MatchesIgnoredCase(s []string, k string) bool
- func MountDisk(devPath, mountPoint string) error
- func UmountDisk(path string) error
- func XMLWriter(targetFilePath string, xmlData any) error
- type Disk
- type Driver
- type Executor
- type Source
- type Target
Constants ¶
const ( DockerdProcess = "dockerd" ContainerdProcess = "containerd" ContainerdProcessShim = "containerd-shim" )
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" // Harvester Namespace HarvesterNS = "harvester-system" // LVMCSIDriver is the LVM CSI driver name LVMCSIDriver = "lvm.driver.harvesterhci.io" // LVMTopologyNodeKey is the key of LVM topology node LVMTopologyNodeKey = "topology.lvm.csi/node" // LonghornSystemNamespaceName is the namespace containing longhorn components LonghornSystemNamespaceName = "longhorn-system" )
const (
NSBinary = "nsenter"
)
Variables ¶
var CmdTimeoutError error
Functions ¶
func CallerWithCondLock ¶
CallerWithLock is a helper function to call a function with a condition lock
func ContainsIgnoredCase ¶
ContainsIgnoredCase checks if the item of string slice contains the key with case-insensitive
func ForceUmountWithTimeout ¶ added in v0.6.3
ForceUmountWithTimeout umounts the specific device with timeout to the specified path
func GetFullDevPath ¶
GetFullDevPath will return full path with `/dev/` prefix
func GetHostNamespacePath ¶ added in v0.6.3
func GetMapperDeviceFromDM ¶ added in v1.7.0
GetMapperDeviceFromDM retrieves the mapper device for a dm-x device using dmsetup For example, dm-0 might return "0QEMU_QEMU_HARDDISK_disk2" This provides a stable device name that persists across reboots, unlike dm-x which can change
func IsFSCorrupted ¶
IsFSCorrupted checks if the error is caused by a corrupted filesystem
func IsHostProcMounted ¶
IsHostProcMounted checks if host's proc info `/proc` is mounted on `/host/proc`
func IsManagedByMultipath ¶ added in v1.7.0
IsManagedByMultipath checks if a /dev/xxx device is managed by multipath
func IsMultipathDevice ¶ added in v1.7.0
IsMultipathDevice checks if a dm-x device is multipath device
func IsSupportedFileSystem ¶
IsSupportedFileSystem checks if the filesystem type is supported
func MakeExt4DiskFormatting ¶
MakeExt4DiskFormatting formats the specified volume device to ext4 with the specified UUID return error if failed
func MatchesIgnoredCase ¶
MatchesIgnoredCase checks if the item of string slice fully match the key with case-insensitive
func UmountDisk ¶
UmountDisk unmounts the specified volume device to the specified path
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"`
VENDOR string `xml:"vendor"`
}
func DiskXMLReader ¶ added in v0.5.3
DiskXMLReader can read the libvirt disk xml file and return a Disk struct
type Executor ¶ added in v0.6.3
type Executor struct {
// contains filtered or unexported fields
}
func NewExecutor ¶ added in v0.6.3
func NewExecutor() *Executor