Add 'RAM_reservation' parameter

This commit is contained in:
Michael Kuzmin 2017-07-02 00:02:49 +03:00
parent d2dacfbc6b
commit 71c211fa09
2 changed files with 7 additions and 0 deletions

View File

@ -62,6 +62,7 @@ Hardware customization:
* `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_reservation` - Amount of reserved RAM in MB. Inherited from source VM by default.
Provisioning:
* `ssh_username` - [**mandatory**] username in guest OS.
@ -103,6 +104,7 @@ Post-processing:
"CPU_reservation": 1000,
"CPU_limit": 2000,
"RAM": 8192,
"RAM_reservation": 2048,
"ssh_username": "root",
"ssh_password": "{{user `guest_password`}}",

View File

@ -13,6 +13,7 @@ type HardwareConfig struct {
CPUReservation int64 `mapstructure:"CPU_reservation"`
CPULimit int64 `mapstructure:"CPU_limit"`
RAM int64 `mapstructure:"RAM"`
RAMReservation int64 `mapstructure:"RAM_reservation"`
}
type StepConfigureHardware struct {
@ -36,6 +37,10 @@ func (s *StepConfigureHardware) Run(state multistep.StateBag) multistep.StepActi
cpuSpec.Limit = s.config.CPULimit
confSpec.CpuAllocation = &cpuSpec
var ramSpec types.ResourceAllocationInfo
ramSpec.Reservation = s.config.RAMReservation
confSpec.MemoryAllocation = &ramSpec
task, err := vm.Reconfigure(ctx, confSpec)
if err != nil {
state.Put("error", err)