Documentation ¶
Index ¶
- func Clone(c *govmomi.Client, src *object.VirtualMachine, f *object.Folder, name string, ...) (*object.VirtualMachine, error)
- func Create(c *govmomi.Client, f *object.Folder, s types.VirtualMachineConfigSpec, ...) (*object.VirtualMachine, error)
- func Customize(vm *object.VirtualMachine, spec types.CustomizationSpec) error
- func Destroy(vm *object.VirtualMachine) error
- func FromMOID(client *govmomi.Client, id string) (*object.VirtualMachine, error)
- func FromPath(client *govmomi.Client, path string, dc *object.Datacenter) (*object.VirtualMachine, error)
- func FromUUID(client *govmomi.Client, uuid string) (*object.VirtualMachine, error)
- func GracefulPowerOff(client *govmomi.Client, vm *object.VirtualMachine, timeout int, force bool) error
- func MoveToFolder(client *govmomi.Client, vm *object.VirtualMachine, relative string) error
- func PowerOff(vm *object.VirtualMachine) error
- func PowerOn(vm *object.VirtualMachine) error
- func Properties(vm *object.VirtualMachine) (*mo.VirtualMachine, error)
- func Reconfigure(vm *object.VirtualMachine, spec types.VirtualMachineConfigSpec) error
- func Relocate(vm *object.VirtualMachine, spec types.VirtualMachineRelocateSpec, timeout int) error
- func ShutdownGuest(client *govmomi.Client, vm *object.VirtualMachine, timeout int) error
- func WaitForGuestNet(client *govmomi.Client, vm *object.VirtualMachine, timeout int) error
- type UUIDNotFoundError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Clone ¶
func Clone(c *govmomi.Client, src *object.VirtualMachine, f *object.Folder, name string, spec types.VirtualMachineCloneSpec, timeout int) (*object.VirtualMachine, error)
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 ¶
func Create(c *govmomi.Client, f *object.Folder, s types.VirtualMachineConfigSpec, p *object.ResourcePool, h *object.HostSystem) (*object.VirtualMachine, error)
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 FromPath ¶
func FromPath(client *govmomi.Client, path string, dc *object.Datacenter) (*object.VirtualMachine, error)
FromPath returns a VirtualMachine via its supplied path.
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 MoveToFolder ¶
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 ¶
func Reconfigure(vm *object.VirtualMachine, spec types.VirtualMachineConfigSpec) error
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 ¶
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 ¶
WaitForGuestNet waits for a virtual machine to have routeable 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 routeable - 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 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.