vsphere

package
v0.0.0-...-0391a7e Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2018 License: GPL-3.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Upload

func Upload(ctx context.Context, optflags *OptionsFlag, c *govmomi.Client) (*object.VirtualMachine, error)

Upload is a test function to push a new OVA to vCenter

func VMPassthrough

func VMPassthrough(ctx context.Context, host *object.HostSystem, vm *object.VirtualMachine, client *vim25.Client) error

VMPassthrough adds a Host PCI device to a VM.

Types

type Archive

type Archive interface {
	Open(string) (io.ReadCloser, int64, error)
}

Archive is an interface for DI of input types

type ArchiveFlag

type ArchiveFlag struct {
	Archive
}

ArchiveFlag doesn't register any flags; only encapsulates some common archive related functionality.

func (*ArchiveFlag) Process

func (f *ArchiveFlag) Process(ctx context.Context) error

Process comment

func (*ArchiveFlag) ReadEnvelope

func (f *ArchiveFlag) ReadEnvelope(fpath string) (*ovf.Envelope, error)

ReadEnvelope retrieves the metadata from the OVF

func (*ArchiveFlag) ReadOvf

func (f *ArchiveFlag) ReadOvf(fpath string) ([]byte, error)

ReadOvf retrieves ovf file data

func (*ArchiveFlag) Register

func (f *ArchiveFlag) Register(ctx context.Context, fs *flag.FlagSet)

Register comment

type Credentials

type Credentials struct {
	IP   string
	User string
	Pass string
}

Credentials holds the connections information

type FileArchive

type FileArchive struct {
	Path string
}

FileArchive is used for the normal OVF file loading

func (*FileArchive) Open

func (t *FileArchive) Open(name string) (io.ReadCloser, int64, error)

Open starts reading from the file

type FolderFlag

type FolderFlag struct {
	*flags.DatacenterFlag
	// contains filtered or unexported fields
}

FolderFlag represents folder object in vSphere for use as argument

func (*FolderFlag) Folder

func (flag *FolderFlag) Folder() (*object.Folder, error)

Folder checks if the requested folder exists

func (*FolderFlag) Process

func (flag *FolderFlag) Process(ctx context.Context) error

Process returns the datacenter item

func (*FolderFlag) Register

func (flag *FolderFlag) Register(ctx context.Context, f *flag.FlagSet)

Register shows usage info for this command

type Network

type Network struct {
	Name    string
	Network string
}

Network is a vSphere network object

type Options

type Options struct {
	AllDeploymentOptions []string `json:",omitempty"`
	Deployment           string

	AllDiskProvisioningOptions []string `json:",omitempty"`
	DiskProvisioning           string

	AllIPAllocationPolicyOptions []string `json:",omitempty"`
	IPAllocationPolicy           string

	AllIPProtocolOptions []string `json:",omitempty"`
	IPProtocol           string

	PropertyMapping []Property `json:",omitempty"`

	NetworkMapping []Network `json:",omitempty"`

	Annotation string `json:",omitempty"`

	PowerOn      bool
	InjectOvfEnv bool
	WaitForIP    bool
	Name         *string
}

Options object in vSphere OVF deployment for use as argument

type OptionsFlag

type OptionsFlag struct {
	Options Options
	Target  OptionsFlagTarget
	Path    string
}

OptionsFlag is the common parent struct for options

func (*OptionsFlag) ProcessOptionsFile

func (flag *OptionsFlag) ProcessOptionsFile(ctx context.Context, path string) error

ProcessOptionsFile opens the options file and converts JSON into an options datastructure

type OptionsFlagHost

type OptionsFlagHost struct {
	DatastoreName string

	FolderName string

	ResourcePoolName string
	// contains filtered or unexported fields
}

OptionsFlagHost carries the config for ESXi-based deployments

func (*OptionsFlagHost) Datacenter

func (flag *OptionsFlagHost) Datacenter() *object.Datacenter

Datacenter gets the datacenter object

func (*OptionsFlagHost) Datastore

func (flag *OptionsFlagHost) Datastore() *object.Datastore

Datastore gets the datastore object

func (*OptionsFlagHost) Folder

func (flag *OptionsFlagHost) Folder() *object.Folder

Folder get the Folder object

func (*OptionsFlagHost) HostSystem

func (flag *OptionsFlagHost) HostSystem() *object.HostSystem

HostSystem get the HostSystem object

func (*OptionsFlagHost) ResourcePool

func (flag *OptionsFlagHost) ResourcePool() *object.ResourcePool

ResourcePool get the resource pool object

func (*OptionsFlagHost) Validate

func (flag *OptionsFlagHost) Validate(ctx context.Context, client *vim25.Client) (bool, error)

Validate checks options

type OptionsFlagTarget

type OptionsFlagTarget interface {
	Validate(context.Context, *vim25.Client) (bool, error)
	Datastore() *object.Datastore
	ResourcePool() *object.ResourcePool
	HostSystem() *object.HostSystem
	Folder() *object.Folder
	Datacenter() *object.Datacenter
}

OptionsFlagTarget is common parent of ESXi and VC-based imports

type OptionsFlagVC

type OptionsFlagVC struct {
	DatastoreName string

	DatacenterName string

	ClusterName string

	HostName string

	FolderName string

	ResourcePoolName string
	// contains filtered or unexported fields
}

OptionsFlagVC carries the config for VC-based targets

func (*OptionsFlagVC) Datacenter

func (flag *OptionsFlagVC) Datacenter() *object.Datacenter

Datacenter gets the datacenter object

func (*OptionsFlagVC) Datastore

func (flag *OptionsFlagVC) Datastore() *object.Datastore

Datastore gets the datastore object

func (*OptionsFlagVC) Folder

func (flag *OptionsFlagVC) Folder() *object.Folder

Folder get the Folder object

func (*OptionsFlagVC) HostSystem

func (flag *OptionsFlagVC) HostSystem() *object.HostSystem

HostSystem get the HostSystem object

func (*OptionsFlagVC) ResourcePool

func (flag *OptionsFlagVC) ResourcePool() *object.ResourcePool

ResourcePool get the resource pool object

func (*OptionsFlagVC) Validate

func (flag *OptionsFlagVC) Validate(ctx context.Context, client *vim25.Client) (bool, error)

Validate checks options

type Property

type Property struct {
	types.KeyValue
	Spec *ovf.Property `json:",omitempty"`
}

Property is one of the OVF keys used to supply parameters to the new VM

type TapeArchive

type TapeArchive struct {
	Path string
}

TapeArchive used for OVA TAR files

func (*TapeArchive) Open

func (t *TapeArchive) Open(name string) (io.ReadCloser, int64, error)

Open retrieves files from within a tar file

type TapeArchiveEntry

type TapeArchiveEntry struct {
	io.Reader
	// contains filtered or unexported fields
}

TapeArchiveEntry used to handle OVA TAR files

func (*TapeArchiveEntry) Close

func (t *TapeArchiveEntry) Close() error

Close terminates the input stream

type Vcenter

type Vcenter struct {
	Credentials *Credentials //move this to a common package
	Insecure    bool
	Client      *govmomi.Client
	Context     context.Context
}

Vcenter is the main struct

func (*Vcenter) FindHostSystemByName

func (vc *Vcenter) FindHostSystemByName(hostname string) (*object.HostSystem, error)

FindHostSystemByName returns a HostSystem object

func (*Vcenter) Login

func (vc *Vcenter) Login() error

Login authenticates with vCenter if not already authenticated

func (*Vcenter) Logout

func (vc *Vcenter) Logout() error

Logout removes the session with vCenter

Jump to

Keyboard shortcuts

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