diff --git a/README.md b/README.md index 3fd9f9ec0..7071f9b51 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,7 @@ Destination: Hardware customization: * `CPUs` - number of CPU sockets. Inherited from source VM by default. * `CPU_reservation` - Amount of reserved CPU resources in MHz. Inherited from source VM by default. +* `CPU_limit` - Upper limit of available CPU resources in MHz. Inherited from source VM by default, set to `-1` for reset. * `RAM` - Amount of RAM in megabytes. Inherited from source VM by default. Provisioning: @@ -100,6 +101,7 @@ Post-processing: "CPUs": 2, "CPU_reservation": 1000, + "CPU_limit": 2000, "RAM": 8192, "ssh_username": "root", diff --git a/step_hardware.go b/step_hardware.go index 2a1ea04af..a420f122e 100644 --- a/step_hardware.go +++ b/step_hardware.go @@ -11,6 +11,7 @@ import ( type HardwareConfig struct { CPUs int32 `mapstructure:"CPUs"` CPUReservation int64 `mapstructure:"CPU_reservation"` + CPULimit int64 `mapstructure:"CPU_limit"` RAM int64 `mapstructure:"RAM"` } @@ -32,6 +33,7 @@ func (s *StepConfigureHardware) Run(state multistep.StateBag) multistep.StepActi var cpuSpec types.ResourceAllocationInfo cpuSpec.Reservation = s.config.CPUReservation + cpuSpec.Limit = s.config.CPULimit confSpec.CpuAllocation = &cpuSpec task, err := vm.Reconfigure(ctx, confSpec)