utils

package
v0.0.0-...-cebfaed Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VGName = "csi.io/volume-group-name"

	EnvSnapshotPrefix         = "SNAPSHOT_PREFIX"
	DefaultSnapshotPrefix     = "snap"
	KubernetesNodeIdentityKey = "kubernetes.io/hostname"
)

Variables

This section is empty.

Functions

func EnsureBlock

func EnsureBlock(target string) error

func GetNameKey

func GetNameKey(nameSpace, name string) string

func GetNodeNameFromCsiPV

func GetNodeNameFromCsiPV(pv *corev1.PersistentVolume) string

func GetVGNameFromCsiPV

func GetVGNameFromCsiPV(pv *corev1.PersistentVolume) string

func GetVolumeSnapshotContent

func GetVolumeSnapshotContent(snapclient snapshot.Interface, snapshotContentID string) (*snapshotapi.VolumeSnapshotContent, error)

func IsBlockDevice

func IsBlockDevice(fullPath string) (bool, error)

IsBlockDevice checks if the given path is a block device

func MountBlock

func MountBlock(source, target string, opts ...string) error

func Run

func Run(cmd string) (string, error)

Run run shell command

Types

type CommandRunFunc

type CommandRunFunc func(cmd string) (string, error)

CommandRunFunc define the run function in utils for ut

type OSTool

type OSTool interface {
	Remove(name string) error
	Stat(name string) (os.FileInfo, error)
	MkdirAll(path string, perm os.FileMode) error
	RunCommand(cmd string) (string, error)
	IsBlockDevice(fullPath string) (bool, error)
	MountBlock(source, target string, opts ...string) error
	EnsureBlock(target string) error
	CleanupMountPoint(mountPath string, mounter mountutils.Interface, extensiveMountPointCheck bool) error
	ResizeFS(devicePath string, deviceMountPath string) (bool, error)
}

func NewFakeOSTool

func NewFakeOSTool() OSTool

func NewOSTool

func NewOSTool() OSTool

Jump to

Keyboard shortcuts

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