Documentation
¶
Overview ¶
These functions are compatible with WS 9 and 10 on *NIX
These functions are compatible with WS 9 and 10 on *NIX
Index ¶
- Constants
- Variables
- func CheckOvfToolVersion(ovftoolPath string) error
- func CommHost(config *SSHConfig) func(multistep.StateBag) (string, error)
- func EncodeVMX(contents map[string]string) string
- func GetOvfTool() string
- func MockInterface() net.Interface
- func NetworkingParserByCommand(command string) *func([]string) (*networkingCommandEntry, error)
- func NewArtifact(remoteType string, format string, exportOutputPath string, vmName string, ...) (packersdk.Artifact, error)
- func ParseVMX(contents string) map[string]string
- func ReadAppleDhcpdLeaseEntries(fd *os.File) ([]appleDhcpLeaseEntry, error)
- func ReadDhcpdLeaseEntries(fd *os.File) ([]dhcpLeaseEntry, error)
- func ReadVMX(path string) (map[string]string, error)
- func VNCPassword(skipPassword bool) string
- func WriteVMX(path string, data map[string]string) (err error)
- type DhcpConfiguration
- type DiskAndCDConfigData
- type DiskConfig
- type Driver
- func NewDriver(dconfig *DriverConfig, config *SSHConfig, vmName string) (Driver, error)
- func NewESX5Driver(dconfig *DriverConfig, config *SSHConfig, vmName string) (Driver, error)
- func NewFusion5Driver(dconfig *DriverConfig, config *SSHConfig) Driver
- func NewFusion6Driver(dconfig *DriverConfig, config *SSHConfig) Driver
- func NewPlayer5Driver(config *SSHConfig) Driver
- func NewPlayer6Driver(config *SSHConfig) Driver
- func NewWorkstation10Driver(config *SSHConfig) Driver
- func NewWorkstation9Driver(config *SSHConfig) Driver
- type DriverConfig
- type DriverMock
- func (d *DriverMock) Clone(dst string, src string, linked bool, snapshot string) error
- func (d *DriverMock) CommHost(state multistep.StateBag) (string, error)
- func (d *DriverMock) CompactDisk(path string) error
- func (d *DriverMock) CreateDisk(output string, size string, adapterType string, typeId string) error
- func (d *DriverMock) CreateSnapshot(vmxPath string, snapshotName string) error
- func (d *DriverMock) DhcpConfPath(device string) string
- func (d *DriverMock) DhcpLeasesPath(device string) string
- func (d *DriverMock) Export(args []string) error
- func (d *DriverMock) GetVmwareDriver() VmwareDriver
- func (d *DriverMock) GuestAddress(state multistep.StateBag) (string, error)
- func (d *DriverMock) HostAddress(state multistep.StateBag) (string, error)
- func (d *DriverMock) HostIP(state multistep.StateBag) (string, error)
- func (d *DriverMock) IsRunning(path string) (bool, error)
- func (d *DriverMock) NetmapConfPath() string
- func (d *DriverMock) PotentialGuestIP(state multistep.StateBag) ([]string, error)
- func (d *DriverMock) Start(path string, headless bool) error
- func (d *DriverMock) Stop(path string) error
- func (d *DriverMock) SuppressMessages(path string) error
- func (d *DriverMock) ToolsInstall() error
- func (d *DriverMock) ToolsIsoPath(flavor string) string
- func (d *DriverMock) Verify() error
- func (d *DriverMock) VerifyOvfTool(_ bool, _ bool) error
- func (d *DriverMock) VmnetnatConfPath(device string) string
- type ESX5Driver
- func (d *ESX5Driver) AcquireVNCOverWebsocketTicket() (*types.VirtualMachineTicket, error)
- func (d *ESX5Driver) CachePath(path string) string
- func (d *ESX5Driver) Clone(dst, src string, linked bool, snapshot string) error
- func (d *ESX5Driver) CommHost(state multistep.StateBag) (string, error)
- func (d *ESX5Driver) CompactDisk(diskPathLocal string) error
- func (d *ESX5Driver) CreateDisk(diskPathLocal string, size string, adapter_type string, typeId string) error
- func (d *ESX5Driver) CreateSnapshot(vmxPath string, snapshotName string) error
- func (d *ESX5Driver) Destroy() error
- func (d *ESX5Driver) DirExists() (bool, error)
- func (d *ESX5Driver) Download(src, dst string) error
- func (d *ESX5Driver) Export(args []string) error
- func (d *ESX5Driver) GetVmwareDriver() VmwareDriver
- func (d *ESX5Driver) GuestAddress(multistep.StateBag) (string, error)
- func (d *ESX5Driver) HostAddress(multistep.StateBag) (string, error)
- func (d *ESX5Driver) HostIP(multistep.StateBag) (string, error)
- func (d *ESX5Driver) IsDestroyed() (bool, error)
- func (d *ESX5Driver) IsRunning(string) (bool, error)
- func (d *ESX5Driver) ListFiles() ([]string, error)
- func (d *ESX5Driver) MkdirAll() error
- func (d *ESX5Driver) PotentialGuestIP(multistep.StateBag) ([]string, error)
- func (d *ESX5Driver) Register(vmxPathLocal string) error
- func (d *ESX5Driver) ReloadVM() error
- func (d *ESX5Driver) Remove(path string) error
- func (d *ESX5Driver) RemoveAll() error
- func (d *ESX5Driver) RemoveCache(localPath string) error
- func (d *ESX5Driver) SetOutputDir(path string)
- func (d *ESX5Driver) Start(vmxPathLocal string, headless bool) error
- func (d *ESX5Driver) Stop(vmxPathLocal string) error
- func (d *ESX5Driver) String() string
- func (d *ESX5Driver) SuppressMessages(vmxPath string) error
- func (d *ESX5Driver) ToolsInstall() error
- func (d *ESX5Driver) ToolsIsoPath(string) string
- func (d *ESX5Driver) Unregister(vmxPathLocal string) error
- func (ESX5Driver) UpdateVMX(_, password string, port int, data map[string]string)
- func (d *ESX5Driver) UploadISO(localPath string, checksum string, ui packersdk.Ui) (string, error)
- func (d *ESX5Driver) VNCAddress(ctx context.Context, _ string, portMin, portMax int) (string, int, error)
- func (d *ESX5Driver) Verify() error
- func (d *ESX5Driver) VerifyChecksum(hash string, file string) bool
- func (d *ESX5Driver) VerifyOvfTool(SkipExport, skipValidateCredentials bool) error
- type ExportConfig
- type Fusion5Driver
- func (d *Fusion5Driver) Clone(dst, src string, linked bool, snapshot string) error
- func (d *Fusion5Driver) CommHost(state multistep.StateBag) (string, error)
- func (d *Fusion5Driver) CompactDisk(diskPath string) error
- func (d *Fusion5Driver) CreateDisk(output string, size string, adapter_type string, type_id string) error
- func (d *Fusion5Driver) CreateSnapshot(vmxPath string, snapshotName string) error
- func (d *Fusion5Driver) GetVmwareDriver() VmwareDriver
- func (d *Fusion5Driver) IsRunning(vmxPath string) (bool, error)
- func (d *Fusion5Driver) Start(vmxPath string, headless bool) error
- func (d *Fusion5Driver) Stop(vmxPath string) error
- func (d *Fusion5Driver) SuppressMessages(vmxPath string) error
- func (d *Fusion5Driver) ToolsInstall() error
- func (d *Fusion5Driver) ToolsIsoPath(k string) string
- func (d *Fusion5Driver) Verify() error
- type Fusion6Driver
- type HWConfig
- type IfconfigIPFinder
- type LocalOutputDir
- func (d *LocalOutputDir) DirExists() (bool, error)
- func (d *LocalOutputDir) ListFiles() ([]string, error)
- func (d *LocalOutputDir) MkdirAll() error
- func (d *LocalOutputDir) Remove(path string) error
- func (d *LocalOutputDir) RemoveAll() error
- func (d *LocalOutputDir) SetOutputDir(path string)
- func (d *LocalOutputDir) String() string
- type NetmapConfig
- type NetworkMap
- type NetworkMapperMock
- type NetworkNameMapper
- type NetworkingConfig
- type NetworkingType
- type OutputConfig
- type OutputDir
- type ParallelPortAuto
- type ParallelPortDevice
- type ParallelPortFile
- type ParallelUnion
- type Player5Driver
- func (d *Player5Driver) Clone(dst, src string, linked bool, snapshot string) error
- func (d *Player5Driver) CommHost(state multistep.StateBag) (string, error)
- func (d *Player5Driver) CompactDisk(diskPath string) error
- func (d *Player5Driver) CreateDisk(output string, size string, adapter_type string, type_id string) error
- func (d *Player5Driver) CreateSnapshot(vmxPath string, snapshotName string) error
- func (d *Player5Driver) GetVmwareDriver() VmwareDriver
- func (d *Player5Driver) IsRunning(vmxPath string) (bool, error)
- func (d *Player5Driver) Start(vmxPath string, headless bool) error
- func (d *Player5Driver) Stop(vmxPath string) error
- func (d *Player5Driver) SuppressMessages(vmxPath string) error
- func (d *Player5Driver) ToolsInstall() error
- func (d *Player5Driver) ToolsIsoPath(flavor string) string
- func (d *Player5Driver) Verify() error
- type Player6Driver
- type RemoteDriver
- type RemoteDriverMock
- func (d *RemoteDriverMock) Destroy() error
- func (d *RemoteDriverMock) DirExists() (bool, error)
- func (d *RemoteDriverMock) Download(src, dst string) error
- func (d *RemoteDriverMock) IsDestroyed() (bool, error)
- func (d *RemoteDriverMock) ListFiles() ([]string, error)
- func (d *RemoteDriverMock) MkdirAll() error
- func (d *RemoteDriverMock) Register(path string) error
- func (d *RemoteDriverMock) ReloadVM() error
- func (d *RemoteDriverMock) Remove(string) error
- func (d *RemoteDriverMock) RemoveAll() error
- func (d *RemoteDriverMock) RemoveCache(localPath string) error
- func (d *RemoteDriverMock) SetOutputDir(s string)
- func (d *RemoteDriverMock) String() string
- func (d *RemoteDriverMock) Unregister(path string) error
- func (d *RemoteDriverMock) UploadISO(path string, checksum string, ui packersdk.Ui) (string, error)
- type RunConfig
- type SSHConfig
- type SerialConfigAuto
- type SerialConfigDevice
- type SerialConfigFile
- type SerialConfigPipe
- type SerialUnion
- type StepCleanFiles
- type StepCleanVMX
- type StepCompactDisk
- type StepConfigureVMX
- type StepConfigureVNC
- func (s *StepConfigureVNC) Cleanup(multistep.StateBag)
- func (s *StepConfigureVNC) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
- func (*StepConfigureVNC) UpdateVMX(address, password string, port int, data map[string]string)
- func (s *StepConfigureVNC) VNCAddress(ctx context.Context, vncBindAddress string, portMin, portMax int) (string, int, error)
- type StepCreateDisks
- type StepCreateSnapshot
- type StepExport
- type StepHTTPIPDiscover
- type StepOutputDir
- type StepPrepareTools
- type StepRegister
- type StepRemoteUpload
- type StepRun
- type StepShutdown
- type StepSuppressMessages
- type StepUploadTools
- type StepUploadVMX
- type StepVNCBootCommand
- type StepVNCConnect
- func (s *StepVNCConnect) Cleanup(multistep.StateBag)
- func (s *StepVNCConnect) ConnectVNC(state multistep.StateBag) (*vnc.ClientConn, error)
- func (s *StepVNCConnect) ConnectVNCOverWebsocketClient(state multistep.StateBag) (*vnc.ClientConn, error)
- func (s *StepVNCConnect) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
- type ToolsConfig
- type VMXConfig
- type VNCAddressFinder
- type VNCBootCommandTemplateData
- type VmwareDriver
- func (d *VmwareDriver) Export(args []string) error
- func (d *VmwareDriver) GuestAddress(state multistep.StateBag) (string, error)
- func (d *VmwareDriver) HostAddress(state multistep.StateBag) (string, error)
- func (d *VmwareDriver) HostIP(state multistep.StateBag) (string, error)
- func (d *VmwareDriver) PotentialGuestIP(state multistep.StateBag) ([]string, error)
- func (d *VmwareDriver) VerifyOvfTool(SkipExport, _ bool) error
- type Workstation10Driver
- type Workstation9Driver
- func (d *Workstation9Driver) Clone(dst, src string, linked bool, snapshot string) error
- func (d *Workstation9Driver) CommHost(state multistep.StateBag) (string, error)
- func (d *Workstation9Driver) CompactDisk(diskPath string) error
- func (d *Workstation9Driver) CreateDisk(output string, size string, adapter_type string, type_id string) error
- func (d *Workstation9Driver) CreateSnapshot(vmxPath string, snapshotName string) error
- func (d *Workstation9Driver) GetVmwareDriver() VmwareDriver
- func (d *Workstation9Driver) IsRunning(vmxPath string) (bool, error)
- func (d *Workstation9Driver) Start(vmxPath string, headless bool) error
- func (d *Workstation9Driver) Stop(vmxPath string) error
- func (d *Workstation9Driver) SuppressMessages(vmxPath string) error
- func (d *Workstation9Driver) ToolsInstall() error
- func (d *Workstation9Driver) ToolsIsoPath(flavor string) string
- func (d *Workstation9Driver) Verify() error
Constants ¶
const ( // BuilderId for the local artifacts BuilderId = "mitchellh.vmware" BuilderIdESX = "mitchellh.vmware-esx" ArtifactConfFormat = "artifact.conf.format" ArtifactConfKeepRegistered = "artifact.conf.keep_registered" ArtifactConfSkipExport = "artifact.conf.skip_export" )
const ( ALLOW grant = iota IGNORE grant = iota DENY grant = iota )
const ( NetworkingType_HOSTONLY = iota + 1 NetworkingType_NAT NetworkingType_BRIDGED )
const ( ExportFormatOvf = "ovf" ExportFormatOva = "ova" ExportFormatVmx = "vmx" )
Set the export formats for the virtual machine.
const ( FirmwareTypeBios = "bios" FirmwareTypeUEFI = "efi" FirmwareTypeUEFISecure = "efi-secure" )
Set the firmware types for the virtual machine.
const ( ToolsFlavorMacOS = "darwin" ToolsFlavorLinux = "linux" ToolsFlavorWindows = "windows" )
Set the allowed values for the `ToolsUploadFlavor`.
const NetworkingInterfacePrefix = "vmnet"
const VMWARE_FUSION_VERSION = "6"
const VMWARE_PLAYER_VERSION = "6"
const VMWARE_WS_VERSION = "10"
Variables ¶
var KeepFileExtensions = []string{".nvram", ".vmdk", ".vmsd", ".vmx", ".vmxf"}
These are the extensions of files that are important for the function of a VMware virtual machine. Any other file is discarded as part of the build.
var NetworkingCommandParsers = []networkingCommandParser{ {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, {/* contains filtered or unexported fields */}, }
Functions ¶
func CheckOvfToolVersion ¶ added in v1.1.0
CheckOvfToolVersion checks the version of the VMware OVF Tool.
func GetOvfTool ¶ added in v1.1.0
func GetOvfTool() string
func MockInterface ¶
func NewArtifact ¶
func ReadDhcpdLeaseEntries ¶
func VNCPassword ¶
Types ¶
type DhcpConfiguration ¶
type DhcpConfiguration []configDeclaration
** Dhcp Configuration
func ReadDhcpConfig ¶
func ReadDhcpConfig(path string) (DhcpConfiguration, error)
read the dhcp configuration out of the specified path
func ReadDhcpConfiguration ¶
func ReadDhcpConfiguration(fd *os.File) (DhcpConfiguration, error)
func (*DhcpConfiguration) Global ¶
func (e *DhcpConfiguration) Global() configDeclaration
func (*DhcpConfiguration) HostByName ¶
func (e *DhcpConfiguration) HostByName(host string) (configDeclaration, error)
func (*DhcpConfiguration) SubnetByAddress ¶
func (e *DhcpConfiguration) SubnetByAddress(address net.IP) (configDeclaration, error)
type DiskAndCDConfigData ¶
type DiskAndCDConfigData struct {
SCSI_Present string
SCSI_diskAdapterType string
SATA_Present string
NVME_Present string
DiskType string
CDROMType string
CDROMType_PrimarySecondary string
CDROM_PATH string
}
func DefaultDiskAndCDROMTypes ¶
func DefaultDiskAndCDROMTypes(diskAdapterType string, cdromAdapterType string) DiskAndCDConfigData
DefaultDiskAndCDROMTypes takes the disk adapter type and cdrom adapter type from the config and converts them into template interpolation data for creating or configuring a vmx.
type DiskConfig ¶
type DiskConfig struct {
// The size(s) of additional virtual hard disks in MB. If not specified,
// the virtual machine will contain only a primary hard disk.
AdditionalDiskSize []uint `mapstructure:"disk_additional_size" required:"false"`
// The adapter type for additional virtual disk(s). Available options
// are `ide`, `sata`, `nvme`, or `scsi`.
//
// ~> **Note:** When specifying `scsi` as the adapter type, the default
// adapter type is set to `lsilogic`. If another option is specified, the
// plugin will assume it is a `scsi` interface of that specified type.
//
// ~> **Note:** This option is intended for advanced users.
DiskAdapterType string `mapstructure:"disk_adapter_type" required:"false"`
// The filename for the virtual disk to create _without_ the `.vmdk`
// extension. Defaults to `disk`.
DiskName string `mapstructure:"vmdk_name" required:"false"`
// The type of virtual disk to create.
//
// For local desktop hypervisors, the available options are:
//
// Type ID | Description
// ------- | ---
// `0` | Growable virtual disk contained in a single file (monolithic sparse).
// `1` | Growable virtual disk split into 2GB files (split sparse).
// `2` | Preallocated virtual disk contained in a single file (monolithic flat).
// `3` | Preallocated virtual disk split into 2GB files (split flat).
// `4` | Preallocated virtual disk compatible with ESXi (VMFS flat).
// `5` | Compressed disk optimized for streaming.
//
// Defaults to `1`.
//
// For remote hypervisors, the available options are: `zeroedthick`,
// `eagerzeroedthick`, and `thin`. Defaults to `zeroedthick`.
//
// ~> **Note:** The `rdm:dev`, `rdmp:dev`, and `2gbsparse` types are not
// supported for remote hypervisors.
//
// ~> **Note:** Set `skip_compaction` to `true` when using `zeroedthick`
// or `eagerzeroedthick` due to default disk compaction behavior.
//
// ~> **Note:** This option is intended for advanced users.
DiskTypeId string `mapstructure:"disk_type_id" required:"false"`
}
func (*DiskConfig) Prepare ¶
func (c *DiskConfig) Prepare(ctx *interpolate.Context) []error
type Driver ¶
type Driver interface {
// Clone clones the VMX and the disk to the destination path. The
// destination is a path to the VMX file. The disk will be copied
// to that same directory.
Clone(dst string, src string, cloneType bool, snapshot string) error
// CompactDisk compacts a virtual disk.
CompactDisk(string) error
// CreateDisk creates a virtual disk with the given size.
CreateDisk(string, string, string, string) error
// CreateSnapshot creates a snapshot of the supplied .vmx file with
// the given name
CreateSnapshot(string, string) error
// Checks if the VMX file at the given path is running.
IsRunning(string) (bool, error)
// Start starts a VM specified by the path to the VMX given.
Start(string, bool) error
// Stop stops a VM specified by the path to the VMX given.
Stop(string) error
// SuppressMessages modifies the VMX or surrounding directory so that
// VMware doesn't show any annoying messages.
SuppressMessages(string) error
// Get the path to the VMware ISO for the given flavor.
ToolsIsoPath(string) string
// Attach the VMware tools ISO
ToolsInstall() error
// Verify checks to make sure that this driver should function
// properly. This should check that all the files it will use
// appear to exist and so on. If everything is okay, this doesn't
// return an error. Otherwise, this returns an error. Each vmware
// driver should assign the VmwareMachine callback functions for locating
// paths within this function.
Verify() error
/// This is to establish a connection to the guest
CommHost(multistep.StateBag) (string, error)
/// These methods are generally implemented by the VmwareDriver
/// structure within this file. A driver implementation can
/// reimplement these, though, if it wants.
GetVmwareDriver() VmwareDriver
// Get the guest hw address for the vm
GuestAddress(multistep.StateBag) (string, error)
// Get the guest ip address for the vm
PotentialGuestIP(multistep.StateBag) ([]string, error)
// Get the host hw address for the vm
HostAddress(multistep.StateBag) (string, error)
// Get the host ip address for the vm
HostIP(multistep.StateBag) (string, error)
// Export the vm to ovf or ova format using ovftool
Export([]string) error
// OvfTool
VerifyOvfTool(bool, bool) error
}
A driver is able to talk to VMware, control virtual machines, etc.
func NewDriver ¶
func NewDriver(dconfig *DriverConfig, config *SSHConfig, vmName string) (Driver, error)
NewDriver returns a new driver implementation for this operating system, or an error if the driver couldn't be initialized.
func NewESX5Driver ¶
func NewESX5Driver(dconfig *DriverConfig, config *SSHConfig, vmName string) (Driver, error)
func NewFusion5Driver ¶
func NewFusion5Driver(dconfig *DriverConfig, config *SSHConfig) Driver
func NewFusion6Driver ¶
func NewFusion6Driver(dconfig *DriverConfig, config *SSHConfig) Driver
func NewPlayer5Driver ¶
func NewPlayer6Driver ¶
func NewWorkstation10Driver ¶
func NewWorkstation9Driver ¶
type DriverConfig ¶
type DriverConfig struct {
// Path to "VMware Fusion.app". By default this is
// /Applications/VMware Fusion.app but this setting allows you to
// customize this.
FusionAppPath string `mapstructure:"fusion_app_path" required:"false"`
// The type of remote machine that will be used to
// build this VM rather than a local desktop product. The only value accepted
// for this currently is esx5. If this is not set, a desktop product will
// be used. By default, this is not set.
RemoteType string `mapstructure:"remote_type" required:"false"`
// The path to the datastore where the VM will be stored
// on the ESXi machine.
RemoteDatastore string `mapstructure:"remote_datastore" required:"false"`
// The path to the datastore where supporting files
// will be stored during the build on the remote machine.
RemoteCacheDatastore string `mapstructure:"remote_cache_datastore" required:"false"`
// The path where the ISO and/or floppy files will
// be stored during the build on the remote machine. The path is relative to
// the remote_cache_datastore on the remote machine.
RemoteCacheDirectory string `mapstructure:"remote_cache_directory" required:"false"`
// When set to true, Packer will cleanup the cache folder where the ISO file is stored during the build on the remote machine.
// By default, this is set to false.
CleanUpRemoteCache bool `mapstructure:"cleanup_remote_cache" required:"false"`
// The host of the remote machine used for access.
// This is only required if remote_type is enabled.
RemoteHost string `mapstructure:"remote_host" required:"false"`
// The SSH port of the remote machine
RemotePort int `mapstructure:"remote_port" required:"false"`
// The SSH username used to access the remote machine.
RemoteUser string `mapstructure:"remote_username" required:"false"`
// The SSH password for access to the remote machine.
RemotePassword string `mapstructure:"remote_password" required:"false"`
// The SSH key for access to the remote machine.
RemotePrivateKey string `mapstructure:"remote_private_key_file" required:"false"`
// When Packer is preparing to run a
// remote hypervisor build, and export is not disable, by default it runs a no-op
// ovftool command to make sure that the remote_username and remote_password
// given are valid. If you set this flag to true, Packer will skip this
// validation. Default: false.
SkipValidateCredentials bool `mapstructure:"skip_validate_credentials" required:"false"`
}
func (*DriverConfig) Prepare ¶
func (c *DriverConfig) Prepare(ctx *interpolate.Context) []error
func (*DriverConfig) Validate ¶
func (c *DriverConfig) Validate(SkipExport bool) error
type DriverMock ¶
type DriverMock struct {
sync.Mutex
CloneCalled bool
CloneDst string
CloneSrc string
Linked bool
Snapshot string
CloneErr error
CompactDiskCalled bool
CompactDiskPath string
CompactDiskErr error
CreateDiskCalled bool
CreateDiskOutput string
CreateDiskSize string
CreateDiskAdapterType string
CreateDiskTypeId string
CreateDiskErr error
CreateSnapshotCalled bool
CreateSnapshotVMXPath string
CreateSnapshotName string
CreateSnapshotErr error
ExportCalled bool
ExportArgs []string
IsRunningCalled bool
IsRunningPath string
IsRunningResult bool
IsRunningErr error
CommHostCalled bool
CommHostState multistep.StateBag
CommHostResult string
CommHostErr error
HostAddressCalled bool
HostAddressState multistep.StateBag
HostAddressResult string
HostAddressErr error
HostIPCalled bool
HostIPState multistep.StateBag
HostIPResult string
HostIPErr error
GuestAddressCalled bool
GuestAddressState multistep.StateBag
GuestAddressResult string
GuestAddressErr error
PotentialGuestIPCalled bool
PotentialGuestIPState multistep.StateBag
PotentialGuestIPResult []string
PotentialGuestIPErr error
StartCalled bool
StartPath string
StartHeadless bool
StartErr error
StopCalled bool
StopPath string
StopErr error
SuppressMessagesCalled bool
SuppressMessagesPath string
SuppressMessagesErr error
ToolsIsoPathCalled bool
ToolsIsoPathFlavor string
ToolsIsoPathResult string
ToolsInstallCalled bool
ToolsInstallErr error
DhcpLeasesPathCalled bool
DhcpLeasesPathDevice string
DhcpLeasesPathResult string
DhcpConfPathCalled bool
DhcpConfPathResult string
VmnetnatConfPathCalled bool
VmnetnatConfPathResult string
NetmapConfPathCalled bool
NetmapConfPathResult string
VerifyCalled bool
VerifyErr error
VerifyOvftoolCalled bool
}
func (*DriverMock) CommHost ¶
func (d *DriverMock) CommHost(state multistep.StateBag) (string, error)
func (*DriverMock) CompactDisk ¶
func (d *DriverMock) CompactDisk(path string) error
func (*DriverMock) CreateDisk ¶
func (*DriverMock) CreateSnapshot ¶ added in v1.0.0
func (d *DriverMock) CreateSnapshot(vmxPath string, snapshotName string) error
func (*DriverMock) DhcpConfPath ¶
func (d *DriverMock) DhcpConfPath(device string) string
func (*DriverMock) DhcpLeasesPath ¶
func (d *DriverMock) DhcpLeasesPath(device string) string
func (*DriverMock) Export ¶
func (d *DriverMock) Export(args []string) error
func (*DriverMock) GetVmwareDriver ¶
func (d *DriverMock) GetVmwareDriver() VmwareDriver
func (*DriverMock) GuestAddress ¶
func (d *DriverMock) GuestAddress(state multistep.StateBag) (string, error)
func (*DriverMock) HostAddress ¶
func (d *DriverMock) HostAddress(state multistep.StateBag) (string, error)
func (*DriverMock) NetmapConfPath ¶
func (d *DriverMock) NetmapConfPath() string
func (*DriverMock) PotentialGuestIP ¶
func (d *DriverMock) PotentialGuestIP(state multistep.StateBag) ([]string, error)
func (*DriverMock) Stop ¶
func (d *DriverMock) Stop(path string) error
func (*DriverMock) SuppressMessages ¶
func (d *DriverMock) SuppressMessages(path string) error
func (*DriverMock) ToolsInstall ¶
func (d *DriverMock) ToolsInstall() error
func (*DriverMock) ToolsIsoPath ¶
func (d *DriverMock) ToolsIsoPath(flavor string) string
func (*DriverMock) Verify ¶
func (d *DriverMock) Verify() error
func (*DriverMock) VerifyOvfTool ¶
func (d *DriverMock) VerifyOvfTool(_ bool, _ bool) error
func (*DriverMock) VmnetnatConfPath ¶
func (d *DriverMock) VmnetnatConfPath(device string) string
type ESX5Driver ¶
type ESX5Driver struct {
Host string
Port int
Username string
Password string
PrivateKeyFile string
Datastore string
CacheDatastore string
CacheDirectory string
VMName string
CommConfig communicator.Config
// contains filtered or unexported fields
}
ESX5 driver talks to an ESXi5 hypervisor remotely over SSH to build virtual machines. This driver can only manage one machine at a time.
func (*ESX5Driver) AcquireVNCOverWebsocketTicket ¶
func (d *ESX5Driver) AcquireVNCOverWebsocketTicket() (*types.VirtualMachineTicket, error)
func (*ESX5Driver) CachePath ¶
func (d *ESX5Driver) CachePath(path string) string
func (*ESX5Driver) Clone ¶
func (d *ESX5Driver) Clone(dst, src string, linked bool, snapshot string) error
func (*ESX5Driver) CommHost ¶
func (d *ESX5Driver) CommHost(state multistep.StateBag) (string, error)
func (*ESX5Driver) CompactDisk ¶
func (d *ESX5Driver) CompactDisk(diskPathLocal string) error
func (*ESX5Driver) CreateDisk ¶
func (*ESX5Driver) CreateSnapshot ¶ added in v1.0.0
func (d *ESX5Driver) CreateSnapshot(vmxPath string, snapshotName string) error
func (*ESX5Driver) Destroy ¶
func (d *ESX5Driver) Destroy() error
func (*ESX5Driver) DirExists ¶
func (d *ESX5Driver) DirExists() (bool, error)
func (*ESX5Driver) Download ¶
func (d *ESX5Driver) Download(src, dst string) error
func (*ESX5Driver) Export ¶
func (d *ESX5Driver) Export(args []string) error
func (*ESX5Driver) GetVmwareDriver ¶
func (d *ESX5Driver) GetVmwareDriver() VmwareDriver
func (*ESX5Driver) GuestAddress ¶
func (d *ESX5Driver) GuestAddress(multistep.StateBag) (string, error)
func (*ESX5Driver) HostAddress ¶
func (d *ESX5Driver) HostAddress(multistep.StateBag) (string, error)
func (*ESX5Driver) IsDestroyed ¶
func (d *ESX5Driver) IsDestroyed() (bool, error)
func (*ESX5Driver) ListFiles ¶
func (d *ESX5Driver) ListFiles() ([]string, error)
func (*ESX5Driver) MkdirAll ¶
func (d *ESX5Driver) MkdirAll() error
func (*ESX5Driver) PotentialGuestIP ¶
func (d *ESX5Driver) PotentialGuestIP(multistep.StateBag) ([]string, error)
func (*ESX5Driver) Register ¶
func (d *ESX5Driver) Register(vmxPathLocal string) error
func (*ESX5Driver) ReloadVM ¶
func (d *ESX5Driver) ReloadVM() error
func (*ESX5Driver) Remove ¶
func (d *ESX5Driver) Remove(path string) error
func (*ESX5Driver) RemoveAll ¶
func (d *ESX5Driver) RemoveAll() error
func (*ESX5Driver) RemoveCache ¶
func (d *ESX5Driver) RemoveCache(localPath string) error
func (*ESX5Driver) SetOutputDir ¶
func (d *ESX5Driver) SetOutputDir(path string)
func (*ESX5Driver) Stop ¶
func (d *ESX5Driver) Stop(vmxPathLocal string) error
func (*ESX5Driver) String ¶
func (d *ESX5Driver) String() string
func (*ESX5Driver) SuppressMessages ¶
func (d *ESX5Driver) SuppressMessages(vmxPath string) error
func (*ESX5Driver) ToolsInstall ¶
func (d *ESX5Driver) ToolsInstall() error
func (*ESX5Driver) ToolsIsoPath ¶
func (d *ESX5Driver) ToolsIsoPath(string) string
func (*ESX5Driver) Unregister ¶
func (d *ESX5Driver) Unregister(vmxPathLocal string) error
func (ESX5Driver) UpdateVMX ¶
func (ESX5Driver) UpdateVMX(_, password string, port int, data map[string]string)
UpdateVMX, adds the VNC port to the VMX data.
func (*ESX5Driver) VNCAddress ¶
func (*ESX5Driver) Verify ¶
func (d *ESX5Driver) Verify() error
func (*ESX5Driver) VerifyChecksum ¶
func (d *ESX5Driver) VerifyChecksum(hash string, file string) bool
VerifyChecksum checks that file on the esxi instance matches hash
func (*ESX5Driver) VerifyOvfTool ¶
func (d *ESX5Driver) VerifyOvfTool(SkipExport, skipValidateCredentials bool) error
type ExportConfig ¶
type ExportConfig struct {
// The output format of the exported virtual machine. Allowed values are
// `ova`, `ovf`, or `vmx`. Defaults to `vmx` for local desktop hypervisors
// and `ova` for remote hypervisors.
//
// For builds on a remote hypervisor, `remote_password` must be set when
// exporting the virtual machine
//
// For builds on a local desktop hypervisor, the plugin will create a `.vmx`
// and export the virtual machine as an `.ovf` or `.ova` file. THe plugin
// will not delete the `.vmx` and `.vmdk` files. You must manually delete
// these files if they are no longer needed.
//
// ~> **Note:** Ensure VMware OVF Tool is installed. For the latest version,
// visit [VMware OVF Tool](https://developer.broadcom.com/tools/open-virtualization-format-ovf-tool/latest).
//
// ~> **Note:** For local builds, the plugin will create a `.vmx` and
// supporting files in the output directory and will then export the
// virtual machine to the specified format. These files are **not**
// automatically cleaned up after the export process.
Format string `mapstructure:"format" required:"false"`
// Additional command-line arguments to send to VMware OVF Tool during the
// export process. Each string in the array represents a separate
// command-line argument.
//
// ~> **Important:** The options `--noSSLVerify`, `--skipManifestCheck`, and
// `--targetType` are automatically applied by the plugin for remote exports
// and should not be included in the options. For local OVF/OVA exports,
// the plugin does not preset any VMware OVF Tool options by default.
//
// ~> **Note:** Ensure VMware OVF Tool is installed. For the latest version,
// visit [VMware OVF Tool](https://developer.broadcom.com/tools/open-virtualization-format-ovf-tool/latest).
OVFToolOptions []string `mapstructure:"ovftool_options" required:"false"`
// Skips the export of the virtual machine. This is useful if the build
// output is not the resultant image, but created inside the virtual
// machine. This is useful for debugging purposes. Defaults to `false`.
SkipExport bool `mapstructure:"skip_export" required:"false"`
// Determines whether a virtual machine built on a remote hypervisor should
// remain registered after the build process. Setting this to `true` can be
// useful if the virtual machine does not need to be exported. Defaults to
// `false`.
KeepRegistered bool `mapstructure:"keep_registered" required:"false"`
// At the end of the build process, the plugin defragments and compacts the
// disks using `vmware-vdiskmanager` or `vmkfstools` for ESXi environments.
// In some cases, this process may result in slightly larger disk sizes.
// If this occurs, you can opt to skip the disk compaction step by using
// this setting. Defaults to `false`. Defaults to `true` for ESXi when
// `disk_type_id` is not explicitly defined and `false`
SkipCompaction bool `mapstructure:"skip_compaction" required:"false"`
}
func (*ExportConfig) Prepare ¶
func (c *ExportConfig) Prepare(ctx *interpolate.Context) []error
type Fusion5Driver ¶
type Fusion5Driver struct {
VmwareDriver
// This is the path to the "VMware Fusion.app"
AppPath string
// SSHConfig are the SSH settings for the Fusion VM
SSHConfig *SSHConfig
}
Fusion5Driver is a driver that can run VMware Fusion 5.
func (*Fusion5Driver) Clone ¶
func (d *Fusion5Driver) Clone(dst, src string, linked bool, snapshot string) error
func (*Fusion5Driver) CommHost ¶
func (d *Fusion5Driver) CommHost(state multistep.StateBag) (string, error)
func (*Fusion5Driver) CompactDisk ¶
func (d *Fusion5Driver) CompactDisk(diskPath string) error
func (*Fusion5Driver) CreateDisk ¶
func (*Fusion5Driver) CreateSnapshot ¶ added in v1.0.0
func (d *Fusion5Driver) CreateSnapshot(vmxPath string, snapshotName string) error
func (*Fusion5Driver) GetVmwareDriver ¶
func (d *Fusion5Driver) GetVmwareDriver() VmwareDriver
func (*Fusion5Driver) Stop ¶
func (d *Fusion5Driver) Stop(vmxPath string) error
func (*Fusion5Driver) SuppressMessages ¶
func (d *Fusion5Driver) SuppressMessages(vmxPath string) error
func (*Fusion5Driver) ToolsInstall ¶
func (d *Fusion5Driver) ToolsInstall() error
func (*Fusion5Driver) ToolsIsoPath ¶
func (d *Fusion5Driver) ToolsIsoPath(k string) string
func (*Fusion5Driver) Verify ¶
func (d *Fusion5Driver) Verify() error
type Fusion6Driver ¶
type Fusion6Driver struct {
Fusion5Driver
}
Fusion6Driver is a driver that can run VMware Fusion 6.
func (*Fusion6Driver) Clone ¶
func (d *Fusion6Driver) Clone(dst, src string, linked bool, snapshot string) error
func (*Fusion6Driver) GetVmwareDriver ¶
func (d *Fusion6Driver) GetVmwareDriver() VmwareDriver
func (*Fusion6Driver) ToolsIsoPath ¶ added in v1.0.8
func (d *Fusion6Driver) ToolsIsoPath(k string) string
func (*Fusion6Driver) Verify ¶
func (d *Fusion6Driver) Verify() error
type HWConfig ¶
type HWConfig struct {
// The firmware type for the virtual machine.
// Allowed values are `bios`, `efi`, and `efi-secure` (for secure boot).
// Defaults to the recommended firmware type for the guest operating system.
Firmware string `mapstructure:"firmware" required:"false"`
// The number of virtual CPUs cores for the virtual machine.
CpuCount int `mapstructure:"cpus" required:"false"`
// The number of virtual CPU cores per socket for the virtual machine.
CoreCount int `mapstructure:"cores" required:"false"`
// The amount of memory for the virtual machine in MB.
MemorySize int `mapstructure:"memory" required:"false"`
// The network which the virtual machine will connect for local desktop
// hypervisors. Use the generic values that map to a device, such as
// `hostonly`, `nat`, or `bridged`. Defaults to `nat`.
//
// ~> **Note:** If not set to one of these generic values, then it is
// assumed to be a network device (_e.g._, `VMnet0..x`).
Network string `mapstructure:"network" required:"false"`
// The network which the virtual machine will connect on a remote
// hypervisor.
NetworkName string `mapstructure:"network_name" required:"false"`
// The virtual machine network card type. Recommended values are `e1000` and
// `vmxnet3`. Defaults to `e1000`.
//
// Refer to VMware product documentation for supported network adapter types
// for the hypervisor and guest operating system.
NetworkAdapterType string `mapstructure:"network_adapter_type" required:"false"`
// Enable virtual sound card device. Defaults to `false`.
Sound bool `mapstructure:"sound" required:"false"`
// Enable a the USB 2.0 controllers for the virtual machine.
// Defaults to `false`.
//
// ~> **Note:** To enable USB 3.0 controllers, set a `usb_xhci.present`
// key to `true` in the `vmx_data` option.
USB bool `mapstructure:"usb" required:"false"`
// Add a serial port to the virtual machine. Use a format of
// `Type:option1,option2,...`. Allowed values for the field `Type` include:
// `FILE`, `DEVICE`, `PIPE`, `AUTO`, or `NONE`.
//
// * `FILE:path(,yield)` - Specifies the path to the local file to be used
// as the serial port.
//
// * `yield` (bool) - This is an optional boolean that specifies
// whether the virtual machine should yield the CPU when polling the
// port. By default, the builder will assume this as `FALSE`.
//
// * `DEVICE:path(,yield)` - Specifies the path to the local device to be
// used as the serial port. If `path` is empty, then default to the first
// serial port.
//
// * `yield` (bool) - This is an optional boolean that specifies
// whether the virtual machine should yield the CPU when polling the
// port. By default, the builder will assume this as `FALSE`.
//
// * `PIPE:path,endpoint,host(,yield)` - Specifies to use the named-pipe
// "path" as a serial port. This has a few options that determine how the
// VM should use the named-pipe.
//
// * `endpoint` (string) - Chooses the type of the VM-end, which can be
// either a `client` or `server`.
//
// * `host` (string) - Chooses the type of the host-end, which can be
// either `app` (application) or `vm` (another virtual-machine).
//
// * `yield` (bool) - This is an optional boolean that specifies whether
// the virtual machine should yield the CPU when polling the port. By
// default, the builder will assume this as `FALSE`.
//
// * `AUTO:(yield)` - Specifies to use auto-detection to determine the
// serial port to use. This has one option to determine how the virtual
// machine should support the serial port.
//
// * `yield` (bool) - This is an optional boolean that specifies whether
// the virtual machine should yield the CPU when polling the port. By
// default, the builder will assume this as `FALSE`.
//
// * `NONE` - Specifies to not use a serial port. (default)
Serial string `mapstructure:"serial" required:"false"`
// Add a parallel port to add to the virtual machine. Use a format of
// `Type:option1,option2,...`. Allowed values for the field `Type` include:
// `FILE`, `DEVICE`, `AUTO`, or `NONE`.
//
// * `FILE:path` - Specifies the path to the local file to be used for the
// parallel port.
//
// * `DEVICE:path` - Specifies the path to the local device to be used for
// the parallel port.
//
// * `AUTO:direction` - Specifies to use auto-detection to determine the
// parallel port. Direction can be `BI` to specify bidirectional
// communication or `UNI` to specify unidirectional communication.
//
// * `NONE` - Specifies to not use a parallel port. (default)
Parallel string `mapstructure:"parallel" required:"false"`
}
func (*HWConfig) HasParallel ¶
func (*HWConfig) ReadParallel ¶
func (c *HWConfig) ReadParallel() (*ParallelUnion, error)
func (*HWConfig) ReadSerial ¶
func (c *HWConfig) ReadSerial() (*SerialUnion, error)
type IfconfigIPFinder ¶
type IfconfigIPFinder struct {
Device string
}
IfconfigIPFinder finds the host IP based on the output of `ip address` or `ifconfig`.
func (*IfconfigIPFinder) HostIP ¶
func (f *IfconfigIPFinder) HostIP() (string, error)
type LocalOutputDir ¶
type LocalOutputDir struct {
// contains filtered or unexported fields
}
LocalOutputDir is an OutputDir implementation where the directory is on the local machine.
func (*LocalOutputDir) DirExists ¶
func (d *LocalOutputDir) DirExists() (bool, error)
func (*LocalOutputDir) ListFiles ¶
func (d *LocalOutputDir) ListFiles() ([]string, error)
func (*LocalOutputDir) MkdirAll ¶
func (d *LocalOutputDir) MkdirAll() error
func (*LocalOutputDir) Remove ¶
func (d *LocalOutputDir) Remove(path string) error
func (*LocalOutputDir) RemoveAll ¶
func (d *LocalOutputDir) RemoveAll() error
func (*LocalOutputDir) SetOutputDir ¶
func (d *LocalOutputDir) SetOutputDir(path string)
func (*LocalOutputDir) String ¶
func (d *LocalOutputDir) String() string
type NetmapConfig ¶ added in v1.1.0
NetmapConfig is a struct that represents a network mapper configuration.
type NetworkMap ¶
** Network Map
func ReadNetmapConfig ¶
func ReadNetmapConfig(path string) (NetworkMap, error)
helper functions that read configuration information from a file read the network<->device configuration out of the specified path
func ReadNetworkMap ¶
func ReadNetworkMap(fd *os.File) (NetworkMap, error)
func (NetworkMap) DeviceIntoName ¶
func (e NetworkMap) DeviceIntoName(device string) (string, error)
func (NetworkMap) NameIntoDevices ¶
func (e NetworkMap) NameIntoDevices(name string) ([]string, error)
type NetworkMapperMock ¶
func (*NetworkMapperMock) DeviceIntoName ¶
func (m *NetworkMapperMock) DeviceIntoName(device string) (string, error)
func (*NetworkMapperMock) NameIntoDevices ¶
func (m *NetworkMapperMock) NameIntoDevices(name string) ([]string, error)
type NetworkNameMapper ¶
type NetworkingConfig ¶
type NetworkingConfig struct {
// contains filtered or unexported fields
}
func ReadNetworkingConfig ¶
func ReadNetworkingConfig(fd *os.File) (NetworkingConfig, error)
Constructor for networking file
func (NetworkingConfig) DeviceIntoName ¶
func (e NetworkingConfig) DeviceIntoName(device string) (string, error)
func (NetworkingConfig) NameIntoDevices ¶
func (e NetworkingConfig) NameIntoDevices(name string) ([]string, error)
type OutputConfig ¶
type OutputConfig struct {
// This is the path on your local machine (the one running Packer) to the
// directory where the resulting virtual machine will be created.
// This may be relative or absolute. If relative, the path is relative to
// the working directory when packer is executed.
//
// If you are running a remote hypervisor build, the output_dir is the path on your
// local machine (the machine running Packer) to which Packer will export
// the vm if you have `"skip_export": false`. If you want to manage the
// virtual machine's path on the remote datastore, use `remote_output_dir`.
//
// This directory must not exist or be empty prior to running
// the builder.
//
// By default this is output-BUILDNAME where "BUILDNAME" is the name of the
// build.
OutputDir string `mapstructure:"output_directory" required:"false"`
// This is the directory on your remote hypervisor where you will save your
// vm, relative to your remote_datastore.
//
// This option's default value is your `vm_name`, and the final path of your
// vm will be vmfs/volumes/$remote_datastore/$vm_name/$vm_name.vmx where
// `$remote_datastore` and `$vm_name` match their corresponding template
// options
//
// For example, setting `"remote_output_directory": "path/to/subdir`
// will create a directory `/vmfs/volumes/remote_datastore/path/to/subdir`.
//
// Packer will not create the remote datastore for you; it must already
// exist. However, Packer will create all directories defined in the option
// that do not currently exist.
//
// This option will be ignored unless you are building on a remote hypervisor.
RemoteOutputDir string `mapstructure:"remote_output_directory" required:"false"`
}
func (*OutputConfig) Prepare ¶
func (c *OutputConfig) Prepare(ctx *interpolate.Context, pc *common.PackerConfig) []error
type OutputDir ¶
type OutputDir interface {
DirExists() (bool, error)
ListFiles() ([]string, error)
MkdirAll() error
Remove(string) error
RemoveAll() error
SetOutputDir(string)
String() string
}
OutputDir is an interface type that abstracts the creation and handling of the output directory for VMware-based products. The abstraction is made so that the output directory can be properly made on remote (ESXi) based VMware products as well as local. For remote builds, OutputDir interface is satisfied by the ESX5Driver.
type ParallelPortAuto ¶
type ParallelPortAuto struct {
Bidirectional string
}
type ParallelPortDevice ¶
type ParallelPortFile ¶
type ParallelPortFile struct {
Filename string
}
type ParallelUnion ¶
type ParallelUnion struct {
Union interface{}
File *ParallelPortFile
Device *ParallelPortDevice
Auto *ParallelPortAuto
}
type Player5Driver ¶
type Player5Driver struct {
VmwareDriver
AppPath string
VdiskManagerPath string
QemuImgPath string
VmrunPath string
// SSHConfig are the SSH settings for the Fusion VM
SSHConfig *SSHConfig
}
Player5Driver is a driver that can run VMware Player 5 on Linux.
func (*Player5Driver) Clone ¶
func (d *Player5Driver) Clone(dst, src string, linked bool, snapshot string) error
func (*Player5Driver) CommHost ¶
func (d *Player5Driver) CommHost(state multistep.StateBag) (string, error)
func (*Player5Driver) CompactDisk ¶
func (d *Player5Driver) CompactDisk(diskPath string) error
func (*Player5Driver) CreateDisk ¶
func (*Player5Driver) CreateSnapshot ¶ added in v1.0.0
func (d *Player5Driver) CreateSnapshot(vmxPath string, snapshotName string) error
func (*Player5Driver) GetVmwareDriver ¶
func (d *Player5Driver) GetVmwareDriver() VmwareDriver
func (*Player5Driver) Stop ¶
func (d *Player5Driver) Stop(vmxPath string) error
func (*Player5Driver) SuppressMessages ¶
func (d *Player5Driver) SuppressMessages(vmxPath string) error
func (*Player5Driver) ToolsInstall ¶
func (d *Player5Driver) ToolsInstall() error
func (*Player5Driver) ToolsIsoPath ¶
func (d *Player5Driver) ToolsIsoPath(flavor string) string
func (*Player5Driver) Verify ¶
func (d *Player5Driver) Verify() error
type Player6Driver ¶
type Player6Driver struct {
Player5Driver
}
func (*Player6Driver) Clone ¶
func (d *Player6Driver) Clone(dst, src string, linked bool, snapshot string) error
func (*Player6Driver) GetVmwareDriver ¶
func (d *Player6Driver) GetVmwareDriver() VmwareDriver
func (*Player6Driver) Verify ¶
func (d *Player6Driver) Verify() error
type RemoteDriver ¶
type RemoteDriver interface {
Driver
// UploadISO uploads a local ISO to the remote side and returns the
// new path that should be used in the VMX along with an error if it
// exists.
UploadISO(path string, checksum string, ui packersdk.Ui) (string, error)
// RemoveCache deletes localPath from the remote cache.
RemoveCache(localPath string) error
// Adds a VM to inventory specified by the path to the VMX given.
Register(path string) error
// Removes a VM from inventory specified by the path to the VMX given.
Unregister(path string) error
// Destroys a VM
Destroy() error
// Checks if the VM is destroyed.
IsDestroyed() (bool, error)
// Download a remote file to a local file.
Download(src, dst string) error
// Reload VM on remote side.
ReloadVM() error
// contains filtered or unexported methods
}
type RemoteDriverMock ¶
type RemoteDriverMock struct {
DriverMock
UploadISOCalled bool
UploadISOPath string
UploadISOResult string
UploadISOErr error
RegisterCalled bool
RegisterPath string
RegisterErr error
UnregisterCalled bool
UnregisterPath string
UnregisterErr error
DestroyCalled bool
DestroyErr error
IsDestroyedCalled bool
IsDestroyedResult bool
IsDestroyedErr error
UploadErr error
DownloadErr error
RemovedCachePath string
CacheRemoved bool
ReturnValDirExists bool
ReloadVMErr error
// contains filtered or unexported fields
}
func (*RemoteDriverMock) Destroy ¶
func (d *RemoteDriverMock) Destroy() error
func (*RemoteDriverMock) DirExists ¶
func (d *RemoteDriverMock) DirExists() (bool, error)
func (*RemoteDriverMock) Download ¶
func (d *RemoteDriverMock) Download(src, dst string) error
func (*RemoteDriverMock) IsDestroyed ¶
func (d *RemoteDriverMock) IsDestroyed() (bool, error)
func (*RemoteDriverMock) ListFiles ¶
func (d *RemoteDriverMock) ListFiles() ([]string, error)
func (*RemoteDriverMock) MkdirAll ¶
func (d *RemoteDriverMock) MkdirAll() error
func (*RemoteDriverMock) Register ¶
func (d *RemoteDriverMock) Register(path string) error
func (*RemoteDriverMock) ReloadVM ¶
func (d *RemoteDriverMock) ReloadVM() error
func (*RemoteDriverMock) Remove ¶
func (d *RemoteDriverMock) Remove(string) error
func (*RemoteDriverMock) RemoveAll ¶
func (d *RemoteDriverMock) RemoveAll() error
func (*RemoteDriverMock) RemoveCache ¶
func (d *RemoteDriverMock) RemoveCache(localPath string) error
func (*RemoteDriverMock) SetOutputDir ¶
func (d *RemoteDriverMock) SetOutputDir(s string)
func (*RemoteDriverMock) String ¶
func (d *RemoteDriverMock) String() string
func (*RemoteDriverMock) Unregister ¶
func (d *RemoteDriverMock) Unregister(path string) error
type RunConfig ¶
type RunConfig struct {
// The plugin defaults to building virtual machines by launching the
// desktop hypervisor's graphical user interface (GUI) to display the
// console of the virtual machine being built. When this value is set to
// `true`, the virtual machine will start without a console; however, the
// plugin will output VNC connection information in case you need to connect
// to the console to debug the build process. Defaults to `false`.
//
// ~> **Note:** Some users have experienced issues where Packer cannot
// properly connect to a virtual machine when using `headless`. This is
// often attributed to the use of an evaluation license for VMware desktop
// hypervisors. It is recommended to launch the product and accept the
// evaluation license to resolve this if you encounter an issue with this
// option.
Headless bool `mapstructure:"headless" required:"false"`
// The IP address to use for VNC access to the virtual machine. Defaults to
// `127.0.0.1`.
//
// ~> **Note:** To bind to all interfaces use `0.0.0.0`.
VNCBindAddress string `mapstructure:"vnc_bind_address" required:"false"`
// The minimum port number to use for VNC access to the virtual machine.
// The plugin uses VNC to type the `boot_command`. Defaults to `5900`.
VNCPortMin int `mapstructure:"vnc_port_min" required:"false"`
// The maximum port number to use for VNC access to the virtual machine.
// The plugin uses VNC to type the `boot_command`. Defaults to `6000`.
//
// ~> **Note:** The plugin randomly selects port within the inclusive range
// specified by `vnc_port_min` and `vnc_port_max`.
VNCPortMax int `mapstructure:"vnc_port_max"`
// Disables the auto-generation of a VNC password that is used to secure the
// VNC communication with the virtual machine. Defaults to `false`.
//
// ~> **Important:** Must be set to `true` for remote hypervisor builds with
// VNC enabled.
VNCDisablePassword bool `mapstructure:"vnc_disable_password" required:"false"`
// Connect to VNC over a websocket connection. Defaults to `false`.
//
// ~> **Note:** When set to `true`, any other VNC configuration options will
// be ignored.
//
// ~> **Important:** Must be set to `true` for remote hypervisor builds with
// VNC enabled.
VNCOverWebsocket bool `mapstructure:"vnc_over_websocket" required:"false"`
// Do not validate TLS certificate when connecting to VNC over a websocket
// connection. Defaults to `false`.
InsecureConnection bool `mapstructure:"insecure_connection" required:"false"`
}
func (*RunConfig) Prepare ¶
func (c *RunConfig) Prepare(_ *interpolate.Context, driverConfig *DriverConfig) (warnings []string, errs []error)
type SSHConfig ¶
type SSHConfig struct {
Comm communicator.Config `mapstructure:",squash"`
// TODO: Deprecated. Remove in next major release
SSHSkipRequestPty bool `mapstructure:"ssh_skip_request_pty"`
}
type SerialConfigAuto ¶
type SerialConfigDevice ¶
type SerialConfigFile ¶
type SerialConfigPipe ¶
type SerialUnion ¶
type SerialUnion struct {
Union interface{}
Pipe *SerialConfigPipe
File *SerialConfigFile
Device *SerialConfigDevice
Auto *SerialConfigAuto
}
type StepCleanFiles ¶
type StepCleanFiles struct{}
This step removes unnecessary files from the final result.
Uses: dir OutputDir ui packersdk.Ui
Produces: <nothing>
func (StepCleanFiles) Cleanup ¶
func (StepCleanFiles) Cleanup(multistep.StateBag)
func (StepCleanFiles) Run ¶
func (StepCleanFiles) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
type StepCleanVMX ¶
StepCleanVMX cleans up the VMX by removing or changing this prior to being ready for use.
func (StepCleanVMX) Cleanup ¶
func (StepCleanVMX) Cleanup(multistep.StateBag)
func (StepCleanVMX) Run ¶
func (s StepCleanVMX) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
type StepCompactDisk ¶
type StepCompactDisk struct {
Skip bool
}
This step compacts the virtual disk for the VM unless the "skip_compaction" boolean is true.
Uses: driver Driver disk_full_paths ([]string) - The full paths to all created disks ui packersdk.Ui
Produces: <nothing>
func (StepCompactDisk) Cleanup ¶
func (StepCompactDisk) Cleanup(multistep.StateBag)
func (StepCompactDisk) Run ¶
func (s StepCompactDisk) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
type StepConfigureVMX ¶
type StepConfigureVMX struct {
CustomData map[string]string
DisplayName string
SkipDevices bool
VMName string
DiskAdapterType string
CDROMAdapterType string
}
This step configures a VMX by setting some default settings as well as taking in custom data to set, attaching a floppy if it exists, etc.
Uses: vmx_path string Produces: display_name string - Value of the displayName key set in the VMX file
func (*StepConfigureVMX) Cleanup ¶
func (s *StepConfigureVMX) Cleanup(state multistep.StateBag)
func (*StepConfigureVMX) Run ¶
func (s *StepConfigureVMX) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
type StepConfigureVNC ¶
type StepConfigureVNC struct {
Enabled bool
VNCBindAddress string
VNCPortMin int
VNCPortMax int
VNCDisablePassword bool
// contains filtered or unexported fields
}
func (*StepConfigureVNC) Cleanup ¶
func (s *StepConfigureVNC) Cleanup(multistep.StateBag)
func (*StepConfigureVNC) Run ¶
func (s *StepConfigureVNC) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
func (*StepConfigureVNC) UpdateVMX ¶
func (*StepConfigureVNC) UpdateVMX(address, password string, port int, data map[string]string)
func (*StepConfigureVNC) VNCAddress ¶
type StepCreateDisks ¶
type StepCreateDisks struct {
OutputDir *string
CreateMainDisk bool
DiskName string
MainDiskSize uint
AdditionalDiskSize []uint
DiskAdapterType string
DiskTypeId string
}
StepCreateDisks creates the virtual disks for the VM.
func (*StepCreateDisks) Cleanup ¶
func (s *StepCreateDisks) Cleanup(multistep.StateBag)
func (*StepCreateDisks) Run ¶
func (s *StepCreateDisks) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
type StepCreateSnapshot ¶ added in v1.0.0
type StepCreateSnapshot struct {
SnapshotName *string
}
StepCreateSnapshot step creates a snapshot for the virtual machine after the build has been completed.
func (*StepCreateSnapshot) Cleanup ¶ added in v1.0.0
func (s *StepCreateSnapshot) Cleanup(multistep.StateBag)
func (*StepCreateSnapshot) Run ¶ added in v1.0.0
func (s *StepCreateSnapshot) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
type StepExport ¶
type StepExport struct {
Format string
SkipExport bool
VMName string
OVFToolOptions []string
OutputDir *string
}
This step exports a VM built on ESXi using ovftool
func (*StepExport) Cleanup ¶
func (s *StepExport) Cleanup(state multistep.StateBag)
func (*StepExport) Run ¶
func (s *StepExport) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
type StepHTTPIPDiscover ¶
type StepHTTPIPDiscover struct{}
Step to discover the http ip which guests use to reach the vm host To make sure the IP is set before boot command and http server steps
func (*StepHTTPIPDiscover) Cleanup ¶
func (*StepHTTPIPDiscover) Cleanup(multistep.StateBag)
func (*StepHTTPIPDiscover) Run ¶
func (s *StepHTTPIPDiscover) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
type StepOutputDir ¶
type StepOutputDir struct {
Force bool
OutputConfig *OutputConfig
VMName string
RemoteType string
// contains filtered or unexported fields
}
StepOutputDir sets up the output directory by creating it if it does not exist, deleting it if it does exist and we're forcing, and cleaning it up when we're done with it.
func (*StepOutputDir) Cleanup ¶
func (s *StepOutputDir) Cleanup(state multistep.StateBag)
func (*StepOutputDir) Run ¶
func (s *StepOutputDir) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
func (*StepOutputDir) SetOutputAndExportDirs ¶
func (s *StepOutputDir) SetOutputAndExportDirs(state multistep.StateBag) OutputDir
type StepPrepareTools ¶
func (*StepPrepareTools) Cleanup ¶
func (c *StepPrepareTools) Cleanup(multistep.StateBag)
func (*StepPrepareTools) Run ¶
func (c *StepPrepareTools) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
type StepRegister ¶
type StepRegister struct {
Format string
KeepRegistered bool
SkipExport bool
// contains filtered or unexported fields
}
func (*StepRegister) Cleanup ¶
func (s *StepRegister) Cleanup(state multistep.StateBag)
func (*StepRegister) Run ¶
func (s *StepRegister) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
type StepRemoteUpload ¶
stepRemoteUpload uploads some thing from the state bag to a remote driver (if it can) and stores that new remote path into the state bag.
func (*StepRemoteUpload) Cleanup ¶
func (s *StepRemoteUpload) Cleanup(state multistep.StateBag)
func (*StepRemoteUpload) Run ¶
func (s *StepRemoteUpload) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
type StepRun ¶
type StepRun struct {
DurationBeforeStop time.Duration
Headless bool
// contains filtered or unexported fields
}
StepRun runs the created virtual machine.
type StepShutdown ¶
type StepShutdown struct {
Command string
Timeout time.Duration
// Set this to true if we're testing
Testing bool
}
StepShutdown shuts down the machine. It first attempts to do so gracefully, but ultimately forcefully shuts it down if that fails.
func (*StepShutdown) Cleanup ¶
func (s *StepShutdown) Cleanup(state multistep.StateBag)
func (*StepShutdown) Run ¶
func (s *StepShutdown) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
type StepSuppressMessages ¶
type StepSuppressMessages struct{}
This step suppresses any messages that VMware product might show.
func (*StepSuppressMessages) Cleanup ¶
func (s *StepSuppressMessages) Cleanup(state multistep.StateBag)
func (*StepSuppressMessages) Run ¶
func (s *StepSuppressMessages) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
type StepUploadTools ¶
type StepUploadTools struct {
RemoteType string
ToolsUploadFlavor string
ToolsUploadPath string
Ctx interpolate.Context
}
func (*StepUploadTools) Cleanup ¶
func (c *StepUploadTools) Cleanup(multistep.StateBag)
func (*StepUploadTools) Run ¶
func (c *StepUploadTools) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
type StepUploadVMX ¶
type StepUploadVMX struct {
RemoteType string
}
StepUploadVMX upload the VMX to the remote host
func (StepUploadVMX) Cleanup ¶
func (StepUploadVMX) Cleanup(multistep.StateBag)
func (*StepUploadVMX) Run ¶
func (c *StepUploadVMX) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
type StepVNCBootCommand ¶
type StepVNCBootCommand struct {
Config bootcommand.VNCConfig
VMName string
Ctx interpolate.Context
Comm *communicator.Config
}
StepVNCBootCommand "types" the boot command into the VM over VNC.
func (*StepVNCBootCommand) Cleanup ¶
func (*StepVNCBootCommand) Cleanup(multistep.StateBag)
func (*StepVNCBootCommand) Run ¶
func (s *StepVNCBootCommand) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
type StepVNCConnect ¶
type StepVNCConnect struct {
VNCEnabled bool
VNCOverWebsocket bool
InsecureConnection bool
DriverConfig *DriverConfig
}
func (*StepVNCConnect) Cleanup ¶
func (s *StepVNCConnect) Cleanup(multistep.StateBag)
func (*StepVNCConnect) ConnectVNC ¶
func (s *StepVNCConnect) ConnectVNC(state multistep.StateBag) (*vnc.ClientConn, error)
func (*StepVNCConnect) ConnectVNCOverWebsocketClient ¶
func (s *StepVNCConnect) ConnectVNCOverWebsocketClient(state multistep.StateBag) (*vnc.ClientConn, error)
func (*StepVNCConnect) Run ¶
func (s *StepVNCConnect) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
type ToolsConfig ¶
type ToolsConfig struct {
// The flavor of VMware tools to upload into the virtual machine based on
// the guest operating system. Allowed values are `darwin` (macOS), `linux`,
// and `windows`. Default is empty and no version will be uploaded.
ToolsUploadFlavor string `mapstructure:"tools_upload_flavor" required:"false"`
// The path in the virtual machine to upload the VMware Tools. This only
// takes effect if `tools_upload_flavor` is non-empty. This is a
// [configuration template](/packer/docs/templates/legacy_json_templates/engine)
// that has a single valid variable, `Flavor`, which will be the value of
// `tools_upload_flavor` when the upload path is set to `{{.Flavor}}.iso`.
//
// ~> **Note:** This setting is not used when `remote_type` is `esx5`.
ToolsUploadPath string `mapstructure:"tools_upload_path" required:"false"`
// The local path on your machine to the VMware Tools ISO file.
//
// ~> **Note:** If not set, but the `tools_upload_flavor` is set, the plugin
// will load the VMware Tools from the product installation directory.
ToolsSourcePath string `mapstructure:"tools_source_path" required:"false"`
}
func (*ToolsConfig) Prepare ¶
func (c *ToolsConfig) Prepare(ctx *interpolate.Context) []error
type VMXConfig ¶
type VMXConfig struct {
// Key-value pairs that will be inserted into the virtual machine `.vmx`
// file **before** the virtual machine is started. This is useful for
// setting advanced properties that are not supported by the plugin.
//
// ~> **Note**: This option is intended for advanced users who understand
// the ramifications of making changes to the `.vmx` file. This option is
// not necessary for most users.
VMXData map[string]string `mapstructure:"vmx_data" required:"false"`
// Key-value pairs that will be inserted into the virtual machine `.vmx`
// file **after** the virtual machine is started. This is useful for setting
// advanced properties that are not supported by the plugin.
//
// ~> **Note**: This option is intended for advanced users who understand
// the ramifications of making changes to the `.vmx` file. This option is
// not necessary for most users.
VMXDataPost map[string]string `mapstructure:"vmx_data_post" required:"false"`
// Remove all network adapters from virtual machine `.vmx` file after the
// virtual machine build is complete. Defaults to `false`.
//
// ~> **Note**: This option is useful when building Vagrant boxes since
// Vagrant will create interfaces when provisioning a box.
VMXRemoveEthernet bool `mapstructure:"vmx_remove_ethernet_interfaces" required:"false"`
// The inventory display name for the virtual machine. If set, the value
// provided will override any value set in the `vmx_data` option or in the
// `.vmx` file. This option is useful if you are chaining builds and want to
// ensure that the display name of each step in the chain is unique.
VMXDisplayName string `mapstructure:"display_name" required:"false"`
}
type VNCAddressFinder ¶
type VmwareDriver ¶
type VmwareDriver struct {
/// These methods define paths that are utilized by the driver
/// A driver must overload these in order to point to the correct
/// files so that the address detection (ip and ethernet) machinery
/// works.
DhcpLeasesPath func(string) string
DhcpConfPath func(string) string
VmnetnatConfPath func(string) string
/// This method returns an object with the NetworkNameMapper interface
/// that maps network to device and vice-versa.
NetworkMapper func() (NetworkNameMapper, error)
}
This VmwareDriver is a base class that contains default methods that a Driver can use or implement themselves.
func (*VmwareDriver) Export ¶
func (d *VmwareDriver) Export(args []string) error
func (*VmwareDriver) GuestAddress ¶
func (d *VmwareDriver) GuestAddress(state multistep.StateBag) (string, error)
func (*VmwareDriver) HostAddress ¶
func (d *VmwareDriver) HostAddress(state multistep.StateBag) (string, error)
func (*VmwareDriver) HostIP ¶
func (d *VmwareDriver) HostIP(state multistep.StateBag) (string, error)
func (*VmwareDriver) PotentialGuestIP ¶
func (d *VmwareDriver) PotentialGuestIP(state multistep.StateBag) ([]string, error)
func (*VmwareDriver) VerifyOvfTool ¶
func (d *VmwareDriver) VerifyOvfTool(SkipExport, _ bool) error
type Workstation10Driver ¶
type Workstation10Driver struct {
Workstation9Driver
}
func (*Workstation10Driver) Clone ¶
func (d *Workstation10Driver) Clone(dst, src string, linked bool, snapshot string) error
func (*Workstation10Driver) GetVmwareDriver ¶
func (d *Workstation10Driver) GetVmwareDriver() VmwareDriver
func (*Workstation10Driver) Verify ¶
func (d *Workstation10Driver) Verify() error
type Workstation9Driver ¶
type Workstation9Driver struct {
VmwareDriver
AppPath string
VdiskManagerPath string
VmrunPath string
// SSHConfig are the SSH settings for the Fusion VM
SSHConfig *SSHConfig
}
Workstation9Driver is a driver that can run VMware Workstation 9
func (*Workstation9Driver) Clone ¶
func (d *Workstation9Driver) Clone(dst, src string, linked bool, snapshot string) error
func (*Workstation9Driver) CommHost ¶
func (d *Workstation9Driver) CommHost(state multistep.StateBag) (string, error)
func (*Workstation9Driver) CompactDisk ¶
func (d *Workstation9Driver) CompactDisk(diskPath string) error
func (*Workstation9Driver) CreateDisk ¶
func (*Workstation9Driver) CreateSnapshot ¶ added in v1.0.0
func (d *Workstation9Driver) CreateSnapshot(vmxPath string, snapshotName string) error
func (*Workstation9Driver) GetVmwareDriver ¶
func (d *Workstation9Driver) GetVmwareDriver() VmwareDriver
func (*Workstation9Driver) IsRunning ¶
func (d *Workstation9Driver) IsRunning(vmxPath string) (bool, error)
func (*Workstation9Driver) Start ¶
func (d *Workstation9Driver) Start(vmxPath string, headless bool) error
func (*Workstation9Driver) Stop ¶
func (d *Workstation9Driver) Stop(vmxPath string) error
func (*Workstation9Driver) SuppressMessages ¶
func (d *Workstation9Driver) SuppressMessages(vmxPath string) error
func (*Workstation9Driver) ToolsInstall ¶
func (d *Workstation9Driver) ToolsInstall() error
func (*Workstation9Driver) ToolsIsoPath ¶
func (d *Workstation9Driver) ToolsIsoPath(flavor string) string
func (*Workstation9Driver) Verify ¶
func (d *Workstation9Driver) Verify() error
Source Files
¶
- artifact.go
- disk_config.go
- driver.go
- driver_config.go
- driver_esx5.go
- driver_fusion5.go
- driver_fusion6.go
- driver_mock.go
- driver_parser.go
- driver_player5.go
- driver_player6.go
- driver_player_unix.go
- driver_workstation10.go
- driver_workstation9.go
- driver_workstation_unix.go
- export_config.go
- host_ip_ifconfig.go
- hw_config.go
- output_config.go
- output_dir.go
- output_dir_local.go
- remote_driver.go
- remote_driver_mock.go
- run_config.go
- ssh.go
- ssh_config.go
- step_clean_files.go
- step_clean_vmx.go
- step_compact_disk.go
- step_configure_vmx.go
- step_configure_vnc.go
- step_create_disks.go
- step_create_snapshot.go
- step_export.go
- step_http_ip_discover.go
- step_output_dir.go
- step_prepare_tools.go
- step_register.go
- step_remote_upload.go
- step_run.go
- step_shutdown.go
- step_suppress_messages.go
- step_upload_tools.go
- step_upload_vmx.go
- step_vnc_boot_command.go
- step_vnc_connect.go
- tools_config.go
- vmx.go
- vmx_config.go