vsphere

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: Apache-2.0 Imports: 92 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSetPowerState            = res.ErrSetPowerState
	ErrUpgradeSchema            = upgradevm.ErrUpgradeSchema
	ErrUpgradeObject            = upgradevm.ErrUpgradeObject
	ErrBackup                   = virtualmachine.ErrBackingUp
	ErrBootstrapReconfigure     = vmlifecycle.ErrBootstrapReconfigure
	ErrBootstrapCustomize       = vmlifecycle.ErrBootstrapCustomize
	ErrReconfigure              = session.ErrReconfigure
	ErrRestart                  = pkgerr.NoRequeueNoErr("restarted vm")
	ErrUpgradeHardwareVersion   = session.ErrUpgradeHardwareVersion
	ErrIsPaused                 = pkgerr.NoRequeueNoErr("is paused")
	ErrHasTask                  = pkgerr.NoRequeueNoErr("has outstanding task")
	ErrPromoteDisks             = vmconfdiskpromo.ErrPromoteDisks
	ErrCreate                   = pkgerr.NoRequeueNoErr("created vm")
	ErrUpdate                   = pkgerr.NoRequeueNoErr("updated vm")
	ErrSnapshotRevert           = pkgerr.NoRequeueNoErr("reverted snapshot")
	ErrPolicyNotReady           = vmconfpolicy.ErrPolicyNotReady
	ErrRegisterVolumes          = vmconfunmanagedvolsreg.ErrPendingRegister
	ErrAddedInstanceStorageVols = pkgerr.NoRequeueNoErr("added instance storage volumes")
)
View Source
var (
	// ErrVMGroupPlacementConfigSpec is the error returned when not all VMs in the group
	// placement were able to get their placement ConfigSpec, so group placement could not
	// be done.
	ErrVMGroupPlacementConfigSpec = errors.New("failed to get all VM placement ConfigSpecs")
)
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",
	"recentTask",
	"resourcePool",
	"runtime",
	"snapshot",
	"summary",
}

VMUpdatePropertiesSelector is the set of VM properties fetched at the start of updateVirtualMachine.

Functions

func AddInstanceStorageVolumes

func AddInstanceStorageVolumes(
	vmCtx pkgctx.VirtualMachineContext,
	is vmopv1.InstanceStorage) (bool, 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 DefaultGuestIDIfEmpty added in v1.10.0

func DefaultGuestIDIfEmpty(
	vmSpecGuestID, imgGuestID string,
	configSpec *vimtypes.VirtualMachineConfigSpec) bool

DefaultGuestIDIfEmpty sets configSpec.GuestId to otherGuest when no guest ID is specified by the VM spec, image, or class. VM classes created via the vSphere UI default to otherGuest64; this is treated as unset and overridden so that OVFs without an OperatingSystemSection can power on successfully. Returns true if the guest ID was updated.

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 for volumes that have a PersistentVolumeClaim.

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.

func NormalizeVAppConfigExpressionProperties added in v1.10.0

func NormalizeVAppConfigExpressionProperties(configSpec *vimtypes.VirtualMachineConfigSpec)

NormalizeVAppConfigExpressionProperties converts vAppProperty types from expression and ip:network to string so they can be configured via vApp bootstrap templating. Supervisor does not support vApp network expressions.

func ReconcileCurrentSnapshot added in v1.10.0

func ReconcileCurrentSnapshot(
	vmCtx pkgctx.VirtualMachineContext,
	k8sClient ctrlclient.Client,
	vcVM *object.VirtualMachine) error

ReconcileCurrentSnapshot reconciles the current snapshot owned by the VM.

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