driver

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2020 License: MPL-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoSataController = errors.New("no available SATA controller")
)

Functions

func RemoveDatastorePrefix

func RemoveDatastorePrefix(path string) string

Cuts out the datastore prefix Example: "[datastore1] file.ext" --> "file.ext"

Types

type CloneConfig

type CloneConfig struct {
	Name           string
	Folder         string
	Cluster        string
	Host           string
	ResourcePool   string
	Datastore      string
	LinkedClone    bool
	Network        string
	Annotation     string
	VAppProperties map[string]string
}

type Cluster added in v1.6.1

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

type ConnectConfig

type ConnectConfig struct {
	VCenterServer      string
	Username           string
	Password           string
	InsecureConnection bool
	Datacenter         string
}

type CreateConfig

type CreateConfig struct {
	DiskControllerType []string // example: "scsi", "pvscsi", "lsilogic"

	Annotation    string
	Name          string
	Folder        string
	Cluster       string
	Host          string
	ResourcePool  string
	Datastore     string
	GuestOS       string // example: otherGuest
	NICs          []NIC
	USBController []string
	Version       uint // example: 10
	Storage       []Disk
}

type Datastore

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

func (*Datastore) Delete

func (ds *Datastore) Delete(path string) error

func (*Datastore) FileExists

func (ds *Datastore) FileExists(path string) bool

func (*Datastore) Info

func (ds *Datastore) Info(params ...string) (*mo.Datastore, error)

func (*Datastore) MakeDirectory

func (ds *Datastore) MakeDirectory(path string) error

func (*Datastore) Name

func (ds *Datastore) Name() string

func (*Datastore) ResolvePath

func (ds *Datastore) ResolvePath(path string) string

func (*Datastore) UploadFile

func (ds *Datastore) UploadFile(src, dst, host string, set_host_for_datastore_uploads bool) error

type DatastoreIsoPath added in v1.6.2

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

func (*DatastoreIsoPath) GetFilePath added in v1.6.2

func (d *DatastoreIsoPath) GetFilePath() string

func (*DatastoreIsoPath) Validate added in v1.6.2

func (d *DatastoreIsoPath) Validate() bool

type Disk added in v1.5.5

type Disk struct {
	DiskSize            int64
	DiskEagerlyScrub    bool
	DiskThinProvisioned bool
	ControllerIndex     int
}

type Driver

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

func NewDriver

func NewDriver(config *ConnectConfig) (*Driver, error)

func (*Driver) CreateVM

func (d *Driver) CreateVM(config *CreateConfig) (*VirtualMachine, error)

func (*Driver) FindCluster added in v1.6.1

func (d *Driver) FindCluster(name string) (*Cluster, error)

func (*Driver) FindContentLibraryByName added in v1.6.2

func (d *Driver) FindContentLibraryByName(name string) (*Library, error)

func (*Driver) FindContentLibraryFileDatastorePath added in v1.6.2

func (d *Driver) FindContentLibraryFileDatastorePath(isoPath string) (string, error)

func (*Driver) FindContentLibraryItem added in v1.6.2

func (d *Driver) FindContentLibraryItem(libraryId string, name string) (*library.Item, error)

func (*Driver) FindDatastore

func (d *Driver) FindDatastore(name string, host string) (*Datastore, error)

If name is an empty string, then resolve host's one

func (*Driver) FindFolder

func (d *Driver) FindFolder(name string) (*Folder, error)

func (*Driver) FindHost

func (d *Driver) FindHost(name string) (*Host, error)

func (*Driver) FindNetwork

func (d *Driver) FindNetwork(name string) (*Network, error)

func (*Driver) FindNetworks added in v1.6.1

func (d *Driver) FindNetworks(name string) ([]*Network, error)

func (*Driver) FindResourcePool

func (d *Driver) FindResourcePool(cluster string, host string, name string) (*ResourcePool, error)

func (*Driver) FindVM

func (d *Driver) FindVM(name string) (*VirtualMachine, error)

func (*Driver) GetDatastoreFilePath added in v1.6.2

func (d *Driver) GetDatastoreFilePath(datastoreID, dir, filename string) (string, error)

The file ID isn't available via the API, so we use DatastoreBrowser to search

func (*Driver) GetDatastoreName added in v1.6.2

func (d *Driver) GetDatastoreName(id string) (string, error)

func (*Driver) NewDatastore

func (d *Driver) NewDatastore(ref *types.ManagedObjectReference) *Datastore

func (*Driver) NewFolder

func (d *Driver) NewFolder(ref *types.ManagedObjectReference) *Folder

func (*Driver) NewHost

func (d *Driver) NewHost(ref *types.ManagedObjectReference) *Host

func (*Driver) NewNetwork

func (d *Driver) NewNetwork(ref *types.ManagedObjectReference) *Network

func (*Driver) NewResourcePool

func (d *Driver) NewResourcePool(ref *types.ManagedObjectReference) *ResourcePool

func (*Driver) NewVM

func (*Driver) PreCleanVM added in v1.5.6

func (d *Driver) PreCleanVM(ui packer.Ui, vmPath string, force bool) error

type Folder

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

func (*Folder) Info

func (f *Folder) Info(params ...string) (*mo.Folder, error)

func (*Folder) Path

func (f *Folder) Path() (string, error)

type HardwareConfig

type HardwareConfig struct {
	CPUs                int32
	CpuCores            int32
	CPUReservation      int64
	CPULimit            int64
	RAM                 int64
	RAMReservation      int64
	RAMReserveAll       bool
	NestedHV            bool
	CpuHotAddEnabled    bool
	MemoryHotAddEnabled bool
	VideoRAM            int64
	VGPUProfile         string
	Firmware            string
	ForceBIOSSetup      bool
}

type Host

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

func (*Host) Info

func (h *Host) Info(params ...string) (*mo.HostSystem, error)

type KeyInput

type KeyInput struct {
	Scancode key.Code
	Alt      bool
	Ctrl     bool
	Shift    bool
}

type Library added in v1.6.1

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

type LibraryFilePath added in v1.6.2

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

func (*LibraryFilePath) GetFileName added in v1.6.2

func (l *LibraryFilePath) GetFileName() string

func (*LibraryFilePath) GetLibraryItemName added in v1.6.2

func (l *LibraryFilePath) GetLibraryItemName() string

func (*LibraryFilePath) GetLibraryName added in v1.6.2

func (l *LibraryFilePath) GetLibraryName() string

func (*LibraryFilePath) Validate added in v1.6.2

func (l *LibraryFilePath) Validate() error

type MultipleNetworkFoundError added in v1.6.1

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

func (*MultipleNetworkFoundError) Error added in v1.6.1

func (e *MultipleNetworkFoundError) Error() string

type NIC added in v1.5.3

type NIC struct {
	Network     string // "" for default network
	NetworkCard string // example: vmxnet3
	MacAddress  string // set mac if want specific address
	Passthrough *bool  // direct path i/o
}

type Network

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

func (*Network) Info

func (n *Network) Info(params ...string) (*mo.Network, error)

type ResourcePool

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

func (*ResourcePool) Info

func (p *ResourcePool) Info(params ...string) (*mo.ResourcePool, error)

func (*ResourcePool) Path

func (p *ResourcePool) Path() (string, error)

type RestClient added in v1.6.2

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

The rest.Client requires vCenter. RestClient is to modularize the rest.Client session and use it only when is necessary. This will allow users without vCenter to use the other features that doesn't use the rest.Client. To use the client login/logout must be done to create an authenticated session.

func (*RestClient) Login added in v1.6.2

func (r *RestClient) Login(ctx context.Context) error

func (*RestClient) Logout added in v1.6.2

func (r *RestClient) Logout(ctx context.Context) error

type VirtualMachine

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

func (*VirtualMachine) AddCdrom

func (vm *VirtualMachine) AddCdrom(controllerType string, datastoreIsoPath string) error

func (*VirtualMachine) AddConfigParams

func (vm *VirtualMachine) AddConfigParams(params map[string]string, info *types.ToolsConfigInfo) error

func (*VirtualMachine) AddFloppy

func (vm *VirtualMachine) AddFloppy(imgPath string) error

func (*VirtualMachine) AddPublicKeys added in v1.6.1

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

func (*VirtualMachine) AddSATAController

func (vm *VirtualMachine) AddSATAController() error

func (*VirtualMachine) Clone

func (vm *VirtualMachine) Clone(ctx context.Context, config *CloneConfig) (*VirtualMachine, error)

func (*VirtualMachine) Configure

func (vm *VirtualMachine) Configure(config *HardwareConfig) error

func (*VirtualMachine) ConvertToTemplate

func (vm *VirtualMachine) ConvertToTemplate() error

func (*VirtualMachine) CreateCdrom

func (*VirtualMachine) CreateDescriptor added in v1.5.5

func (*VirtualMachine) CreateSnapshot

func (vm *VirtualMachine) CreateSnapshot(name string) error

func (*VirtualMachine) Customize added in v1.6.2

func (vm *VirtualMachine) Customize(spec types.CustomizationSpec) error

func (*VirtualMachine) Destroy

func (vm *VirtualMachine) Destroy() error

func (*VirtualMachine) Devices

func (vm *VirtualMachine) Devices() (object.VirtualDeviceList, error)

func (*VirtualMachine) EjectCdroms

func (vm *VirtualMachine) EjectCdroms() error

func (*VirtualMachine) Export added in v1.5.5

func (vm *VirtualMachine) Export() (*nfc.Lease, error)

func (*VirtualMachine) FindSATAController

func (vm *VirtualMachine) FindSATAController() (*types.VirtualAHCIController, error)

func (*VirtualMachine) GetDir

func (vm *VirtualMachine) GetDir() (string, error)

func (*VirtualMachine) GetOvfExportOptions added in v1.5.5

func (vm *VirtualMachine) GetOvfExportOptions(m *ovf.Manager) ([]types.OvfOptionInfo, error)

func (*VirtualMachine) ImportOvfToContentLibrary added in v1.6.2

func (vm *VirtualMachine) ImportOvfToContentLibrary(ovf vcenter.OVF) error

func (*VirtualMachine) ImportToContentLibrary added in v1.6.1

func (vm *VirtualMachine) ImportToContentLibrary(template vcenter.Template) error

func (*VirtualMachine) Info

func (vm *VirtualMachine) Info(params ...string) (*mo.VirtualMachine, error)

func (*VirtualMachine) IsPoweredOff added in v1.5.6

func (vm *VirtualMachine) IsPoweredOff() (bool, error)

func (*VirtualMachine) NewOvfManager added in v1.5.5

func (vm *VirtualMachine) NewOvfManager() *ovf.Manager

func (*VirtualMachine) PowerOff

func (vm *VirtualMachine) PowerOff() error

func (*VirtualMachine) PowerOn

func (vm *VirtualMachine) PowerOn() error

func (*VirtualMachine) Properties added in v1.6.1

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

func (*VirtualMachine) RemoveCdroms added in v1.5.3

func (vm *VirtualMachine) RemoveCdroms() error

func (*VirtualMachine) RemoveDevice

func (vm *VirtualMachine) RemoveDevice(keepFiles bool, device ...types.BaseVirtualDevice) error

func (*VirtualMachine) ResizeDisk

func (vm *VirtualMachine) ResizeDisk(diskSize int64) error

func (*VirtualMachine) SetBootOrder

func (vm *VirtualMachine) SetBootOrder(order []string) error

func (*VirtualMachine) StartShutdown

func (vm *VirtualMachine) StartShutdown() error

func (*VirtualMachine) TypeOnKeyboard

func (vm *VirtualMachine) TypeOnKeyboard(input KeyInput) (int32, error)

func (*VirtualMachine) WaitForIP

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

func (*VirtualMachine) WaitForShutdown

func (vm *VirtualMachine) WaitForShutdown(ctx context.Context, timeout time.Duration) error

Jump to

Keyboard shortcuts

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