Documentation ¶
Overview ¶
Heavily borrowed from the built in packer hyperv plugin
Index ¶
- Constants
- func NewHypervPSSHDriver(pss *pssh.PowershellSession) (hypervcommon.Driver, error)
- type Builder
- type Config
- type HypervSSHDriver
- func (d *HypervSSHDriver) AddVirtualMachineHardDrive(vmName string, vhdRoot string, vhdName string, vhdSizeBytes int64, ...) error
- func (d *HypervSSHDriver) CloneVirtualMachine(fromPath string, fromName string, fromSnapshot string, cloneAllSnapshots bool, ...) error
- func (d *HypervSSHDriver) CompactDisks(expPath string, vhdDir string) error
- func (d *HypervSSHDriver) ConnectVirtualMachineNetworkAdapterToSwitch(vmName string, switchName string) error
- func (d *HypervSSHDriver) CopyExportedVirtualMachine(expPath string, outputPath string, vhdDir string, vmDir string) error
- func (d *HypervSSHDriver) CopyVmxcVirtualMachine(exportPath string, cloneFromPath string) error
- func (d *HypervSSHDriver) CreateDvdDrive(vmName string, isoPath string, generation uint) (uint, uint, error)
- func (d *HypervSSHDriver) CreateExternalVirtualSwitch(vmName string, switchName string) error
- func (d *HypervSSHDriver) CreateVirtualMachine(vmName string, path string, harddrivePath string, vhdRoot string, ram int64, ...) error
- func (d *HypervSSHDriver) CreateVirtualSwitch(switchName string, switchType string) (bool, error)
- func (d *HypervSSHDriver) DeleteAllDvdDrives(vmName string) error
- func (d *HypervSSHDriver) DeleteDvdDrive(vmName string, controllerNumber uint, controllerLocation uint) error
- func (d *HypervSSHDriver) DeleteVirtualMachine(vmName string) error
- func (d *HypervSSHDriver) DeleteVirtualSwitch(switchName string) error
- func (d *HypervSSHDriver) DisableAutomaticCheckpoints(vmName string) error
- func (d *HypervSSHDriver) EnableVirtualMachineIntegrationService(vmName string, integrationServiceName string) error
- func (d *HypervSSHDriver) ExportVirtualMachine(vmName string, path string) error
- func (d *HypervSSHDriver) ExportVmxcVirtualMachine(exportPath string, vmName string, snapshotName string, allSnapshots bool) error
- func (d *HypervSSHDriver) GetHostAdapterIpAddressForSwitch(switchName string) (string, error)
- func (d *HypervSSHDriver) GetHostName(ipAddr string) (string, error)
- func (d *HypervSSHDriver) GetVirtualMachineGeneration(vmName string) (uint, error)
- func (d *HypervSSHDriver) GetVirtualMachineNetworkAdapterAddress(vmName string) (string, error)
- func (d *HypervSSHDriver) GetVirtualMachineSwitchName(vmName string) (string, error)
- func (d *HypervSSHDriver) ImportVmxcVirtualMachine(importPath string, vmName string, harddrivePath string, ram int64, ...) error
- func (d *HypervSSHDriver) IpAddress(macAddr string) (string, error)
- func (d *HypervSSHDriver) IsOff(vmName string) (bool, error)
- func (d *HypervSSHDriver) IsRunning(vmName string) (bool, error)
- func (d *HypervSSHDriver) Mac(vmName string) (string, error)
- func (d *HypervSSHDriver) MountDvdDrive(vmName string, path string, controllerNumber uint, controllerLocation uint) error
- func (d *HypervSSHDriver) MountFloppyDrive(vmName string, path string) error
- func (d *HypervSSHDriver) RestartVirtualMachine(vmName string) error
- func (d *HypervSSHDriver) SetBootDvdDrive(vmName string, controllerNumber uint, controllerLocation uint, generation uint) error
- func (d *HypervSSHDriver) SetNetworkAdapterVlanId(switchName string, vlanId string) error
- func (d *HypervSSHDriver) SetVirtualMachineCpuCount(vmName string, cpu uint) error
- func (d *HypervSSHDriver) SetVirtualMachineDynamicMemory(vmName string, enableDynamicMemory bool) error
- func (d *HypervSSHDriver) SetVirtualMachineMacSpoofing(vmName string, enableMacSpoofing bool) error
- func (d *HypervSSHDriver) SetVirtualMachineSecureBoot(vmName string, enable bool) error
- func (d *HypervSSHDriver) SetVirtualMachineVirtualizationExtensions(vmName string, enableVirtExt bool) error
- func (d *HypervSSHDriver) SetVirtualMachineVlanId(vmName string, vlanId string) error
- func (d *HypervSSHDriver) SetVmNetworkAdapterMacAddress(vmName string, macAddr string) error
- func (d *HypervSSHDriver) Start(vmName string) error
- func (d *HypervSSHDriver) Stop(vmName string) error
- func (d *HypervSSHDriver) TypeScanCodes(vmName string, scanCodes string) error
- func (d *HypervSSHDriver) UnmountDvdDrive(vmName string, controllerNumber uint, controllerLocation uint) error
- func (d *HypervSSHDriver) UnmountFloppyDrive(vmName string) error
- func (d *HypervSSHDriver) UntagVirtualMachineNetworkAdapterVlan(vmName string, switchName string) error
- func (d *HypervSSHDriver) Uptime(vmName string) (uint64, error)
- func (d *HypervSSHDriver) Verify() error
Constants ¶
const ( DefaultDiskSize = 40 * 1024 // ~40GB MinDiskSize = 256 // 256MB MaxDiskSize = 64 * 1024 * 1024 // 64TB DefaultRamSize = 1 * 1024 // 1GB MinRamSize = 32 // 32MB MaxRamSize = 32 * 1024 // 32GB MinNestedVirtualizationRamSize = 4 * 1024 // 4GB LowRam = 256 // 256MB DefaultUsername = "" DefaultPassword = "" )
Variables ¶
This section is empty.
Functions ¶
func NewHypervPSSHDriver ¶
func NewHypervPSSHDriver(pss *pssh.PowershellSession) (hypervcommon.Driver, error)
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder implements packer.Builder and builds the actual Hyperv images.
type Config ¶
type Config struct { common.PackerConfig `mapstructure:",squash"` common.HTTPConfig `mapstructure:",squash"` common.ISOConfig `mapstructure:",squash"` common.FloppyConfig `mapstructure:",squash"` hypervcommon.OutputConfig `mapstructure:",squash"` hypervcommon.SSHConfig `mapstructure:",squash"` hypervcommon.RunConfig `mapstructure:",squash"` hypervcommon.ShutdownConfig `mapstructure:",squash"` DiskSize uint `mapstructure:"disk_size"` // The size, in megabytes, of the computer memory in the VM. // By default, this is 1024 (about 1 GB). RamSize uint `mapstructure:"ram_size"` // SecondaryDvdImages []string `mapstructure:"secondary_iso_images"` // Should integration services iso be mounted GuestAdditionsMode string `mapstructure:"guest_additions_mode"` // The path to the integration services iso GuestAdditionsPath string `mapstructure:"guest_additions_path"` // This is the name of the new virtual machine. // By default this is "packer-BUILDNAME", where "BUILDNAME" is the name of the build. VMName string `mapstructure:"vm_name"` // Use differencing disk DifferencingDisk bool `mapstructure:"differencing_disk"` BootCommand []string `mapstructure:"boot_command"` SwitchName string `mapstructure:"switch_name"` SwitchVlanId string `mapstructure:"switch_vlan_id"` MacAddress string `mapstructure:"mac_address"` VlanId string `mapstructure:"vlan_id"` Cpu uint `mapstructure:"cpu"` Generation uint `mapstrucutre:"generation"` EnableMacSpoofing bool `mapstructure:"enable_mac_spoofing"` EnableDynamicMemory bool `mapstructure:"enable_dynamic_memory"` EnableSecureBoot bool `mapstructure:"enable_secure_boot"` EnableVirtualizationExtensions bool `mapstructure:"enable_virtualization_extensions"` AdditionalDiskSize []uint `mapstructure:"disk_additional_size"` // New Configs HyperVServer string `mapstructure:"hyperv_server"` HyperVUsername string `mapstructure:"hyperv_username"` HyperVPassword string `mapstructure:"hyperv_password"` Communicator string `mapstructure:"communicator"` SkipCompaction bool `mapstructure:"skip_compaction"` SkipExport bool `mapstructure:"skip_export"` TempPath string `mapstructure:"temp_path"` // A separate path can be used for storing the VM's disk image. The purpose is to enable // reading and writing to take place on different physical disks (read from VHD temp path // write to regular temp path while exporting the VM) to eliminate a single-disk bottleneck. VhdTempPath string `mapstructure:"vhd_temp_path"` // contains filtered or unexported fields }
type HypervSSHDriver ¶
type HypervSSHDriver struct {
// contains filtered or unexported fields
}
func (*HypervSSHDriver) AddVirtualMachineHardDrive ¶
func (*HypervSSHDriver) CloneVirtualMachine ¶
func (*HypervSSHDriver) CompactDisks ¶
func (d *HypervSSHDriver) CompactDisks(expPath string, vhdDir string) error
func (*HypervSSHDriver) ConnectVirtualMachineNetworkAdapterToSwitch ¶
func (d *HypervSSHDriver) ConnectVirtualMachineNetworkAdapterToSwitch(vmName string, switchName string) error
func (*HypervSSHDriver) CopyExportedVirtualMachine ¶
func (*HypervSSHDriver) CopyVmxcVirtualMachine ¶
func (d *HypervSSHDriver) CopyVmxcVirtualMachine(exportPath string, cloneFromPath string) error
func (*HypervSSHDriver) CreateDvdDrive ¶
func (*HypervSSHDriver) CreateExternalVirtualSwitch ¶
func (d *HypervSSHDriver) CreateExternalVirtualSwitch(vmName string, switchName string) error
func (*HypervSSHDriver) CreateVirtualMachine ¶
func (*HypervSSHDriver) CreateVirtualSwitch ¶
func (d *HypervSSHDriver) CreateVirtualSwitch(switchName string, switchType string) (bool, error)
func (*HypervSSHDriver) DeleteAllDvdDrives ¶
func (d *HypervSSHDriver) DeleteAllDvdDrives(vmName string) error
func (*HypervSSHDriver) DeleteDvdDrive ¶
func (d *HypervSSHDriver) DeleteDvdDrive(vmName string, controllerNumber uint, controllerLocation uint) error
func (*HypervSSHDriver) DeleteVirtualMachine ¶
func (d *HypervSSHDriver) DeleteVirtualMachine(vmName string) error
func (*HypervSSHDriver) DeleteVirtualSwitch ¶
func (d *HypervSSHDriver) DeleteVirtualSwitch(switchName string) error
func (*HypervSSHDriver) DisableAutomaticCheckpoints ¶
func (d *HypervSSHDriver) DisableAutomaticCheckpoints(vmName string) error
func (*HypervSSHDriver) EnableVirtualMachineIntegrationService ¶
func (d *HypervSSHDriver) EnableVirtualMachineIntegrationService(vmName string, integrationServiceName string) error
func (*HypervSSHDriver) ExportVirtualMachine ¶
func (d *HypervSSHDriver) ExportVirtualMachine(vmName string, path string) error
func (*HypervSSHDriver) ExportVmxcVirtualMachine ¶
func (*HypervSSHDriver) GetHostAdapterIpAddressForSwitch ¶
func (d *HypervSSHDriver) GetHostAdapterIpAddressForSwitch(switchName string) (string, error)
Finds the IP address of a host adapter connected to switch
func (*HypervSSHDriver) GetHostName ¶
func (d *HypervSSHDriver) GetHostName(ipAddr string) (string, error)
Finds the hostname for the ip address
func (*HypervSSHDriver) GetVirtualMachineGeneration ¶
func (d *HypervSSHDriver) GetVirtualMachineGeneration(vmName string) (uint, error)
func (*HypervSSHDriver) GetVirtualMachineNetworkAdapterAddress ¶
func (d *HypervSSHDriver) GetVirtualMachineNetworkAdapterAddress(vmName string) (string, error)
Get the ip address for network adaptor
func (*HypervSSHDriver) GetVirtualMachineSwitchName ¶
func (d *HypervSSHDriver) GetVirtualMachineSwitchName(vmName string) (string, error)
func (*HypervSSHDriver) ImportVmxcVirtualMachine ¶
func (*HypervSSHDriver) IpAddress ¶
func (d *HypervSSHDriver) IpAddress(macAddr string) (string, error)
Finds the IP address of a VM connected that uses DHCP by its MAC address This is only used in one place, in a tight loop, it seems to overwhelm the ssh connection, so we try twice with a pause in between to give it some breathing room
func (*HypervSSHDriver) IsOff ¶
func (d *HypervSSHDriver) IsOff(vmName string) (bool, error)
Checks if the VM named is off.
func (*HypervSSHDriver) IsRunning ¶
func (d *HypervSSHDriver) IsRunning(vmName string) (bool, error)
Checks if the VM named is running.
func (*HypervSSHDriver) Mac ¶
func (d *HypervSSHDriver) Mac(vmName string) (string, error)
Finds the MAC address of the NIC nic0
func (*HypervSSHDriver) MountDvdDrive ¶
func (*HypervSSHDriver) MountFloppyDrive ¶
func (d *HypervSSHDriver) MountFloppyDrive(vmName string, path string) error
func (*HypervSSHDriver) RestartVirtualMachine ¶
func (d *HypervSSHDriver) RestartVirtualMachine(vmName string) error
func (*HypervSSHDriver) SetBootDvdDrive ¶
func (*HypervSSHDriver) SetNetworkAdapterVlanId ¶
func (d *HypervSSHDriver) SetNetworkAdapterVlanId(switchName string, vlanId string) error
Set the vlan to use for switch
func (*HypervSSHDriver) SetVirtualMachineCpuCount ¶
func (d *HypervSSHDriver) SetVirtualMachineCpuCount(vmName string, cpu uint) error
func (*HypervSSHDriver) SetVirtualMachineDynamicMemory ¶
func (d *HypervSSHDriver) SetVirtualMachineDynamicMemory(vmName string, enableDynamicMemory bool) error
func (*HypervSSHDriver) SetVirtualMachineMacSpoofing ¶
func (d *HypervSSHDriver) SetVirtualMachineMacSpoofing(vmName string, enableMacSpoofing bool) error
func (*HypervSSHDriver) SetVirtualMachineSecureBoot ¶
func (d *HypervSSHDriver) SetVirtualMachineSecureBoot(vmName string, enable bool) error
func (*HypervSSHDriver) SetVirtualMachineVirtualizationExtensions ¶
func (d *HypervSSHDriver) SetVirtualMachineVirtualizationExtensions(vmName string, enableVirtExt bool) error
func (*HypervSSHDriver) SetVirtualMachineVlanId ¶
func (d *HypervSSHDriver) SetVirtualMachineVlanId(vmName string, vlanId string) error
Set the vlan to use for machine
func (*HypervSSHDriver) SetVmNetworkAdapterMacAddress ¶
func (d *HypervSSHDriver) SetVmNetworkAdapterMacAddress(vmName string, macAddr string) error
func (*HypervSSHDriver) Start ¶
func (d *HypervSSHDriver) Start(vmName string) error
Start starts a VM specified by the name given.
func (*HypervSSHDriver) Stop ¶
func (d *HypervSSHDriver) Stop(vmName string) error
Stop stops a VM specified by the name given.
func (*HypervSSHDriver) TypeScanCodes ¶
func (d *HypervSSHDriver) TypeScanCodes(vmName string, scanCodes string) error
Type scan codes to virtual keyboard of vm
func (*HypervSSHDriver) UnmountDvdDrive ¶
func (d *HypervSSHDriver) UnmountDvdDrive(vmName string, controllerNumber uint, controllerLocation uint) error
func (*HypervSSHDriver) UnmountFloppyDrive ¶
func (d *HypervSSHDriver) UnmountFloppyDrive(vmName string) error
func (*HypervSSHDriver) UntagVirtualMachineNetworkAdapterVlan ¶
func (d *HypervSSHDriver) UntagVirtualMachineNetworkAdapterVlan(vmName string, switchName string) error
func (*HypervSSHDriver) Uptime ¶
func (d *HypervSSHDriver) Uptime(vmName string) (uint64, error)
How long has VM been on
func (*HypervSSHDriver) Verify ¶
func (d *HypervSSHDriver) Verify() 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.