Add 'CPU_limit' parameter
This commit is contained in:
parent
3991b0e95c
commit
d2dacfbc6b
|
@ -60,6 +60,7 @@ Destination:
|
||||||
Hardware customization:
|
Hardware customization:
|
||||||
* `CPUs` - number of CPU sockets. Inherited from source VM by default.
|
* `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_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.
|
* `RAM` - Amount of RAM in megabytes. Inherited from source VM by default.
|
||||||
|
|
||||||
Provisioning:
|
Provisioning:
|
||||||
|
@ -100,6 +101,7 @@ Post-processing:
|
||||||
|
|
||||||
"CPUs": 2,
|
"CPUs": 2,
|
||||||
"CPU_reservation": 1000,
|
"CPU_reservation": 1000,
|
||||||
|
"CPU_limit": 2000,
|
||||||
"RAM": 8192,
|
"RAM": 8192,
|
||||||
|
|
||||||
"ssh_username": "root",
|
"ssh_username": "root",
|
||||||
|
|
|
@ -11,6 +11,7 @@ import (
|
||||||
type HardwareConfig struct {
|
type HardwareConfig struct {
|
||||||
CPUs int32 `mapstructure:"CPUs"`
|
CPUs int32 `mapstructure:"CPUs"`
|
||||||
CPUReservation int64 `mapstructure:"CPU_reservation"`
|
CPUReservation int64 `mapstructure:"CPU_reservation"`
|
||||||
|
CPULimit int64 `mapstructure:"CPU_limit"`
|
||||||
RAM int64 `mapstructure:"RAM"`
|
RAM int64 `mapstructure:"RAM"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,6 +33,7 @@ func (s *StepConfigureHardware) Run(state multistep.StateBag) multistep.StepActi
|
||||||
|
|
||||||
var cpuSpec types.ResourceAllocationInfo
|
var cpuSpec types.ResourceAllocationInfo
|
||||||
cpuSpec.Reservation = s.config.CPUReservation
|
cpuSpec.Reservation = s.config.CPUReservation
|
||||||
|
cpuSpec.Limit = s.config.CPULimit
|
||||||
confSpec.CpuAllocation = &cpuSpec
|
confSpec.CpuAllocation = &cpuSpec
|
||||||
|
|
||||||
task, err := vm.Reconfigure(ctx, confSpec)
|
task, err := vm.Reconfigure(ctx, confSpec)
|
||||||
|
|
Loading…
Reference in New Issue