utils

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RestoreVMStateFinalizer defines restore source vm finalizer
	RestoreVMStateFinalizer = "vmimport.v2v.kubevirt.io/restore-state"

	// CleanupSnapshotsFinalizer defines a finalizer to remove warm import snapshots
	CleanupSnapshotsFinalizer = "vmimport.v2v.kubevirt.io/cleanup-snapshots"

	// Finalaizer for handling cancelled import
	CancelledImportFinalizer = "vmimport.v2v.kubevirt.io/cancelled-import"
)

Variables

This section is empty.

Functions

func AddFinalizer added in v0.2.0

func AddFinalizer(cr *v2vv1.VirtualMachineImport, name string, client rclient.Client) error

AddFinalizer adds finalizer to VM import CR

func AppendMap added in v0.0.2

func AppendMap(origin map[string]string, newMap map[string]string)

AppendMap adds a map

func CountImportedDataVolumes

func CountImportedDataVolumes(dvsDone map[string]bool) int

CountImportedDataVolumes return number of true values in map of booleans

func EnsureLabelValueLength added in v0.2.0

func EnsureLabelValueLength(value string) string

EnsureLabelValueLength shortens given value to the maximum label value length of 63 characters

func FoldCleanUpErrors added in v0.2.2

func FoldCleanUpErrors(errs []error, vmiName k8stypes.NamespacedName) error

FoldCleanUpErrors combines clean up errors into one error

func FormatBytes

func FormatBytes(bytes int64) (string, error)

FormatBytes convert bytes to highest suffix

func GetMapKeys

func GetMapKeys(theMap map[string]string) []string

GetMapKeys gets all keys from a map as a slice

func GetOverheadForStorageClass added in v0.3.1

func GetOverheadForStorageClass(filesystemOverhead cdiv1.FilesystemOverhead, storageClass *string) float64

func HasFinalizer added in v0.2.0

func HasFinalizer(cr *v2vv1.VirtualMachineImport, name string) bool

HasFinalizer checks whether specific finalizer is set on VM import CR

func IndexNetworkByIDAndName added in v0.2.0

func IndexNetworkByIDAndName(mapping *[]v2vv1.NetworkResourceMappingItem) (mapByID map[string]v2vv1.NetworkResourceMappingItem, mapByName map[string]v2vv1.NetworkResourceMappingItem)

IndexNetworkByIDAndName indexes mapping array by ID and by Name

func IndexStorageItemByIDAndName added in v0.2.0

func IndexStorageItemByIDAndName(mapping *[]v2vv1.StorageResourceMappingItem) (mapByID map[string]v2vv1.StorageResourceMappingItem, mapByName map[string]v2vv1.StorageResourceMappingItem)

IndexStorageItemByIDAndName indexes mapping array by ID and by Name

func IsUtcCompatible

func IsUtcCompatible(timezone string) bool

IsUtcCompatible checks whether given timezone behaves like UTC - has the same offset of 0 and does not observer daylight saving time

func NormalizeLabel added in v0.2.4

func NormalizeLabel(name string) (string, error)

NormalizeLabel returns a normalized label based on the given name that complies to DNS 1123 format

func NormalizeName

func NormalizeName(name string) (string, error)

NormalizeName returns a normalized name based on the given name that complies to DNS 1123 format

func ParseUtcOffsetToSeconds

func ParseUtcOffsetToSeconds(offset string) (int, error)

ParseUtcOffsetToSeconds parses UTC offset string ([+|-]HH:MM) into representation in seconds. Only syntactical validation is performed on input string.

func RemoveFinalizer added in v0.2.0

func RemoveFinalizer(cr *v2vv1.VirtualMachineImport, name string, client rclient.Client) error

RemoveFinalizer removes specific finalizer from VM import CR

func RoundUp added in v0.3.5

func RoundUp(number, multiple int64) int64

RoundUp returns the number rounded up to the nearest multiple.

func ToLoggableID

func ToLoggableID(id *string, name *string) string

ToLoggableID creates loggable identifier that may be comprised of an id and/or a name

func ToLoggableResourceName

func ToLoggableResourceName(name string, namespace *string) string

ToLoggableResourceName creates loggable representation of maybe namespaced resource name

func UpdateAnnotations added in v0.2.2

func UpdateAnnotations(vm *v1.VirtualMachine, annotationMap map[string]string)

UpdateAnnotations updates a VirtualMachine's annotations with values from a provided map, overwriting any duplicates

func UpdateLabels added in v0.2.2

func UpdateLabels(vm *v1.VirtualMachine, labels map[string]string)

UpdateLabels updates a VirtualMachine's labels with values from a provided map, overwriting any duplicates

func WithMessage

func WithMessage(message string, newMessage string) string

WithMessage joins message and newMessage with a ", " string and returns the resulting string or returns newMessage if message is empty

Types

This section is empty.

Jump to

Keyboard shortcuts

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