Documentation ¶
Overview ¶
Package tasks wraps the operation of VC. It will invoke the operation and wait until it's finished, and then return the execution result or error message.
Index ¶
- func IsConcurrentAccessError(err error) bool
- func IsInvalidArgumentError(err error) bool
- func IsMethodDisabledError(err error) bool
- func IsNotFoundError(err error) bool
- func IsRetryError(op trace.Operation, err error) bool
- func IsTransientError(op trace.Operation, err error) bool
- func Wait(ctx context.Context, f func(context.Context) (Task, error)) error
- func WaitForResult(ctx context.Context, f func(context.Context) (Task, error)) (*types.TaskInfo, error)
- func WaitForResultAndRetryIf(ctx context.Context, f func(context.Context) (Task, error), ...) (*types.TaskInfo, error)
- type Task
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsConcurrentAccessError ¶
IsConcurrentAccessError checks if a soap fault or vim fault is ConcurrentAccess error
func IsInvalidArgumentError ¶
IsInvalidArgumentError checks if a soap fault or vim fault is InvalidArgument error
func IsMethodDisabledError ¶
IsMethodDisabledError checks if a soap fault or vim fault is MethodDisabled error
func IsNotFoundError ¶
IsNotFoundError checks if a soap fault or vim fault is ManagementObjectNotFound error
func IsRetryError ¶
Add an additional retry error InvalidArgument This is added for potential race conditions concerning vSAN host partition Normally VM configuration is provided without user input. If there's InvalidArgument fault, it would more possibly be a system error. Details see: https://github.com/vmware/vic/pull/4597
func IsTransientError ¶
IsTransientError will return true for vSphere errors, which can be fixed by retry. Currently the error includes TaskInProgress, NetworkDisruptedAndConfigRolledBack, FailToLockFaultToleranceVMs, HostCommunication Retry on NetworkDisruptedAndConfigRolledBack is to workaround vSphere issue
func Wait ¶
Wait wraps govmomi operations and wait the operation to complete Sample usage:
info, err := Wait(ctx, func(ctx), (*object.Reference, *TaskInfo, error) { return vm, vm.Reconfigure(ctx, config) })
func WaitForResult ¶
func WaitForResult(ctx context.Context, f func(context.Context) (Task, error)) (*types.TaskInfo, error)
WaitForResult wraps govmomi operations and wait the operation to complete. Return the operation result Sample usage:
info, err := WaitForResult(ctx, func(ctx) (*TaskInfo, error) { return vm, vm.Reconfigure(ctx, config) })
func WaitForResultAndRetryIf ¶
func WaitForResultAndRetryIf(ctx context.Context, f func(context.Context) (Task, error), shouldRetry func(op trace.Operation, err error) bool) (*types.TaskInfo, error)
WaitForResultAndRetryIf wraps govmomi operations and wait the operation to complete, retrying under specified conditions. Return the operation result Sample usage:
info, err := WaitForResult(ctx, func(ctx) (*TaskInfo, error) { return vm, vm.Reconfigure(ctx, config) })