virtualmachine

package
v1.8.6 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BackupVirtualMachine

func BackupVirtualMachine(opts BackupVirtualMachineOptions) error

BackupVirtualMachine backs up the required data of a VM into its ExtraConfig. Currently, the following data is backed up: - VM Kubernetes resource in YAMl. - Additional VM-relevant Kubernetes resources in YAML, separated by "---". - PVC disk data in JSON format (if DiskUUIDToPVC is not empty).

func CPUQuantityToMhz

func CPUQuantityToMhz(q resource.Quantity, cpuFreqMhz uint64) int64

func ConfigSpecFromVMClassDevices

func ConfigSpecFromVMClassDevices(vmClassSpec *vmopv1.VirtualMachineClassSpec) *types.VirtualMachineConfigSpec

ConfigSpecFromVMClassDevices creates a ConfigSpec that adds the standalone hardware devices from the VMClass if any. This ConfigSpec will be used as the class ConfigSpec to CreateConfigSpec, with the rest of the class fields - like CPU count - applied on top.

func CreateConfigSpec

CreateConfigSpec returns an initial ConfigSpec that is created by overlaying the base ConfigSpec with VM Class spec and other arguments. TODO: We eventually need to de-dupe much of this with the ConfigSpec manipulation that's later done in the "update" pre-power on path. That operates on a ConfigInfo so we'd need to populate that from the config we build here.

func CreateConfigSpecForPlacement

func CreateConfigSpecForPlacement(
	vmCtx context.VirtualMachineContextA2,
	baseConfigSpec *types.VirtualMachineConfigSpec,
	storageClassesToIDs map[string]string) *types.VirtualMachineConfigSpec

CreateConfigSpecForPlacement creates a ConfigSpec that is suitable for Placement. baseConfigSpec will likely be - or at least derived from - the ConfigSpec returned by CreateConfigSpec above.

func CreateInstanceStorageDiskDevices

func CreateInstanceStorageDiskDevices(isVolumes []vmopv1.VirtualMachineVolume) []vimTypes.BaseVirtualDevice

func CreatePCIDevicesFromConfigSpec

func CreatePCIDevicesFromConfigSpec(pciDevsFromConfigSpec []*vimTypes.VirtualPCIPassthrough) []vimTypes.BaseVirtualDevice

CreatePCIDevicesFromConfigSpec creates vim25 VirtualDevices from the specified list of PCI devices from the VM Class ConfigSpec.

func CreatePCIDevicesFromVMClass

func CreatePCIDevicesFromVMClass(pciDevicesFromVMClass vmopv1.VirtualDevices) []vimTypes.BaseVirtualDevice

CreatePCIDevicesFromVMClass creates vim25 VirtualDevices from the specified list of PCI devices from VM Class spec.

func CreatePCIPassThroughDevice

func CreatePCIPassThroughDevice(deviceKey int32, backingInfo vimTypes.BaseVirtualDeviceBackingInfo) vimTypes.BaseVirtualDevice

func DecryptWebMKS

func DecryptWebMKS(privKey *rsa.PrivateKey, ciphertext string) (string, error)

func DeleteVirtualMachine

func DeleteVirtualMachine(
	vmCtx context.VirtualMachineContextA2,
	vcVM *object.VirtualMachine) error

func EncryptWebMKS

func EncryptWebMKS(pubKey string, plaintext string) (string, error)

func GetDefaultDiskProvisioningType

func GetDefaultDiskProvisioningType(
	vmCtx context.VirtualMachineContextA2,
	vcClient *vcclient.Client,
	storageProfileID string) (string, error)

GetDefaultDiskProvisioningType gets the default disk provisioning type specified for the VM.

func GetExtraConfigGuestInfo

func GetExtraConfigGuestInfo(
	ctx context.Context,
	vm *object.VirtualMachine) (map[string]string, error)

func GetVMClusterComputeResource

func GetVMClusterComputeResource(
	ctx context.Context,
	vcVM *object.VirtualMachine) (*object.ClusterComputeResource, error)

GetVMClusterComputeResource returns the VM's ClusterComputeResource.

func GetWebConsoleTicket

func GetWebConsoleTicket(
	vmCtx context.VirtualMachineContextA2,
	vm *object.VirtualMachine,
	pubKey string) (string, error)

func MemoryQuantityToMb

func MemoryQuantityToMb(q resource.Quantity) int64

Types

type BackupVirtualMachineOptions added in v1.8.6

type BackupVirtualMachineOptions struct {
	VMCtx               context.VirtualMachineContextA2
	VcVM                *object.VirtualMachine
	DiskUUIDToPVC       map[string]corev1.PersistentVolumeClaim
	AdditionalResources []client.Object
}

BackupVirtualMachineOptions contains the options for BackupVirtualMachine.

type PVCDiskData added in v1.8.6

type PVCDiskData struct {
	// Filename contains the datastore path to the virtual disk.
	FileName string
	// PVCName is the name of the PVC backed by the virtual disk.
	PVCName string
	// AccessMode is the access modes of the PVC backed by the virtual disk.
	AccessModes []corev1.PersistentVolumeAccessMode
}

PVCDiskData contains the data of a disk attached to VM backed by a PVC.

Jump to

Keyboard shortcuts

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