vsphere

package
v1.31.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewVSphereProviderConfiguration

func NewVSphereProviderConfiguration(fileName string) (providers.ProviderConfiguration, error)

Types

type Client

type Client struct {
	Client *govmomi.Client
}

Client Client wrapper

func (*Client) Datacenter

func (c *Client) Datacenter(ref types.ManagedObjectReference) *object.Datacenter

Datacenter return a Datacenter

func (*Client) Datastore

func (c *Client) Datastore(ref types.ManagedObjectReference) *object.Datastore

Datastore create govmomi Datastore object

func (*Client) GetClient

func (c *Client) GetClient() *govmomi.Client

GetClient return client

func (*Client) GetDatacenter

func (c *Client) GetDatacenter(ctx *context.Context, name string) (*Datacenter, error)

GetDatacenter return the datacenter

func (*Client) VimClient

func (c *Client) VimClient() *vim25.Client

VimClient return vim25 client

func (*Client) VirtualMachine

func (c *Client) VirtualMachine(ref types.ManagedObjectReference) *object.VirtualMachine

VirtualMachine map govmomi VirtualMachine

type Configuration

type Configuration struct {
	URL               string            `json:"url"`
	UserName          string            `json:"uid"`
	Password          string            `json:"password"`
	Insecure          bool              `json:"insecure"`
	DataCenter        string            `json:"dc"`
	DataStore         string            `json:"datastore"`
	Resource          string            `json:"resource-pool"`
	VMBasePath        string            `json:"vmFolder"`
	Timeout           time.Duration     `json:"timeout"`
	Annotation        string            `json:"annotation"`
	TemplateName      string            `json:"template-name"`
	Template          bool              `json:"template"`
	LinkedClone       bool              `json:"linked"`
	Customization     string            `json:"customization"`
	Network           providers.Network `json:"network"`
	AvailableGPUTypes map[string]string `json:"gpu-types"`
	VMWareRegion      string            `json:"region"`
	VMWareZone        string            `json:"zone"`
	UseBind9          bool              `json:"use-bind9"`
	Bind9Host         string            `json:"bind9-host"`
	RndcKeyFile       string            `json:"rndc-key-file"`
	StartDelay        int               `json:"start-delay"`
	StopDelay         int               `json:"stop-delay"`
}

Configuration declares vsphere connection info

type CreateInput

type CreateInput struct {
	*providers.InstanceCreateInput
	NodeName        string
	NodeIndex       int
	ExpandHardDrive bool
	Annotation      string
	VSphereNetwork  *vsphereNetwork
}

type CreateVirtualMachineInput

type CreateVirtualMachineInput struct {
	*CreateInput
	Customization string
	TemplateName  string
	VMFolder      string
	ResourceName  string
	Template      bool
	LinkedClone   bool
}

type Datacenter

type Datacenter struct {
	Ref    types.ManagedObjectReference
	Name   string
	Client *Client
}

Datacenter represent a datacenter

func (*Datacenter) Datacenter

func (dc *Datacenter) Datacenter(ctx *context.Context) *object.Datacenter

Datacenter return a Datacenter

func (*Datacenter) GetDatastore

func (dc *Datacenter) GetDatastore(ctx *context.Context, name string) (*Datastore, error)

GetDatastore retrieve named datastore

func (*Datacenter) GetHostAutoStartManager

func (dc *Datacenter) GetHostAutoStartManager(ctx *context.Context, esxi string) (*HostAutoStartManager, error)

GetHostAutoStartManager return the HostAutoStartManager

func (*Datacenter) GetHostSystem

func (dc *Datacenter) GetHostSystem(ctx *context.Context, esxi string) (*object.HostSystem, error)

GetHostSystem return the default hostsystem

func (*Datacenter) NewFinder

func (dc *Datacenter) NewFinder(ctx *context.Context) *find.Finder

NewFinder create a finder

func (*Datacenter) VimClient

func (dc *Datacenter) VimClient() *vim25.Client

VimClient return the VIM25 client

type Datastore

type Datastore struct {
	Ref        types.ManagedObjectReference
	Name       string
	Datacenter *Datacenter
}

Datastore datastore wrapper

func (*Datastore) CreateVirtualMachine

func (ds *Datastore) CreateVirtualMachine(ctx *context.Context, input *CreateVirtualMachineInput) (*VirtualMachine, error)

CreateVirtualMachine create a new virtual machine

func (*Datastore) Datastore

func (ds *Datastore) Datastore(ctx *context.Context) *object.Datastore

Datastore create govmomi Datastore object

func (*Datastore) List

func (ds *Datastore) List(ctx *context.Context) ([]*VirtualMachine, error)

List list VM inside the datastore

func (*Datastore) ListPath

ListPath return object list matching path

func (*Datastore) VimClient

func (ds *Datastore) VimClient() *vim25.Client

VimClient return the VIM25 client

func (*Datastore) VirtualMachine

func (ds *Datastore) VirtualMachine(ctx *context.Context, name string) (*VirtualMachine, error)

VirtualMachine retrieve the specified virtual machine

type HostAutoStartManager

type HostAutoStartManager struct {
	mo.HostAutoStartManager
	Datacenter *Datacenter
}

func (*HostAutoStartManager) NextStartOrder added in v1.30.0

func (h *HostAutoStartManager) NextStartOrder() (result int)

func (*HostAutoStartManager) SetAutoStart

func (h *HostAutoStartManager) SetAutoStart(ctx *context.Context, datastore, name string, startOrder, startDelay, stopDelay int) error

type Status

type Status struct {
	Interfaces []providers.NetworkInterface
	Powered    bool
}

Status shortened vm status

type VirtualMachine

type VirtualMachine struct {
	Ref       types.ManagedObjectReference
	Name      string
	Datastore *Datastore
}

VirtualMachine virtual machine wrapper

func (*VirtualMachine) Configure

func (vm *VirtualMachine) Configure(ctx *context.Context, input *CreateInput) error

Configure set characteristic of VM a virtual machine

func (*VirtualMachine) Delete

func (vm *VirtualMachine) Delete(ctx *context.Context) error

Delete delete the virtual machine

func (*VirtualMachine) HostSystem

func (vm *VirtualMachine) HostSystem(ctx *context.Context) (string, error)

func (VirtualMachine) IsSimulatorRunning

func (vm VirtualMachine) IsSimulatorRunning(ctx *context.Context) bool

IsSimulatorRunning returns true if VMware Tools is currently running in the guest OS, and false otherwise.

func (VirtualMachine) IsToolsRunning

func (vm VirtualMachine) IsToolsRunning(ctx *context.Context) (bool, error)

IsToolsRunning returns true if VMware Tools is currently running in the guest OS, and false otherwise.

func (*VirtualMachine) ListAddresses

func (vm *VirtualMachine) ListAddresses(ctx *context.Context) ([]providers.NetworkInterface, error)

func (*VirtualMachine) PowerOff

func (vm *VirtualMachine) PowerOff(ctx *context.Context) error

PowerOff power off a virtual machine

func (*VirtualMachine) PowerOn

func (vm *VirtualMachine) PowerOn(ctx *context.Context) error

PowerOn power on a virtual machine

func (*VirtualMachine) Reconfigure

func (vm *VirtualMachine) Reconfigure(ctx *context.Context, virtualMachine *object.VirtualMachine, config types.VirtualMachineConfigSpec) error

func (*VirtualMachine) SetGuestInfo

func (vm *VirtualMachine) SetGuestInfo(ctx *context.Context, input *CreateInput) ([]types.BaseOptionValue, error)

SetGuestInfo change guest ingos

func (*VirtualMachine) ShutdownGuest

func (vm *VirtualMachine) ShutdownGuest(ctx *context.Context) error

ShutdownGuest power off a virtual machine

func (*VirtualMachine) Status

func (vm *VirtualMachine) Status(ctx *context.Context) (*Status, error)

Status refresh status virtual machine

func (*VirtualMachine) UUID

func (vm *VirtualMachine) UUID(ctx *context.Context) string

func (*VirtualMachine) VimClient

func (vm *VirtualMachine) VimClient() *vim25.Client

VimClient return the VIM25 client

func (*VirtualMachine) VirtualMachine

func (vm *VirtualMachine) VirtualMachine(ctx *context.Context) *object.VirtualMachine

VirtualMachine return govmomi virtual machine

func (*VirtualMachine) WaitForIP

func (vm *VirtualMachine) WaitForIP(ctx *context.Context) (string, error)

WaitForIP wait ip

func (*VirtualMachine) WaitForPowered

func (vm *VirtualMachine) WaitForPowered(ctx *context.Context) error

WaitForToolsRunning wait vmware tool starts

func (*VirtualMachine) WaitForToolsRunning

func (vm *VirtualMachine) WaitForToolsRunning(ctx *context.Context) (bool, error)

WaitForToolsRunning wait vmware tool starts

type VmStatus

type VmStatus struct {
	Status
	// contains filtered or unexported fields
}

func (*VmStatus) Address

func (status *VmStatus) Address() string

func (*VmStatus) Powered

func (status *VmStatus) Powered() bool

Jump to

Keyboard shortcuts

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