Add 'CPU_reservation' parameter
This commit is contained in:
parent
a03c91e73a
commit
3991b0e95c
|
@ -59,6 +59,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.
|
||||||
* `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:
|
||||||
|
@ -98,6 +99,7 @@ Post-processing:
|
||||||
"linked_clone": true,
|
"linked_clone": true,
|
||||||
|
|
||||||
"CPUs": 2,
|
"CPUs": 2,
|
||||||
|
"CPU_reservation": 1000,
|
||||||
"RAM": 8192,
|
"RAM": 8192,
|
||||||
|
|
||||||
"ssh_username": "root",
|
"ssh_username": "root",
|
||||||
|
|
|
@ -9,8 +9,9 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type HardwareConfig struct {
|
type HardwareConfig struct {
|
||||||
CPUs int32 `mapstructure:"CPUs"`
|
CPUs int32 `mapstructure:"CPUs"`
|
||||||
RAM int64 `mapstructure:"RAM"`
|
CPUReservation int64 `mapstructure:"CPU_reservation"`
|
||||||
|
RAM int64 `mapstructure:"RAM"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type StepConfigureHardware struct {
|
type StepConfigureHardware struct {
|
||||||
|
@ -29,6 +30,10 @@ func (s *StepConfigureHardware) Run(state multistep.StateBag) multistep.StepActi
|
||||||
confSpec.NumCPUs = s.config.CPUs
|
confSpec.NumCPUs = s.config.CPUs
|
||||||
confSpec.MemoryMB = s.config.RAM
|
confSpec.MemoryMB = s.config.RAM
|
||||||
|
|
||||||
|
var cpuSpec types.ResourceAllocationInfo
|
||||||
|
cpuSpec.Reservation = s.config.CPUReservation
|
||||||
|
confSpec.CpuAllocation = &cpuSpec
|
||||||
|
|
||||||
task, err := vm.Reconfigure(ctx, confSpec)
|
task, err := vm.Reconfigure(ctx, confSpec)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
state.Put("error", err)
|
state.Put("error", err)
|
||||||
|
|
Loading…
Reference in New Issue