Add 'CPU_limit' parameter

This commit is contained in:
Michael Kuzmin 2017-07-01 23:52:35 +03:00
parent 3991b0e95c
commit d2dacfbc6b
2 changed files with 4 additions and 0 deletions

View File

@ -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",

View File

@ -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)