vmcx

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2019 License: MPL-2.0 Imports: 17 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	DefaultRamSize                 = 1 * 1024    // 1GB
	MinRamSize                     = 32          // 32MB
	MaxRamSize                     = 1024 * 1024 // 1TB
	MinNestedVirtualizationRamSize = 4 * 1024    // 4GB

	LowRam = 256 // 256MB

	DefaultUsername = ""
	DefaultPassword = ""
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

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

Builder implements packer.Builder and builds the actual Hyperv images.

func (*Builder) Prepare

func (b *Builder) Prepare(raws ...interface{}) ([]string, error)

Prepare processes the build configuration parameters.

func (*Builder) Run

func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error)

Run executes a Packer build and returns a packer.Artifact representing a Hyperv appliance.

type Config

type Config struct {
	common.PackerConfig            `mapstructure:",squash"`
	common.HTTPConfig              `mapstructure:",squash"`
	common.ISOConfig               `mapstructure:",squash"`
	common.FloppyConfig            `mapstructure:",squash"`
	bootcommand.BootConfig         `mapstructure:",squash"`
	hypervcommon.OutputConfig      `mapstructure:",squash"`
	hypervcommon.SSHConfig         `mapstructure:",squash"`
	shutdowncommand.ShutdownConfig `mapstructure:",squash"`
	// The amount, in megabytes, of RAM to assign to the
	// VM. By default, this is 1 GB.
	RamSize uint `mapstructure:"memory" required:"false"`
	// A list of ISO paths to
	// attach to a VM when it is booted. This is most useful for unattended
	// Windows installs, which look for an Autounattend.xml file on removable
	// media. By default, no secondary ISO will be attached.
	SecondaryDvdImages []string `mapstructure:"secondary_iso_images" required:"false"`
	// If set to attach then attach and
	// mount the ISO image specified in guest_additions_path. If set to
	// none then guest additions are not attached and mounted; This is the
	// default.
	GuestAdditionsMode string `mapstructure:"guest_additions_mode" required:"false"`
	// The path to the ISO image for guest
	// additions.
	GuestAdditionsPath string `mapstructure:"guest_additions_path" required:"false"`

	// This is the path to a directory containing an exported virtual machine.
	CloneFromVMCXPath string `mapstructure:"clone_from_vmcx_path"`

	// This is the name of the virtual machine to clone from.
	CloneFromVMName string `mapstructure:"clone_from_vm_name"`
	// The name of a snapshot in the
	// source machine to use as a starting point for the clone. If the value
	// given is an empty string, the last snapshot present in the source will
	// be chosen as the starting point for the new VM.
	CloneFromSnapshotName string `mapstructure:"clone_from_snapshot_name" required:"false"`
	// If set to true all snapshots
	// present in the source machine will be copied when the machine is
	// cloned. The final result of the build will be an exported virtual
	// machine that contains all the snapshots of the parent.
	CloneAllSnapshots bool `mapstructure:"clone_all_snapshots" required:"false"`
	// This is the name of the new virtual machine,
	// without the file extension. By default this is "packer-BUILDNAME",
	// where "BUILDNAME" is the name of the build.
	VMName string `mapstructure:"vm_name" required:"false"`
	// If true enables differencing disks. Only
	// the changes will be written to the new disk. This is especially useful if
	// your source is a VHD/VHDX. This defaults to false.
	DifferencingDisk bool `mapstructure:"differencing_disk" required:"false"`
	// The name of the switch to connect the virtual
	// machine to. By default, leaving this value unset will cause Packer to
	// try and determine the switch to use by looking for an external switch
	// that is up and running.
	SwitchName string `mapstructure:"switch_name" required:"false"`
	// When cloning a vm to build from, we run a powershell
	// Compare-VM command, which, depending on your version of Windows, may need
	// the "Copy" flag to be set to true or false. Defaults to "false". Command:
	CompareCopy bool `mapstructure:"copy_in_compare" required:"false"`
	// This is the VLAN of the virtual switch's
	// network card. By default none is set. If none is set then a VLAN is not
	// set on the switch's network card. If this value is set it should match
	// the VLAN specified in by vlan_id.
	SwitchVlanId string `mapstructure:"switch_vlan_id" required:"false"`
	// This allows a specific MAC address to be used on
	// the default virtual network card. The MAC address must be a string with
	// no delimiters, for example "0000deadbeef".
	MacAddress string `mapstructure:"mac_address" required:"false"`
	// This is the VLAN of the virtual machine's network
	// card for the new virtual machine. By default none is set. If none is set
	// then VLANs are not set on the virtual machine's network card.
	VlanId string `mapstructure:"vlan_id" required:"false"`
	// The number of CPUs the virtual machine should use. If
	// this isn't specified, the default is 1 CPU.
	Cpu uint `mapstructure:"cpus" required:"false"`
	// The Hyper-V generation for the virtual machine. By
	// default, this is 1. Generation 2 Hyper-V virtual machines do not support
	// floppy drives. In this scenario use secondary_iso_images instead. Hard
	// drives and DVD drives will also be SCSI and not IDE.
	Generation uint `mapstructure:"generation" required:"false"`
	// If true enable MAC address spoofing
	// for the virtual machine. This defaults to false.
	EnableMacSpoofing bool `mapstructure:"enable_mac_spoofing" required:"false"`
	// If true enable dynamic memory for
	// the virtual machine. This defaults to false.
	EnableDynamicMemory bool `mapstructure:"enable_dynamic_memory" required:"false"`
	// If true enable secure boot for the
	// virtual machine. This defaults to false. See secure_boot_template
	// below for additional settings.
	EnableSecureBoot bool `mapstructure:"enable_secure_boot" required:"false"`
	// The secure boot template to be
	// configured. Valid values are "MicrosoftWindows" (Windows) or
	// "MicrosoftUEFICertificateAuthority" (Linux). This only takes effect if
	// enable_secure_boot is set to "true". This defaults to "MicrosoftWindows".
	SecureBootTemplate string `mapstructure:"secure_boot_template" required:"false"`
	// If true enable
	// virtualization extensions for the virtual machine. This defaults to
	// false. For nested virtualization you need to enable MAC spoofing,
	// disable dynamic memory and have at least 4GB of RAM assigned to the
	// virtual machine.
	EnableVirtualizationExtensions bool `mapstructure:"enable_virtualization_extensions" required:"false"`
	// The location under which Packer will create a
	// directory to house all the VM files and folders during the build.
	// By default %TEMP% is used which, for most systems, will evaluate to
	// %USERPROFILE%/AppData/Local/Temp.
	TempPath string `mapstructure:"temp_path" required:"false"`
	// This allows you to set the vm version when
	//  calling New-VM to generate the vm.
	Version string `mapstructure:"configuration_version" required:"false"`
	// If "true", Packer will not delete the VM from
	// The Hyper-V manager.
	KeepRegistered bool `mapstructure:"keep_registered" required:"false"`

	Communicator string `mapstructure:"communicator"`
	// If true skip compacting the hard disk for
	// the virtual machine when exporting. This defaults to false.
	SkipCompaction bool `mapstructure:"skip_compaction" required:"false"`
	// If true Packer will skip the export of the VM.
	// If you are interested only in the VHD/VHDX files, you can enable this
	// option. The resulting VHD/VHDX file will be output to
	// <output_directory>/Virtual Hard Disks. By default this option is false
	// and Packer will export the VM to output_directory.
	SkipExport bool `mapstructure:"skip_export" required:"false"`
	// Packer defaults to building Hyper-V virtual
	// machines by launching a GUI that shows the console of the machine being
	// built. When this value is set to true, the machine will start without a
	// console.
	Headless bool `mapstructure:"headless" required:"false"`
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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