virtualmachine

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2018 License: MPL-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clone

Clone wraps the creation of a virtual machine and the subsequent waiting of the task. A higher-level virtual machine object is returned.

func Create

Create wraps the creation of a virtual machine and the subsequent waiting of the task. A higher-level virtual machine object is returned.

func Customize

func Customize(vm *object.VirtualMachine, spec types.CustomizationSpec) error

Customize wraps the customization of a virtual machine and the subsequent waiting of the task.

func Destroy

func Destroy(vm *object.VirtualMachine) error

Destroy wraps the Destroy task and the subsequent waiting for the task to complete.

func FromMOID

func FromMOID(client *govmomi.Client, id string) (*object.VirtualMachine, error)

FromMOID locates a virtualMachine by its managed object reference ID.

func FromPath

func FromPath(client *govmomi.Client, path string, dc *object.Datacenter) (*object.VirtualMachine, error)

FromPath returns a VirtualMachine via its supplied path.

func FromUUID

func FromUUID(client *govmomi.Client, uuid string) (*object.VirtualMachine, error)

FromUUID locates a virtualMachine by its UUID.

func GracefulPowerOff

func GracefulPowerOff(client *govmomi.Client, vm *object.VirtualMachine, timeout int, force bool) error

GracefulPowerOff is a meta-operation that handles powering down of virtual machines. A graceful shutdown is attempted first if possible (VMware tools is installed, and the guest state is not suspended), and then, if allowed, a power-off is forced if that fails.

func IsUUIDNotFoundError added in v1.5.0

func IsUUIDNotFoundError(err error) bool

IsUUIDNotFoundError returns true if the error is a UUIDNotFoundError.

func MoveToFolder

func MoveToFolder(client *govmomi.Client, vm *object.VirtualMachine, relative string) error

MoveToFolder moves a virtual machine to the specified folder.

func PowerOff

func PowerOff(vm *object.VirtualMachine) error

PowerOff wraps powering off a VM and the waiting for the subsequent task.

func PowerOn

func PowerOn(vm *object.VirtualMachine) error

PowerOn wraps powering on a VM and the waiting for the subsequent task.

func Properties

func Properties(vm *object.VirtualMachine) (*mo.VirtualMachine, error)

Properties is a convenience method that wraps fetching the VirtualMachine MO from its higher-level object.

func Reconfigure

Reconfigure wraps the Reconfigure task and the subsequent waiting for the task to complete.

func Relocate

func Relocate(vm *object.VirtualMachine, spec types.VirtualMachineRelocateSpec, timeout int) error

Relocate wraps the Relocate task and the subsequent waiting for the task to complete.

func ShutdownGuest

func ShutdownGuest(client *govmomi.Client, vm *object.VirtualMachine, timeout int) error

ShutdownGuest wraps the graceful shutdown of a guest VM, and then waiting an appropriate amount of time for the guest power state to go to powered off. If the VM does not power off in the shutdown period specified by timeout (in minutes), an error is returned.

The minimum value for timeout is 1 minute - setting to a 0 or negative value is not allowed and will just reset the timeout to the minimum.

func WaitForGuestNet

func WaitForGuestNet(client *govmomi.Client, vm *object.VirtualMachine, routable bool, timeout int) error

WaitForGuestNet waits for a virtual machine to have routable network access. This is denoted as a gateway, and at least one IP address that can reach that gateway. This function supports both IPv4 and IPv6, and returns the moment either stack is routable - it doesn't wait for both.

The timeout is specified in minutes. If zero or a negative value is passed, the waiter returns without error immediately.

Types

type MOIDForUUIDResult added in v1.5.0

type MOIDForUUIDResult struct {
	// The UUID of a virtual machine.
	UUID string

	// The matching managed object reference ID for the virtual machine at the ID
	// referenced by UUID.
	MOID string
}

MOIDForUUIDResult is a struct that holds a virtual machine UUID -> MOID association, designed to be used as a helper for mass returning the results of translating multiple UUIDs to managed object IDs for various virtual machine operations.

func MOIDForUUID added in v1.5.0

func MOIDForUUID(client *govmomi.Client, uuid string) (MOIDForUUIDResult, error)

MOIDForUUID returns the managed object reference ID for a specific virtual machine UUID and returns a MOIDForUUIDResult with the appropriate association.

func UUIDForMOID added in v1.5.0

func UUIDForMOID(client *govmomi.Client, moid string) (MOIDForUUIDResult, error)

UUIDForMOID returns the managed object reference ID for a specific virtual machine MOID and returns a MOIDForUUIDResult with the appropriate association.

type MOIDForUUIDResults added in v1.5.0

type MOIDForUUIDResults []MOIDForUUIDResult

MOIDForUUIDResults is a slice that holds multiple MOIDForUUIDResult structs.

func MOIDsForUUIDs added in v1.5.0

func MOIDsForUUIDs(client *govmomi.Client, uuids []string) (MOIDForUUIDResults, error)

MOIDsForUUIDs returns a MOIDForUUIDResults for a list of UUIDs. If one UUID cannot be found, an error is returned. There are no partial results returned.

func UUIDsForMOIDs added in v1.5.0

func UUIDsForMOIDs(client *govmomi.Client, moids []string) (MOIDForUUIDResults, error)

UUIDsForMOIDs returns a MOIDForUUIDResults for a list of MOIDs. If one MOID cannot be found, an error is returned. There are no partial results returned.

func UUIDsForManagedObjectReferences added in v1.5.0

func UUIDsForManagedObjectReferences(client *govmomi.Client, refs []types.ManagedObjectReference) (MOIDForUUIDResults, error)

UUIDsForManagedObjectReferences returns a MOIDForUUIDResults for a list of ManagedObjectReferences. If one cannot be found, an error is returned. There are no partial results returned.

func (MOIDForUUIDResults) MOIDs added in v1.5.0

func (r MOIDForUUIDResults) MOIDs() []string

MOIDs returns all MOIDs in a MOIDForUUIDResults.

func (MOIDForUUIDResults) ManagedObjectReferences added in v1.5.0

func (r MOIDForUUIDResults) ManagedObjectReferences() []types.ManagedObjectReference

ManagedObjectReferences returns all MOIDs in a MOIDForUUIDResults, as ManagedObjectReferences as type VirtualMachine.

func (MOIDForUUIDResults) UUIDs added in v1.5.0

func (r MOIDForUUIDResults) UUIDs() []string

UUIDs returns all UUIDs in a MOIDForUUIDResults.

type UUIDNotFoundError added in v1.1.1

type UUIDNotFoundError struct {
	// contains filtered or unexported fields
}

UUIDNotFoundError is an error type that is returned when a virtual machine could not be found by UUID.

func (*UUIDNotFoundError) Error added in v1.1.1

func (e *UUIDNotFoundError) Error() string

Error implements error for UUIDNotFoundError.

Jump to

Keyboard shortcuts

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