vsphere

package
v1.8.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	VsphereVMProviderName = "vsphere"
)

Variables

View Source
var (

	// SkipVMImageCLProviderCheck skips the checks that a VM Image has a Content Library item provider
	// since a VirtualMachineImage created for a VM template won't have either. This has been broken for
	// a long time but was otherwise masked on how the tests used to be organized.
	SkipVMImageCLProviderCheck = false
)

Functions

func AddInstanceStorageVolumes

func AddInstanceStorageVolumes(
	vmCtx context.VirtualMachineContextA2,
	vmClass *vmopv1.VirtualMachineClass) bool

AddInstanceStorageVolumes checks if VM class is configured with instance storage volumes and appends the volumes to the VM's Spec if not already done. Return true if the VM had or now has instance storage volumes.

func GetAttachedDiskUUIDToPVC

func GetAttachedDiskUUIDToPVC(
	vmCtx context.VirtualMachineContextA2,
	k8sClient ctrlclient.Client) (map[string]corev1.PersistentVolumeClaim, error)

GetAttachedDiskUUIDToPVC returns a map of disk UUID to PVC object for all attached disks by checking the VM's spec and status of volumes.

func GetVMClassConfigSpec

func GetVMClassConfigSpec(raw json.RawMessage) (*types.VirtualMachineConfigSpec, error)

func GetVirtualMachineBootstrap

func GetVirtualMachineBootstrap(
	vmCtx context.VirtualMachineContextA2,
	k8sClient ctrlclient.Client) (vmlifecycle.BootstrapData, error)

func HardwareVersionForPVCandPCIDevices

func HardwareVersionForPVCandPCIDevices(imageHWVersion int32, configSpec *types.VirtualMachineConfigSpec, hasPVC bool) int32

HardwareVersionForPVCandPCIDevices returns a hardware version for VMs with PVCs and PCI devices(vGPUs/DDPIO devices) The hardware version is determined based on the below criteria: VMs with - Persistent Volume Claim (PVC) get the max(the image hardware version, minimum supported virtual hardware version for persistent volumes) - vGPUs/DDPIO devices get the max(the image hardware version, minimum supported virtual hardware version for PCI devices) - Both vGPU/DDPIO devices and PVCs get the max(the image hardware version, minimum supported virtual hardware version for PCI devices) - none of the above returns 0.

func HasPVC

func HasPVC(vmSpec vmopv1.VirtualMachineSpec) bool

HasPVC returns true if the VirtualMachine spec has a Persistent Volume claim.

func InitOvfCacheAndLockPool

func InitOvfCacheAndLockPool(expireAfter, checkExpireInterval time.Duration, maxItems int) (
	*util.Cache[VersionedOVFEnvelope], *util.LockPool[string, *sync.RWMutex])

InitOvfCacheAndLockPool initializes the ovf cache and lock pool that are used to cache the ovf envelope and lock the ovf envelope when it is being downloaded.

Types

type VMCreateArgs

type VMCreateArgs struct {
	vmlifecycle.CreateArgs
	vmlifecycle.BootstrapData

	VMClass        *vmopv1.VirtualMachineClass
	ResourcePolicy *vmopv1.VirtualMachineSetResourcePolicy
	ImageObj       ctrlclient.Object
	ImageSpec      *vmopv1.VirtualMachineImageSpec
	ImageStatus    *vmopv1.VirtualMachineImageStatus

	StorageClassesToIDs   map[string]string
	HasInstanceStorage    bool
	ChildResourcePoolName string
	ChildFolderName       string
	ClusterMoRef          types.ManagedObjectReference

	NetworkResults network.NetworkInterfaceResults
}

VMCreateArgs contains the arguments needed to create a VM on VC.

type VersionedOVFEnvelope

type VersionedOVFEnvelope struct {
	OvfEnvelope    *ovf.Envelope
	ContentVersion string
}

Jump to

Keyboard shortcuts

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