Add ability to control nested hardware virtualization

Issue: #45
This commit is contained in:
Dmitry Tretyakov 2018-01-16 12:32:22 +01:00 committed by Michael Kuzmin
parent 98b2f99436
commit ede053f6bc
3 changed files with 5 additions and 0 deletions

View File

@ -65,6 +65,7 @@ Hardware customization:
* `RAM_reservation` - Amount of reserved RAM in MB. Inherited from source VM by default.
* `RAM_reserve_all` - Reserve all available RAM (bool). `false` by default. Cannot be used together with `RAM_reservation`.
* `disk_size` - Change the disk size (in GB). VM should have a single disk. Cannot be used together with `linked_clone`.
* `NestedHV` - Allows to enable nested hardware virtualization for VM.
Provisioning:
* `ssh_username` - [**mandatory**] username in guest OS.

View File

@ -31,6 +31,7 @@ type HardwareConfig struct {
RAMReservation int64
RAMReserveAll bool
DiskSize int64
NestedHV bool
}
func (d *Driver) NewVM(ref *types.ManagedObjectReference) *VirtualMachine {
@ -165,6 +166,7 @@ func (vm *VirtualMachine) Configure(config *HardwareConfig) error {
confSpec.MemoryAllocation = &ramSpec
confSpec.MemoryReservationLockedToMax = &config.RAMReserveAll
confSpec.NestedHVEnabled = &config.NestedHV
if config.DiskSize > 0 {
devices, err := vm.vm.Device(vm.driver.ctx)

View File

@ -15,6 +15,7 @@ type HardwareConfig struct {
RAMReservation int64 `mapstructure:"RAM_reservation"`
RAMReserveAll bool `mapstructure:"RAM_reserve_all"`
DiskSize int64 `mapstructure:"disk_size"`
NestedHV bool `mapstructure:"NestedHV"`
}
func (c *HardwareConfig) Prepare() []error {
@ -46,6 +47,7 @@ func (s *StepConfigureHardware) Run(state multistep.StateBag) multistep.StepActi
RAMReservation: s.config.RAMReservation,
RAMReserveAll: s.config.RAMReserveAll,
DiskSize: s.config.DiskSize,
NestedHV: s.config.NestedHV,
})
if err != nil {
state.Put("error", err)