util

package
v0.0.0-...-20b7744 Latest Latest
Warning

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

Go to latest
Published: May 4, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GIB = 1024 * 1024 * 1024
)

Variables

This section is empty.

Functions

func NewDanglingError

func NewDanglingError(msg string, node k8stypes.NodeName, devicePath string) error

NewDanglingError create a new dangling error

func RoundUpSize

func RoundUpSize(volumeSizeBytes int64, allocationUnitBytes int64) int64

RoundUpSize calculates how many allocation units are needed to accommodate a volume of given size. E.g. when user wants 1500MiB volume, while AWS EBS allocates volumes in gibibyte-sized chunks, RoundUpSize(1500 * 1024*1024, 1024*1024*1024) returns '2' (2 GiB is the smallest allocatable volume that can hold 1500MiB)

func RoundUpSizeInt

func RoundUpSizeInt(volumeSizeBytes int64, allocationUnitBytes int64) (int, error)

RoundUpSizeInt calculates how many allocation units are needed to accommodate a volume of given size. It returns an int instead of an int64 and an error if there's overflow

func RoundUpToGiBInt

func RoundUpToGiBInt(size resource.Quantity) (int, error)

RoundUpToGiBInt rounds up given quantity upto chunks of GiB. It returns an int instead of an int64 and an error if there's overflow

Types

type DanglingAttachError

type DanglingAttachError struct {
	CurrentNode k8stypes.NodeName
	DevicePath  string
	// contains filtered or unexported fields
}

DanglingAttachError indicates volume is attached to a different node than we expected.

func (*DanglingAttachError) Error

func (err *DanglingAttachError) Error() string

Jump to

Keyboard shortcuts

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