utils

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoBackendPVC = fmt.Errorf("no backend PVC when there should be one")

Functions

func BackendPVCVolumeName

func BackendPVCVolumeName(vmName string) string

BackendPVCVolumeName return the name of the volume that will be arbitrarily used to represent the backend PVC during volume enumeration.

func GetSnapshotVirtualMachineVolumes

func GetSnapshotVirtualMachineVolumes(vm *snapshotv1.VirtualMachine, client kubecli.KubevirtClient, opts ...VolumeOption) ([]v1.Volume, error)

GetSnapshotVirtualMachineVolumes returns all volumes of a Snapshot VM except the special ones based on volume options

func GetVirtualMachineInstanceVolumes

func GetVirtualMachineInstanceVolumes(vmi *v1.VirtualMachineInstance, opts ...VolumeOption) ([]v1.Volume, error)

GetVirtualMachineInstanceVolumes returns all volumes of a VMI except the special ones based on volume options

func GetVirtualMachineVolumes

func GetVirtualMachineVolumes(vm *v1.VirtualMachine, client kubecli.KubevirtClient, opts ...VolumeOption) ([]v1.Volume, error)

GetVirtualMachineVolumes returns all volumes of a VM except the special ones based on volume options

func GetVolumes

func GetVolumes(obj interface{}, client kubecli.KubevirtClient, opts ...VolumeOption) ([]v1.Volume, error)

GetVolumes returns all volumes of the passed object, empty if it's an unsupported object

func IsConfigVolume

func IsConfigVolume(volume *v1.Volume) bool

func IsErrNoBackendPVC

func IsErrNoBackendPVC(err error) bool

func IsStorageVolume

func IsStorageVolume(volume *v1.Volume) bool

Types

type VolumeOption

type VolumeOption int
const (
	// Default option, just includes regular volumes found in the VM/VMI spec
	WithRegularVolumes VolumeOption = iota
	// Includes backend storage PVC
	WithBackendVolume
	// Includes all volumes
	WithAllVolumes
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳