vcenter

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2022 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewVMNotFoundError

func NewVMNotFoundError(name string) error

Types

type AdapterNotFoundError

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

func NewAdapterNotFoundError

func NewAdapterNotFoundError(vmName, networkName string) *AdapterNotFoundError

func (*AdapterNotFoundError) Error

func (e *AdapterNotFoundError) Error() string

type AdapterUpdater

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

func NewAdapterUpdater

func NewAdapterUpdater(finder *Finder) *AdapterUpdater

func (*AdapterUpdater) TargetNewNetwork

func (a *AdapterUpdater) TargetNewNetwork(ctx context.Context, adapter *anyAdapter, targetNetName string) (*anyAdapter, error)

type Client

type Client struct {
	Host     string
	Username string
	Password string
	Insecure bool
	DryRun   bool
	// contains filtered or unexported fields
}

func New

func New(host, username, password string, insecure bool) *Client

func NewFromGovmomiClient

func NewFromGovmomiClient(client *govmomi.Client) *Client

func (*Client) FindVM

func (c *Client) FindVM(ctx context.Context, datacenter, cluster, vmName string) (*VM, error)

func (*Client) HostName

func (c *Client) HostName() string

func (*Client) Logout

func (c *Client) Logout(ctx context.Context)

func (*Client) URL

func (c *Client) URL() *url.URL

type Disk added in v0.2.0

type Disk struct {
	ID        int32
	Datastore string
}

type Finder

type Finder struct {
	Datacenter string
	// contains filtered or unexported fields
}

func NewFinder

func NewFinder(datacenter string, client *govmomi.Client) *Finder

func (*Finder) Adapter

func (f *Finder) Adapter(ctx context.Context, vmName, networkName string) (*anyAdapter, error)

func (*Finder) AdapterBackingInfo

func (f *Finder) AdapterBackingInfo(ctx context.Context, networkName string) (types.BaseVirtualDeviceBackingInfo, error)

func (*Finder) Datastore

func (f *Finder) Datastore(ctx context.Context, datastoreName string) (*object.Datastore, error)

func (*Finder) DatastoreRef

func (f *Finder) DatastoreRef(ctx context.Context, datastoreName string) (*types.ManagedObjectReference, error)

func (*Finder) Disks added in v0.2.0

func (f *Finder) Disks(ctx context.Context, vm *object.VirtualMachine) ([]Disk, error)

func (*Finder) HostsInCluster

func (f *Finder) HostsInCluster(ctx context.Context, clusterName string) ([]*object.HostSystem, error)

func (*Finder) Networks

func (f *Finder) Networks(ctx context.Context, vm *object.VirtualMachine) ([]string, error)

func (*Finder) ResourcePool

func (f *Finder) ResourcePool(ctx context.Context, fullyQualifiedResourcePoolName string) (*object.ResourcePool, error)

func (*Finder) ResourcePoolFromSpec

func (f *Finder) ResourcePoolFromSpec(ctx context.Context, spec TargetSpec) (*object.ResourcePool, error)

func (*Finder) ResourcePoolFromSpecRef

func (f *Finder) ResourcePoolFromSpecRef(ctx context.Context, spec TargetSpec) (*types.ManagedObjectReference, error)

func (*Finder) VirtualMachine

func (f *Finder) VirtualMachine(ctx context.Context, vmName string) (*object.VirtualMachine, error)

type HostPool

type HostPool struct {
	Datacenter string

	MaxLeasePerHost             int
	LeaseWaitTimeoutInMinutes   int
	LeaseCheckIntervalInSeconds int
	// contains filtered or unexported fields
}

func NewHostPool

func NewHostPool(client *Client, datacenter string) *HostPool

func (*HostPool) Initialize

func (hp *HostPool) Initialize(ctx context.Context) error

func (*HostPool) LeaseAvailableHost

func (hp *HostPool) LeaseAvailableHost(ctx context.Context, clusterName string) (*object.HostSystem, error)

LeaseAvailableHost returns the best host system to copy a VM to If no hosts are currently available a nil host will be returned, the caller should wait and retry later Release should be called by the caller when done with the host

func (*HostPool) Release

func (hp *HostPool) Release(ctx context.Context, host *object.HostSystem)

Release releases the specified host back into the pool and makes it available for lease again

func (*HostPool) WaitForLeaseAvailableHost

func (hp *HostPool) WaitForLeaseAvailableHost(ctx context.Context, clusterName string) (*object.HostSystem, error)

WaitForLeaseAvailableHost returns the best host system to copy a VM to If no hosts are currently available this func will block until one is available or configured timeout Release should be called by the caller when done with the host

type ISOEjector

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

func NewISOEjector

func NewISOEjector(vm *object.VirtualMachine) *ISOEjector

func (*ISOEjector) EjectISO

func (e *ISOEjector) EjectISO(ctx context.Context) error

type ProgressLogger

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

func NewProgressLogger

func NewProgressLogger(updatableStdout *log.UpdatableStdout) *ProgressLogger

func (*ProgressLogger) NewProgressSink

func (p *ProgressLogger) NewProgressSink(taskName string) *ProgressSink

func (*ProgressLogger) SinkDone

func (p *ProgressLogger) SinkDone()

type ProgressSink

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

func (*ProgressSink) Sink

func (p *ProgressSink) Sink() chan<- progress.Report

type RelocateSpec

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

func NewRelocateSpec

func NewRelocateSpec(sourceClient *Client, destinationClient *Client) *RelocateSpec

func (*RelocateSpec) Build

func (*RelocateSpec) WithSourceVM

func (rs *RelocateSpec) WithSourceVM(vm *VM) *RelocateSpec

func (*RelocateSpec) WithTargetHost

func (rs *RelocateSpec) WithTargetHost(host *object.HostSystem) *RelocateSpec

func (*RelocateSpec) WithTargetSpec

func (rs *RelocateSpec) WithTargetSpec(vmTargetSpec *TargetSpec) *RelocateSpec

type TargetSpec

type TargetSpec struct {
	Name         string
	Datacenter   string
	Cluster      string
	ResourcePool string
	Datastores   map[string]string
	Networks     map[string]string
}

func (TargetSpec) FullyQualifiedResourcePool

func (t TargetSpec) FullyQualifiedResourcePool() string

FullyQualifiedResourcePool ensures we avoid "multiple found" errors

type VM

type VM struct {
	Name         string
	Datacenter   string
	Cluster      string
	ResourcePool string
	Disks        []Disk
	Networks     []string
}

type VMNotFoundError

type VMNotFoundError struct {
	Name string
}

func (*VMNotFoundError) Error

func (e *VMNotFoundError) Error() string

type VMRelocator

type VMRelocator struct {
	DryRun bool
	// contains filtered or unexported fields
}

func NewVMRelocator

func NewVMRelocator(sourceClient *Client, destinationClient *Client, destinationHostPool *HostPool, updatableStdout *log.UpdatableStdout) *VMRelocator

func (*VMRelocator) RelocateVM

func (r *VMRelocator) RelocateVM(ctx context.Context, srcVM *VM, vmTargetSpec *TargetSpec) error

func (*VMRelocator) WithDryRun

func (r *VMRelocator) WithDryRun(dryRun bool) *VMRelocator

Jump to

Keyboard shortcuts

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