vsphere

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2025 License: Apache-2.0 Imports: 59 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
)
View Source
var VMUpdatePropertiesSelector = []string{
	"config",
	"guest",
	"layoutEx",
	"resourcePool",
	"runtime",
	"summary",
}

VMUpdatePropertiesSelector is the set of VM properties fetched at the start of UpdateVirtualMachine, It must be a super set of vmlifecycle.VMStatusPropertiesSelector[] since we may pass the properties collected here to vmlifecycle.UpdateStatus to avoid a second fetch of the VM properties.

Functions

func AddInstanceStorageVolumes

func AddInstanceStorageVolumes(
	vmCtx pkgctx.VirtualMachineContext,
	is vmopv1.InstanceStorage) 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 GetAdditionalResourcesForBackup

func GetAdditionalResourcesForBackup(
	vmCtx pkgctx.VirtualMachineContext,
	k8sClient ctrlclient.Client) ([]ctrlclient.Object, error)

GetAdditionalResourcesForBackup returns a list of Kubernetes client objects that are relevant for VM backup (e.g. bootstrap referenced resources).

func GetAttachedClassicDiskUUIDs

func GetAttachedClassicDiskUUIDs(vmCtx pkgctx.VirtualMachineContext) map[string]struct{}

func GetAttachedDiskUUIDToPVC

func GetAttachedDiskUUIDToPVC(
	vmCtx pkgctx.VirtualMachineContext,
	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 GetVirtualMachineBootstrap

func GetVirtualMachineBootstrap(
	vmCtx pkgctx.VirtualMachineContext,
	k8sClient ctrlclient.Client) (vmlifecycle.BootstrapData, error)

func GetVirtualMachineClass

func GetVirtualMachineClass(
	vmCtx pkgctx.VirtualMachineContext,
	k8sClient ctrlclient.Client) (vmopv1.VirtualMachineClass, error)

func GetVirtualMachineImageSpecAndStatus

GetVirtualMachineImageSpecAndStatus returns either the VirtualMachineImage or ClusterVirtualMachineImage resource, as well as its spec and status, for the resource used to deploy a VM.

Please note, this function is *not* designed to be invoked in the "update" VM workflow. This function assumes it is only ever invoked as part of the "create" workflow. For example, spec.image *can* be nil during the update workflow for imported VMs, and that is perfectly legal. However, this function marks a VM in error during the create workflow if spec.image is nil.

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

	Storage               storage.VMStorageData
	HasInstanceStorage    bool
	ChildResourcePoolName string
	ChildFolderName       string
	ClusterMoRef          vimtypes.ManagedObjectReference

	NetworkResults network.NetworkInterfaceResults
}

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

Jump to

Keyboard shortcuts

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