change cpu to cpus and ram_size to memory in order to bring hyper v into line with other builder defaults

pull/7447/head
Megan Marsh 7 years ago
parent 3aa0e51104
commit bcacd331c3

@ -68,7 +68,7 @@ type Config struct {
// The size, in megabytes, of the computer memory in the VM. // The size, in megabytes, of the computer memory in the VM.
// By default, this is 1024 (about 1 GB). // By default, this is 1024 (about 1 GB).
RamSize uint `mapstructure:"ram_size"` RamSize uint `mapstructure:"memory"`
// //
SecondaryDvdImages []string `mapstructure:"secondary_iso_images"` SecondaryDvdImages []string `mapstructure:"secondary_iso_images"`
@ -87,7 +87,7 @@ type Config struct {
SwitchVlanId string `mapstructure:"switch_vlan_id"` SwitchVlanId string `mapstructure:"switch_vlan_id"`
MacAddress string `mapstructure:"mac_address"` MacAddress string `mapstructure:"mac_address"`
VlanId string `mapstructure:"vlan_id"` VlanId string `mapstructure:"vlan_id"`
Cpu uint `mapstructure:"cpu"` Cpu uint `mapstructure:"cpus"`
Generation uint `mapstructure:"generation"` Generation uint `mapstructure:"generation"`
EnableMacSpoofing bool `mapstructure:"enable_mac_spoofing"` EnableMacSpoofing bool `mapstructure:"enable_mac_spoofing"`
UseLegacyNetworkAdapter bool `mapstructure:"use_legacy_network_adapter"` UseLegacyNetworkAdapter bool `mapstructure:"use_legacy_network_adapter"`
@ -593,10 +593,10 @@ func (b *Builder) checkRamSize() error {
log.Println(fmt.Sprintf("%s: %v", "RamSize", b.config.RamSize)) log.Println(fmt.Sprintf("%s: %v", "RamSize", b.config.RamSize))
if b.config.RamSize < MinRamSize { if b.config.RamSize < MinRamSize {
return fmt.Errorf("ram_size: Virtual machine requires memory size >= %v MB, but defined: %v", return fmt.Errorf("memory: Virtual machine requires memory size >= %v MB, but defined: %v",
MinRamSize, b.config.RamSize) MinRamSize, b.config.RamSize)
} else if b.config.RamSize > MaxRamSize { } else if b.config.RamSize > MaxRamSize {
return fmt.Errorf("ram_size: Virtual machine requires memory size <= %v MB, but defined: %v", return fmt.Errorf("memory: Virtual machine requires memory size <= %v MB, but defined: %v",
MaxRamSize, b.config.RamSize) MaxRamSize, b.config.RamSize)
} }

@ -50,7 +50,7 @@ type Config struct {
// The size, in megabytes, of the computer memory in the VM. // The size, in megabytes, of the computer memory in the VM.
// By default, this is 1024 (about 1 GB). // By default, this is 1024 (about 1 GB).
RamSize uint `mapstructure:"ram_size"` RamSize uint `mapstructure:"memory"`
// //
SecondaryDvdImages []string `mapstructure:"secondary_iso_images"` SecondaryDvdImages []string `mapstructure:"secondary_iso_images"`
@ -85,7 +85,7 @@ type Config struct {
SwitchVlanId string `mapstructure:"switch_vlan_id"` SwitchVlanId string `mapstructure:"switch_vlan_id"`
MacAddress string `mapstructure:"mac_address"` MacAddress string `mapstructure:"mac_address"`
VlanId string `mapstructure:"vlan_id"` VlanId string `mapstructure:"vlan_id"`
Cpu uint `mapstructure:"cpu"` Cpu uint `mapstructure:"cpus"`
Generation uint `mapstructure:"generation"` Generation uint `mapstructure:"generation"`
EnableMacSpoofing bool `mapstructure:"enable_mac_spoofing"` EnableMacSpoofing bool `mapstructure:"enable_mac_spoofing"`
EnableDynamicMemory bool `mapstructure:"enable_dynamic_memory"` EnableDynamicMemory bool `mapstructure:"enable_dynamic_memory"`

@ -78,7 +78,7 @@ builder.
- `configuration_version` (string) - This allows you to set the vm version when - `configuration_version` (string) - This allows you to set the vm version when
calling New-VM to generate the vm. calling New-VM to generate the vm.
- `cpu` (number) - The number of CPUs the virtual machine should use. If - `cpus` (number) - The number of CPUs the virtual machine should use. If
this isn't specified, the default is 1 CPU. this isn't specified, the default is 1 CPU.
- `differencing_disk` (boolean) - If true enables differencing disks. Only - `differencing_disk` (boolean) - If true enables differencing disks. Only
@ -179,7 +179,7 @@ builder.
created, must be empty prior to running the builder. By default this is created, must be empty prior to running the builder. By default this is
"output-BUILDNAME" where "BUILDNAME" is the name of the build. "output-BUILDNAME" where "BUILDNAME" is the name of the build.
- `ram_size` (number) - The amount, in megabytes, of RAM to assign to the - `memory` (number) - The amount, in megabytes, of RAM to assign to the
VM. By default, this is 1 GB. VM. By default, this is 1 GB.
- `secondary_iso_images` (array of strings) - A list of ISO paths to - `secondary_iso_images` (array of strings) - A list of ISO paths to
@ -379,8 +379,8 @@ Packer config:
"winrm_password": "vagrant", "winrm_password": "vagrant",
"winrm_timeout" : "4h", "winrm_timeout" : "4h",
"shutdown_command": "f:\\run-sysprep.cmd", "shutdown_command": "f:\\run-sysprep.cmd",
"ram_size": 4096, "memory": 4096,
"cpu": 4, "cpus": 4,
"generation": 2, "generation": 2,
"switch_name":"LAN", "switch_name":"LAN",
"enable_secure_boot":true "enable_secure_boot":true
@ -887,8 +887,8 @@ virtual switch with an `External` connection type.
{ {
"variables": { "variables": {
"vm_name": "ubuntu-xenial", "vm_name": "ubuntu-xenial",
"cpu": "2", "cpus": "2",
"ram_size": "1024", "memory": "1024",
"disk_size": "21440", "disk_size": "21440",
"iso_url": "http://releases.ubuntu.com/16.04/ubuntu-16.04.1-server-amd64.iso", "iso_url": "http://releases.ubuntu.com/16.04/ubuntu-16.04.1-server-amd64.iso",
"iso_checksum_type": "sha1", "iso_checksum_type": "sha1",
@ -923,8 +923,8 @@ virtual switch with an `External` connection type.
"boot<enter>" "boot<enter>"
], ],
"shutdown_command": "echo 'packer' | sudo -S -E shutdown -P now", "shutdown_command": "echo 'packer' | sudo -S -E shutdown -P now",
"ram_size": "{{user `ram_size`}}", "memory": "{{user `memory`}}",
"cpu": "{{user `cpu`}}", "cpus": "{{user `cpu`}}",
"generation": 2, "generation": 2,
"enable_secure_boot": false "enable_secure_boot": false
} }

Loading…
Cancel
Save