common

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2018 License: MPL-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SwitchTypeInternal = "Internal"
	SwitchTypePrivate  = "Private"
	DefaultSwitchType  = SwitchTypeInternal
)
View Source
const BuilderId = "MSOpenTech.hyperv"

This is the common builder ID to all of these artifacts.

View Source
const (
	FloppyFileName = "assets.vfd"
)
View Source
const (
	SleepSeconds = 10
)

Variables

This section is empty.

Functions

func CommHost

func CommHost(state multistep.StateBag) (string, error)

func NewArtifact

func NewArtifact(dir string) (packer.Artifact, error)

NewArtifact returns a hyperv artifact containing the files in the given directory.

func SSHConfigFunc

func SSHConfigFunc(config *SSHConfig) func(multistep.StateBag) (*gossh.ClientConfig, error)

Types

type Driver

type Driver interface {

	// Checks if the VM named is running.
	IsRunning(string) (bool, error)

	// Checks if the VM named is off.
	IsOff(string) (bool, error)

	//How long has VM been on
	Uptime(vmName string) (uint64, error)

	// Start starts a VM specified by the name given.
	Start(string) error

	// Stop stops a VM specified by the name given.
	Stop(string) error

	// Verify checks to make sure that this driver should function
	// properly. If there is any indication the driver can't function,
	// this will return an error.
	Verify() error

	// Finds the MAC address of the NIC nic0
	Mac(string) (string, error)

	// Finds the IP address of a VM connected that uses DHCP by its MAC address
	IpAddress(string) (string, error)

	// Finds the hostname for the ip address
	GetHostName(string) (string, error)

	// Finds the IP address of a host adapter connected to switch
	GetHostAdapterIpAddressForSwitch(string) (string, error)

	// Type scan codes to virtual keyboard of vm
	TypeScanCodes(string, string) error

	//Get the ip address for network adaptor
	GetVirtualMachineNetworkAdapterAddress(string) (string, error)

	//Set the vlan to use for switch
	SetNetworkAdapterVlanId(string, string) error

	//Set the vlan to use for machine
	SetVirtualMachineVlanId(string, string) error

	SetVmNetworkAdapterMacAddress(string, string) error

	UntagVirtualMachineNetworkAdapterVlan(string, string) error

	CreateExternalVirtualSwitch(string, string) error

	GetVirtualMachineSwitchName(string) (string, error)

	ConnectVirtualMachineNetworkAdapterToSwitch(string, string) error

	CreateVirtualSwitch(string, string) (bool, error)

	DeleteVirtualSwitch(string) error

	CreateVirtualMachine(string, string, string, string, int64, int64, int64, string, uint, bool, bool) error

	AddVirtualMachineHardDrive(string, string, string, int64, int64, string) error

	CloneVirtualMachine(string, string, string, bool, string, string, string, int64, string) error

	DeleteVirtualMachine(string) error

	GetVirtualMachineGeneration(string) (uint, error)

	SetVirtualMachineCpuCount(string, uint) error

	SetVirtualMachineMacSpoofing(string, bool) error

	SetVirtualMachineDynamicMemory(string, bool) error

	SetVirtualMachineSecureBoot(string, bool, string) error

	SetVirtualMachineVirtualizationExtensions(string, bool) error

	EnableVirtualMachineIntegrationService(string, string) error

	ExportVirtualMachine(string, string) error

	CompactDisks(string, string) error

	CopyExportedVirtualMachine(string, string, string, string) error

	RestartVirtualMachine(string) error

	CreateDvdDrive(string, string, uint) (uint, uint, error)

	MountDvdDrive(string, string, uint, uint) error

	SetBootDvdDrive(string, uint, uint, uint) error

	UnmountDvdDrive(string, uint, uint) error

	DeleteDvdDrive(string, uint, uint) error

	MountFloppyDrive(string, string) error

	UnmountFloppyDrive(string) error

	// Connect connects to a VM specified by the name given.
	Connect(string) (context.CancelFunc, error)

	// Disconnect disconnects to a VM specified by the context cancel function.
	Disconnect(context.CancelFunc)
}

A driver is able to talk to HyperV and perform certain operations with it. Some of the operations on here may seem overly specific, but they were built specifically in mind to handle features of the HyperV builder for Packer, and to abstract differences in versions out of the builder steps, so sometimes the methods are extremely specific.

func NewHypervPS4Driver

func NewHypervPS4Driver() (Driver, error)

type DriverMock added in v1.1.3

type DriverMock struct {
	IsRunning_Called bool
	IsRunning_VmName string
	IsRunning_Return bool
	IsRunning_Err    error

	IsOff_Called bool
	IsOff_VmName string
	IsOff_Return bool
	IsOff_Err    error

	Uptime_Called bool
	Uptime_VmName string
	Uptime_Return uint64
	Uptime_Err    error

	Start_Called bool
	Start_VmName string
	Start_Err    error

	Stop_Called bool
	Stop_VmName string
	Stop_Err    error

	Verify_Called bool
	Verify_Err    error

	Mac_Called bool
	Mac_VmName string
	Mac_Return string
	Mac_Err    error

	IpAddress_Called bool
	IpAddress_Mac    string
	IpAddress_Return string
	IpAddress_Err    error

	GetHostName_Called bool
	GetHostName_Ip     string
	GetHostName_Return string
	GetHostName_Err    error

	GetVirtualMachineGeneration_Called bool
	GetVirtualMachineGeneration_VmName string
	GetVirtualMachineGeneration_Return uint
	GetVirtualMachineGeneration_Err    error

	GetHostAdapterIpAddressForSwitch_Called     bool
	GetHostAdapterIpAddressForSwitch_SwitchName string
	GetHostAdapterIpAddressForSwitch_Return     string
	GetHostAdapterIpAddressForSwitch_Err        error

	TypeScanCodes_Called    bool
	TypeScanCodes_VmName    string
	TypeScanCodes_ScanCodes string
	TypeScanCodes_Err       error

	GetVirtualMachineNetworkAdapterAddress_Called bool
	GetVirtualMachineNetworkAdapterAddress_VmName string
	GetVirtualMachineNetworkAdapterAddress_Return string
	GetVirtualMachineNetworkAdapterAddress_Err    error

	SetNetworkAdapterVlanId_Called     bool
	SetNetworkAdapterVlanId_SwitchName string
	SetNetworkAdapterVlanId_VlanId     string
	SetNetworkAdapterVlanId_Err        error

	SetVmNetworkAdapterMacAddress_Called bool
	SetVmNetworkAdapterMacAddress_VmName string
	SetVmNetworkAdapterMacAddress_Mac    string
	SetVmNetworkAdapterMacAddress_Err    error

	SetVirtualMachineVlanId_Called bool
	SetVirtualMachineVlanId_VmName string
	SetVirtualMachineVlanId_VlanId string
	SetVirtualMachineVlanId_Err    error

	UntagVirtualMachineNetworkAdapterVlan_Called     bool
	UntagVirtualMachineNetworkAdapterVlan_VmName     string
	UntagVirtualMachineNetworkAdapterVlan_SwitchName string
	UntagVirtualMachineNetworkAdapterVlan_Err        error

	CreateExternalVirtualSwitch_Called     bool
	CreateExternalVirtualSwitch_VmName     string
	CreateExternalVirtualSwitch_SwitchName string
	CreateExternalVirtualSwitch_Err        error

	GetVirtualMachineSwitchName_Called bool
	GetVirtualMachineSwitchName_VmName string
	GetVirtualMachineSwitchName_Return string
	GetVirtualMachineSwitchName_Err    error

	ConnectVirtualMachineNetworkAdapterToSwitch_Called     bool
	ConnectVirtualMachineNetworkAdapterToSwitch_VmName     string
	ConnectVirtualMachineNetworkAdapterToSwitch_SwitchName string
	ConnectVirtualMachineNetworkAdapterToSwitch_Err        error

	DeleteVirtualSwitch_Called     bool
	DeleteVirtualSwitch_SwitchName string
	DeleteVirtualSwitch_Err        error

	CreateVirtualSwitch_Called     bool
	CreateVirtualSwitch_SwitchName string
	CreateVirtualSwitch_SwitchType string
	CreateVirtualSwitch_Return     bool
	CreateVirtualSwitch_Err        error

	AddVirtualMachineHardDrive_Called         bool
	AddVirtualMachineHardDrive_VmName         string
	AddVirtualMachineHardDrive_VhdFile        string
	AddVirtualMachineHardDrive_VhdName        string
	AddVirtualMachineHardDrive_VhdSizeBytes   int64
	AddVirtualMachineHardDrive_VhdBlockSize   int64
	AddVirtualMachineHardDrive_ControllerType string
	AddVirtualMachineHardDrive_Err            error

	CreateVirtualMachine_Called           bool
	CreateVirtualMachine_VmName           string
	CreateVirtualMachine_Path             string
	CreateVirtualMachine_HarddrivePath    string
	CreateVirtualMachine_VhdPath          string
	CreateVirtualMachine_Ram              int64
	CreateVirtualMachine_DiskSize         int64
	CreateVirtualMachine_DiskBlockSize    int64
	CreateVirtualMachine_SwitchName       string
	CreateVirtualMachine_Generation       uint
	CreateVirtualMachine_DifferentialDisk bool
	CreateVirtualMachine_FixedVHD         bool
	CreateVirtualMachine_Err              error

	CloneVirtualMachine_Called                bool
	CloneVirtualMachine_CloneFromVmxcPath     string
	CloneVirtualMachine_CloneFromVmName       string
	CloneVirtualMachine_CloneFromSnapshotName string
	CloneVirtualMachine_CloneAllSnapshots     bool
	CloneVirtualMachine_VmName                string
	CloneVirtualMachine_Path                  string
	CloneVirtualMachine_HarddrivePath         string
	CloneVirtualMachine_Ram                   int64
	CloneVirtualMachine_SwitchName            string
	CloneVirtualMachine_Err                   error

	DeleteVirtualMachine_Called bool
	DeleteVirtualMachine_VmName string
	DeleteVirtualMachine_Err    error

	SetVirtualMachineCpuCount_Called bool
	SetVirtualMachineCpuCount_VmName string
	SetVirtualMachineCpuCount_Cpu    uint
	SetVirtualMachineCpuCount_Err    error

	SetVirtualMachineMacSpoofing_Called bool
	SetVirtualMachineMacSpoofing_VmName string
	SetVirtualMachineMacSpoofing_Enable bool
	SetVirtualMachineMacSpoofing_Err    error

	SetVirtualMachineDynamicMemory_Called bool
	SetVirtualMachineDynamicMemory_VmName string
	SetVirtualMachineDynamicMemory_Enable bool
	SetVirtualMachineDynamicMemory_Err    error

	SetVirtualMachineSecureBoot_Called       bool
	SetVirtualMachineSecureBoot_VmName       string
	SetVirtualMachineSecureBoot_TemplateName string
	SetVirtualMachineSecureBoot_Enable       bool
	SetVirtualMachineSecureBoot_Err          error

	SetVirtualMachineVirtualizationExtensions_Called bool
	SetVirtualMachineVirtualizationExtensions_VmName string
	SetVirtualMachineVirtualizationExtensions_Enable bool
	SetVirtualMachineVirtualizationExtensions_Err    error

	EnableVirtualMachineIntegrationService_Called                 bool
	EnableVirtualMachineIntegrationService_VmName                 string
	EnableVirtualMachineIntegrationService_IntegrationServiceName string
	EnableVirtualMachineIntegrationService_Err                    error

	ExportVirtualMachine_Called bool
	ExportVirtualMachine_VmName string
	ExportVirtualMachine_Path   string
	ExportVirtualMachine_Err    error

	CompactDisks_Called  bool
	CompactDisks_ExpPath string
	CompactDisks_VhdDir  string
	CompactDisks_Err     error

	CopyExportedVirtualMachine_Called     bool
	CopyExportedVirtualMachine_ExpPath    string
	CopyExportedVirtualMachine_OutputPath string
	CopyExportedVirtualMachine_VhdDir     string
	CopyExportedVirtualMachine_VmDir      string
	CopyExportedVirtualMachine_Err        error

	RestartVirtualMachine_Called bool
	RestartVirtualMachine_VmName string
	RestartVirtualMachine_Err    error

	CreateDvdDrive_Called             bool
	CreateDvdDrive_VmName             string
	CreateDvdDrive_IsoPath            string
	CreateDvdDrive_Generation         uint
	CreateDvdDrive_ControllerNumber   uint
	CreateDvdDrive_ControllerLocation uint
	CreateDvdDrive_Err                error

	MountDvdDrive_Called             bool
	MountDvdDrive_VmName             string
	MountDvdDrive_Path               string
	MountDvdDrive_ControllerNumber   uint
	MountDvdDrive_ControllerLocation uint
	MountDvdDrive_Err                error

	SetBootDvdDrive_Called             bool
	SetBootDvdDrive_VmName             string
	SetBootDvdDrive_ControllerNumber   uint
	SetBootDvdDrive_ControllerLocation uint
	SetBootDvdDrive_Generation         uint
	SetBootDvdDrive_Err                error

	UnmountDvdDrive_Called             bool
	UnmountDvdDrive_VmName             string
	UnmountDvdDrive_ControllerNumber   uint
	UnmountDvdDrive_ControllerLocation uint
	UnmountDvdDrive_Err                error

	DeleteDvdDrive_Called             bool
	DeleteDvdDrive_VmName             string
	DeleteDvdDrive_ControllerNumber   uint
	DeleteDvdDrive_ControllerLocation uint
	DeleteDvdDrive_Err                error

	MountFloppyDrive_Called bool
	MountFloppyDrive_VmName string
	MountFloppyDrive_Path   string
	MountFloppyDrive_Err    error

	UnmountFloppyDrive_Called bool
	UnmountFloppyDrive_VmName string
	UnmountFloppyDrive_Err    error

	Connect_Called bool
	Connect_VmName string
	Connect_Cancel context.CancelFunc
	Connect_Err    error

	Disconnect_Called bool
	Disconnect_Cancel context.CancelFunc
}

func (*DriverMock) AddVirtualMachineHardDrive added in v1.1.3

func (d *DriverMock) AddVirtualMachineHardDrive(vmName string, vhdFile string, vhdName string, vhdSizeBytes int64, vhdDiskBlockSize int64, controllerType string) error

func (*DriverMock) CloneVirtualMachine added in v1.1.3

func (d *DriverMock) CloneVirtualMachine(cloneFromVmxcPath string, cloneFromVmName string, cloneFromSnapshotName string, cloneAllSnapshots bool, vmName string, path string, harddrivePath string, ram int64, switchName string) error

func (*DriverMock) CompactDisks added in v1.1.3

func (d *DriverMock) CompactDisks(expPath string, vhdDir string) error

func (*DriverMock) Connect added in v1.2.4

func (d *DriverMock) Connect(vmName string) (context.CancelFunc, error)

func (*DriverMock) ConnectVirtualMachineNetworkAdapterToSwitch added in v1.1.3

func (d *DriverMock) ConnectVirtualMachineNetworkAdapterToSwitch(vmName string, switchName string) error

func (*DriverMock) CopyExportedVirtualMachine added in v1.1.3

func (d *DriverMock) CopyExportedVirtualMachine(expPath string, outputPath string, vhdDir string, vmDir string) error

func (*DriverMock) CreateDvdDrive added in v1.1.3

func (d *DriverMock) CreateDvdDrive(vmName string, isoPath string, generation uint) (uint, uint, error)

func (*DriverMock) CreateExternalVirtualSwitch added in v1.1.3

func (d *DriverMock) CreateExternalVirtualSwitch(vmName string, switchName string) error

func (*DriverMock) CreateVirtualMachine added in v1.1.3

func (d *DriverMock) CreateVirtualMachine(vmName string, path string, harddrivePath string, vhdPath string, ram int64, diskSize int64, diskBlockSize int64, switchName string, generation uint, diffDisks bool, fixedVHD bool) error

func (*DriverMock) CreateVirtualSwitch added in v1.1.3

func (d *DriverMock) CreateVirtualSwitch(switchName string, switchType string) (bool, error)

func (*DriverMock) DeleteDvdDrive added in v1.1.3

func (d *DriverMock) DeleteDvdDrive(vmName string, controllerNumber uint, controllerLocation uint) error

func (*DriverMock) DeleteVirtualMachine added in v1.1.3

func (d *DriverMock) DeleteVirtualMachine(vmName string) error

func (*DriverMock) DeleteVirtualSwitch added in v1.1.3

func (d *DriverMock) DeleteVirtualSwitch(switchName string) error

func (*DriverMock) Disconnect added in v1.2.4

func (d *DriverMock) Disconnect(cancel context.CancelFunc)

func (*DriverMock) EnableVirtualMachineIntegrationService added in v1.1.3

func (d *DriverMock) EnableVirtualMachineIntegrationService(vmName string, integrationServiceName string) error

func (*DriverMock) ExportVirtualMachine added in v1.1.3

func (d *DriverMock) ExportVirtualMachine(vmName string, path string) error

func (*DriverMock) GetHostAdapterIpAddressForSwitch added in v1.1.3

func (d *DriverMock) GetHostAdapterIpAddressForSwitch(switchName string) (string, error)

func (*DriverMock) GetHostName added in v1.1.3

func (d *DriverMock) GetHostName(ip string) (string, error)

func (*DriverMock) GetVirtualMachineGeneration added in v1.1.3

func (d *DriverMock) GetVirtualMachineGeneration(vmName string) (uint, error)

func (*DriverMock) GetVirtualMachineNetworkAdapterAddress added in v1.1.3

func (d *DriverMock) GetVirtualMachineNetworkAdapterAddress(vmName string) (string, error)

func (*DriverMock) GetVirtualMachineSwitchName added in v1.1.3

func (d *DriverMock) GetVirtualMachineSwitchName(vmName string) (string, error)

func (*DriverMock) IpAddress added in v1.1.3

func (d *DriverMock) IpAddress(mac string) (string, error)

func (*DriverMock) IsOff added in v1.1.3

func (d *DriverMock) IsOff(vmName string) (bool, error)

func (*DriverMock) IsRunning added in v1.1.3

func (d *DriverMock) IsRunning(vmName string) (bool, error)

func (*DriverMock) Mac added in v1.1.3

func (d *DriverMock) Mac(vmName string) (string, error)

func (*DriverMock) MountDvdDrive added in v1.1.3

func (d *DriverMock) MountDvdDrive(vmName string, path string, controllerNumber uint, controllerLocation uint) error

func (*DriverMock) MountFloppyDrive added in v1.1.3

func (d *DriverMock) MountFloppyDrive(vmName string, path string) error

func (*DriverMock) RestartVirtualMachine added in v1.1.3

func (d *DriverMock) RestartVirtualMachine(vmName string) error

func (*DriverMock) SetBootDvdDrive added in v1.1.3

func (d *DriverMock) SetBootDvdDrive(vmName string, controllerNumber uint, controllerLocation uint, generation uint) error

func (*DriverMock) SetNetworkAdapterVlanId added in v1.1.3

func (d *DriverMock) SetNetworkAdapterVlanId(switchName string, vlanId string) error

func (*DriverMock) SetVirtualMachineCpuCount added in v1.1.3

func (d *DriverMock) SetVirtualMachineCpuCount(vmName string, cpu uint) error

func (*DriverMock) SetVirtualMachineDynamicMemory added in v1.1.3

func (d *DriverMock) SetVirtualMachineDynamicMemory(vmName string, enable bool) error

func (*DriverMock) SetVirtualMachineMacSpoofing added in v1.1.3

func (d *DriverMock) SetVirtualMachineMacSpoofing(vmName string, enable bool) error

func (*DriverMock) SetVirtualMachineSecureBoot added in v1.1.3

func (d *DriverMock) SetVirtualMachineSecureBoot(vmName string, enable bool, templateName string) error

func (*DriverMock) SetVirtualMachineVirtualizationExtensions added in v1.1.3

func (d *DriverMock) SetVirtualMachineVirtualizationExtensions(vmName string, enable bool) error

func (*DriverMock) SetVirtualMachineVlanId added in v1.1.3

func (d *DriverMock) SetVirtualMachineVlanId(vmName string, vlanId string) error

func (*DriverMock) SetVmNetworkAdapterMacAddress added in v1.2.0

func (d *DriverMock) SetVmNetworkAdapterMacAddress(vmName string, mac string) error

func (*DriverMock) Start added in v1.1.3

func (d *DriverMock) Start(vmName string) error

func (*DriverMock) Stop added in v1.1.3

func (d *DriverMock) Stop(vmName string) error

func (*DriverMock) TypeScanCodes added in v1.1.3

func (d *DriverMock) TypeScanCodes(vmName string, scanCodes string) error

func (*DriverMock) UnmountDvdDrive added in v1.1.3

func (d *DriverMock) UnmountDvdDrive(vmName string, controllerNumber uint, controllerLocation uint) error

func (*DriverMock) UnmountFloppyDrive added in v1.1.3

func (d *DriverMock) UnmountFloppyDrive(vmName string) error

func (*DriverMock) UntagVirtualMachineNetworkAdapterVlan added in v1.1.3

func (d *DriverMock) UntagVirtualMachineNetworkAdapterVlan(vmName string, switchName string) error

func (*DriverMock) Uptime added in v1.1.3

func (d *DriverMock) Uptime(vmName string) (uint64, error)

func (*DriverMock) Verify added in v1.1.3

func (d *DriverMock) Verify() error

type DvdControllerProperties

type DvdControllerProperties struct {
	ControllerNumber   uint
	ControllerLocation uint
	Existing           bool
}

type HypervPS4Driver

type HypervPS4Driver struct {
}

func (*HypervPS4Driver) AddVirtualMachineHardDrive added in v1.1.2

func (d *HypervPS4Driver) AddVirtualMachineHardDrive(vmName string, vhdFile string, vhdName string, vhdSizeBytes int64, diskBlockSize int64, controllerType string) error

func (*HypervPS4Driver) CloneVirtualMachine added in v1.1.1

func (d *HypervPS4Driver) CloneVirtualMachine(cloneFromVmxcPath string, cloneFromVmName string, cloneFromSnapshotName string, cloneAllSnapshots bool, vmName string, path string, harddrivePath string, ram int64, switchName string) error

func (*HypervPS4Driver) CompactDisks

func (d *HypervPS4Driver) CompactDisks(expPath string, vhdDir string) error

func (*HypervPS4Driver) Connect added in v1.2.4

func (d *HypervPS4Driver) Connect(vmName string) (context.CancelFunc, error)

Connect connects to a VM specified by the name given.

func (*HypervPS4Driver) ConnectVirtualMachineNetworkAdapterToSwitch

func (d *HypervPS4Driver) ConnectVirtualMachineNetworkAdapterToSwitch(vmName string, switchName string) error

func (*HypervPS4Driver) CopyExportedVirtualMachine

func (d *HypervPS4Driver) CopyExportedVirtualMachine(expPath string, outputPath string, vhdDir string, vmDir string) error

func (*HypervPS4Driver) CreateDvdDrive

func (d *HypervPS4Driver) CreateDvdDrive(vmName string, isoPath string, generation uint) (uint, uint, error)

func (*HypervPS4Driver) CreateExternalVirtualSwitch

func (d *HypervPS4Driver) CreateExternalVirtualSwitch(vmName string, switchName string) error

func (*HypervPS4Driver) CreateVirtualMachine

func (d *HypervPS4Driver) CreateVirtualMachine(vmName string, path string, harddrivePath string, vhdPath string, ram int64, diskSize int64, diskBlockSize int64, switchName string, generation uint, diffDisks bool, fixedVHD bool) error

func (*HypervPS4Driver) CreateVirtualSwitch

func (d *HypervPS4Driver) CreateVirtualSwitch(switchName string, switchType string) (bool, error)

func (*HypervPS4Driver) DeleteDvdDrive

func (d *HypervPS4Driver) DeleteDvdDrive(vmName string, controllerNumber uint, controllerLocation uint) error

func (*HypervPS4Driver) DeleteVirtualMachine

func (d *HypervPS4Driver) DeleteVirtualMachine(vmName string) error

func (*HypervPS4Driver) DeleteVirtualSwitch

func (d *HypervPS4Driver) DeleteVirtualSwitch(switchName string) error

func (*HypervPS4Driver) Disconnect added in v1.2.4

func (d *HypervPS4Driver) Disconnect(cancel context.CancelFunc)

Disconnect disconnects to a VM specified by calling the context cancel function returned from Connect.

func (*HypervPS4Driver) EnableVirtualMachineIntegrationService

func (d *HypervPS4Driver) EnableVirtualMachineIntegrationService(vmName string, integrationServiceName string) error

func (*HypervPS4Driver) ExportVirtualMachine

func (d *HypervPS4Driver) ExportVirtualMachine(vmName string, path string) error

func (*HypervPS4Driver) GetHostAdapterIpAddressForSwitch

func (d *HypervPS4Driver) GetHostAdapterIpAddressForSwitch(switchName string) (string, error)

Finds the IP address of a host adapter connected to switch

func (*HypervPS4Driver) GetHostName

func (d *HypervPS4Driver) GetHostName(ip string) (string, error)

Get host name from ip address

func (*HypervPS4Driver) GetVirtualMachineGeneration added in v1.1.1

func (d *HypervPS4Driver) GetVirtualMachineGeneration(vmName string) (uint, error)

func (*HypervPS4Driver) GetVirtualMachineNetworkAdapterAddress

func (d *HypervPS4Driver) GetVirtualMachineNetworkAdapterAddress(vmName string) (string, error)

Get network adapter address

func (*HypervPS4Driver) GetVirtualMachineSwitchName

func (d *HypervPS4Driver) GetVirtualMachineSwitchName(vmName string) (string, error)

func (*HypervPS4Driver) IpAddress

func (d *HypervPS4Driver) IpAddress(mac string) (string, error)

Get ip address for mac address.

func (*HypervPS4Driver) IsOff

func (d *HypervPS4Driver) IsOff(vmName string) (bool, error)

func (*HypervPS4Driver) IsRunning

func (d *HypervPS4Driver) IsRunning(vmName string) (bool, error)

func (*HypervPS4Driver) Mac

func (d *HypervPS4Driver) Mac(vmName string) (string, error)

Get mac address for VM.

func (*HypervPS4Driver) MountDvdDrive

func (d *HypervPS4Driver) MountDvdDrive(vmName string, path string, controllerNumber uint, controllerLocation uint) error

func (*HypervPS4Driver) MountFloppyDrive

func (d *HypervPS4Driver) MountFloppyDrive(vmName string, path string) error

func (*HypervPS4Driver) RestartVirtualMachine

func (d *HypervPS4Driver) RestartVirtualMachine(vmName string) error

func (*HypervPS4Driver) SetBootDvdDrive

func (d *HypervPS4Driver) SetBootDvdDrive(vmName string, controllerNumber uint, controllerLocation uint, generation uint) error

func (*HypervPS4Driver) SetNetworkAdapterVlanId

func (d *HypervPS4Driver) SetNetworkAdapterVlanId(switchName string, vlanId string) error

Set the vlan to use for switch

func (*HypervPS4Driver) SetVirtualMachineCpuCount

func (d *HypervPS4Driver) SetVirtualMachineCpuCount(vmName string, cpu uint) error

func (*HypervPS4Driver) SetVirtualMachineDynamicMemory

func (d *HypervPS4Driver) SetVirtualMachineDynamicMemory(vmName string, enable bool) error

func (*HypervPS4Driver) SetVirtualMachineMacSpoofing

func (d *HypervPS4Driver) SetVirtualMachineMacSpoofing(vmName string, enable bool) error

func (*HypervPS4Driver) SetVirtualMachineSecureBoot

func (d *HypervPS4Driver) SetVirtualMachineSecureBoot(vmName string, enable bool, templateName string) error

func (*HypervPS4Driver) SetVirtualMachineVirtualizationExtensions

func (d *HypervPS4Driver) SetVirtualMachineVirtualizationExtensions(vmName string, enable bool) error

func (*HypervPS4Driver) SetVirtualMachineVlanId

func (d *HypervPS4Driver) SetVirtualMachineVlanId(vmName string, vlanId string) error

Set the vlan to use for machine

func (*HypervPS4Driver) SetVmNetworkAdapterMacAddress added in v1.2.0

func (d *HypervPS4Driver) SetVmNetworkAdapterMacAddress(vmName string, mac string) error

func (*HypervPS4Driver) Start

func (d *HypervPS4Driver) Start(vmName string) error

Start starts a VM specified by the name given.

func (*HypervPS4Driver) Stop

func (d *HypervPS4Driver) Stop(vmName string) error

Stop stops a VM specified by the name given.

func (*HypervPS4Driver) TypeScanCodes

func (d *HypervPS4Driver) TypeScanCodes(vmName string, scanCodes string) error

Type scan codes to virtual keyboard of vm

func (*HypervPS4Driver) UnmountDvdDrive

func (d *HypervPS4Driver) UnmountDvdDrive(vmName string, controllerNumber uint, controllerLocation uint) error

func (*HypervPS4Driver) UnmountFloppyDrive

func (d *HypervPS4Driver) UnmountFloppyDrive(vmName string) error

func (*HypervPS4Driver) UntagVirtualMachineNetworkAdapterVlan

func (d *HypervPS4Driver) UntagVirtualMachineNetworkAdapterVlan(vmName string, switchName string) error

func (*HypervPS4Driver) Uptime

func (d *HypervPS4Driver) Uptime(vmName string) (uint64, error)

func (*HypervPS4Driver) Verify

func (d *HypervPS4Driver) Verify() error

type OutputConfig

type OutputConfig struct {
	OutputDir string `mapstructure:"output_directory"`
}

func (*OutputConfig) Prepare

func (c *OutputConfig) Prepare(ctx *interpolate.Context, pc *common.PackerConfig) []error

type SSHConfig

type SSHConfig struct {
	Comm communicator.Config `mapstructure:",squash"`
}

func (*SSHConfig) Prepare

func (c *SSHConfig) Prepare(ctx *interpolate.Context) []error

type ShutdownConfig

type ShutdownConfig struct {
	ShutdownCommand    string `mapstructure:"shutdown_command"`
	RawShutdownTimeout string `mapstructure:"shutdown_timeout"`

	ShutdownTimeout time.Duration ``
}

func (*ShutdownConfig) Prepare

func (c *ShutdownConfig) Prepare(ctx *interpolate.Context) []error

type StepCloneVM added in v1.1.1

type StepCloneVM struct {
	CloneFromVMXCPath              string
	CloneFromVMName                string
	CloneFromSnapshotName          string
	CloneAllSnapshots              bool
	VMName                         string
	SwitchName                     string
	RamSize                        uint
	Cpu                            uint
	EnableMacSpoofing              bool
	EnableDynamicMemory            bool
	EnableSecureBoot               bool
	SecureBootTemplate             string
	EnableVirtualizationExtensions bool
	MacAddress                     string
}

This step clones an existing virtual machine.

Produces:

VMName string - The name of the VM

func (*StepCloneVM) Cleanup added in v1.1.1

func (s *StepCloneVM) Cleanup(state multistep.StateBag)

func (*StepCloneVM) Run added in v1.1.1

type StepConfigureIp

type StepConfigureIp struct {
}

func (*StepConfigureIp) Cleanup

func (s *StepConfigureIp) Cleanup(state multistep.StateBag)

func (*StepConfigureIp) Run

type StepConfigureVlan

type StepConfigureVlan struct {
	VlanId       string
	SwitchVlanId string
}

func (*StepConfigureVlan) Cleanup

func (s *StepConfigureVlan) Cleanup(state multistep.StateBag)

func (*StepConfigureVlan) Run

type StepCreateExternalSwitch

type StepCreateExternalSwitch struct {
	SwitchName string
	// contains filtered or unexported fields
}

This step creates switch for VM.

Produces:

SwitchName string - The name of the Switch

func (*StepCreateExternalSwitch) Cleanup

func (s *StepCreateExternalSwitch) Cleanup(state multistep.StateBag)

func (*StepCreateExternalSwitch) Run

type StepCreateSwitch

type StepCreateSwitch struct {
	// Specifies the name of the switch to be created.
	SwitchName string
	// Specifies the type of the switch to be created. Allowed values are Internal and Private. To create an External
	// virtual switch, specify either the NetAdapterInterfaceDescription or the NetAdapterName parameter, which
	// implicitly set the type of the virtual switch to External.
	SwitchType string
	// Specifies the name of the network adapter to be bound to the switch to be created.
	NetAdapterName string
	// Specifies the interface description of the network adapter to be bound to the switch to be created.
	NetAdapterInterfaceDescription string
	// contains filtered or unexported fields
}

This step creates switch for VM.

Produces:

SwitchName string - The name of the Switch

func (*StepCreateSwitch) Cleanup

func (s *StepCreateSwitch) Cleanup(state multistep.StateBag)

func (*StepCreateSwitch) Run

type StepCreateTempDir

type StepCreateTempDir struct {
	// The user-supplied root directories into which we create subdirectories.
	TempPath    string
	VhdTempPath string
	// contains filtered or unexported fields
}

func (*StepCreateTempDir) Cleanup

func (s *StepCreateTempDir) Cleanup(state multistep.StateBag)

func (*StepCreateTempDir) Run

type StepCreateVM

type StepCreateVM struct {
	VMName                         string
	SwitchName                     string
	HarddrivePath                  string
	RamSize                        uint
	DiskSize                       uint
	DiskBlockSize                  uint
	Generation                     uint
	Cpu                            uint
	EnableMacSpoofing              bool
	EnableDynamicMemory            bool
	EnableSecureBoot               bool
	SecureBootTemplate             string
	EnableVirtualizationExtensions bool
	AdditionalDiskSize             []uint
	DifferencingDisk               bool
	MacAddress                     string
	SkipExport                     bool
	OutputDir                      string
	FixedVHD                       bool
}

This step creates the actual virtual machine.

Produces:

VMName string - The name of the VM

func (*StepCreateVM) Cleanup

func (s *StepCreateVM) Cleanup(state multistep.StateBag)

func (*StepCreateVM) Run

type StepDisableVlan

type StepDisableVlan struct {
}

func (*StepDisableVlan) Cleanup

func (s *StepDisableVlan) Cleanup(state multistep.StateBag)

func (*StepDisableVlan) Run

type StepEnableIntegrationService

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

func (*StepEnableIntegrationService) Cleanup

func (*StepEnableIntegrationService) Run

type StepExportVm

type StepExportVm struct {
	OutputDir      string
	SkipCompaction bool
	SkipExport     bool
}

func (*StepExportVm) Cleanup

func (s *StepExportVm) Cleanup(state multistep.StateBag)

func (*StepExportVm) Run

type StepMountDvdDrive

type StepMountDvdDrive struct {
	Generation uint
}

func (*StepMountDvdDrive) Cleanup

func (s *StepMountDvdDrive) Cleanup(state multistep.StateBag)

func (*StepMountDvdDrive) Run

type StepMountFloppydrive

type StepMountFloppydrive struct {
	Generation uint
	// contains filtered or unexported fields
}

func (*StepMountFloppydrive) Cleanup

func (s *StepMountFloppydrive) Cleanup(state multistep.StateBag)

func (*StepMountFloppydrive) Run

type StepMountGuestAdditions

type StepMountGuestAdditions struct {
	GuestAdditionsMode string
	GuestAdditionsPath string
	Generation         uint
}

func (*StepMountGuestAdditions) Cleanup

func (s *StepMountGuestAdditions) Cleanup(state multistep.StateBag)

func (*StepMountGuestAdditions) Run

type StepMountSecondaryDvdImages

type StepMountSecondaryDvdImages struct {
	IsoPaths   []string
	Generation uint
}

func (*StepMountSecondaryDvdImages) Cleanup

func (*StepMountSecondaryDvdImages) Run

type StepOutputDir

type StepOutputDir struct {
	Force bool
	Path  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

type StepPollingInstallation added in v1.2.2

type StepPollingInstallation struct {
}

func (*StepPollingInstallation) Cleanup added in v1.2.2

func (s *StepPollingInstallation) Cleanup(state multistep.StateBag)

func (*StepPollingInstallation) Run added in v1.2.2

type StepRebootVm

type StepRebootVm struct {
}

func (*StepRebootVm) Cleanup

func (s *StepRebootVm) Cleanup(state multistep.StateBag)

func (*StepRebootVm) Run

type StepRun

type StepRun struct {
	GuiCancelFunc context.CancelFunc
	Headless      bool
	// contains filtered or unexported fields
}

func (*StepRun) Cleanup

func (s *StepRun) Cleanup(state multistep.StateBag)

func (*StepRun) Run

type StepShutdown

type StepShutdown struct {
	Command string
	Timeout time.Duration
}

This step shuts down the machine. It first attempts to do so gracefully, but ultimately forcefully shuts it down if that fails.

Uses:

communicator packer.Communicator
dir OutputDir
driver Driver
ui     packer.Ui
vmx_path string

Produces:

<nothing>

func (*StepShutdown) Cleanup

func (s *StepShutdown) Cleanup(state multistep.StateBag)

func (*StepShutdown) Run

type StepSleep

type StepSleep struct {
	Minutes    time.Duration
	ActionName string
}

func (*StepSleep) Cleanup

func (s *StepSleep) Cleanup(state multistep.StateBag)

func (*StepSleep) Run

type StepTypeBootCommand

type StepTypeBootCommand struct {
	BootCommand string
	BootWait    time.Duration
	SwitchName  string
	Ctx         interpolate.Context
}

This step "types" the boot command into the VM via the Hyper-V virtual keyboard

func (*StepTypeBootCommand) Cleanup

func (*StepTypeBootCommand) Run

type StepUnmountDvdDrive

type StepUnmountDvdDrive struct {
}

func (*StepUnmountDvdDrive) Cleanup

func (s *StepUnmountDvdDrive) Cleanup(state multistep.StateBag)

func (*StepUnmountDvdDrive) Run

type StepUnmountFloppyDrive

type StepUnmountFloppyDrive struct {
	Generation uint
}

func (*StepUnmountFloppyDrive) Cleanup

func (s *StepUnmountFloppyDrive) Cleanup(state multistep.StateBag)

func (*StepUnmountFloppyDrive) Run

type StepUnmountGuestAdditions

type StepUnmountGuestAdditions struct {
}

func (*StepUnmountGuestAdditions) Cleanup

func (s *StepUnmountGuestAdditions) Cleanup(state multistep.StateBag)

func (*StepUnmountGuestAdditions) Run

type StepUnmountSecondaryDvdImages

type StepUnmountSecondaryDvdImages struct {
}

func (*StepUnmountSecondaryDvdImages) Cleanup

func (*StepUnmountSecondaryDvdImages) Run

type StepWaitForInstallToComplete

type StepWaitForInstallToComplete struct {
	ExpectedRebootCount uint
	ActionName          string
}

func (*StepWaitForInstallToComplete) Cleanup

func (*StepWaitForInstallToComplete) Run

type StepWaitForPowerOff

type StepWaitForPowerOff struct {
}

func (*StepWaitForPowerOff) Cleanup

func (s *StepWaitForPowerOff) Cleanup(state multistep.StateBag)

func (*StepWaitForPowerOff) Run

Jump to

Keyboard shortcuts

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