Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

Add ability to control nested hardware virtualization #46

Merged
merged 1 commit into from
Jan 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions driver/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type HardwareConfig struct {
RAMReservation int64
RAMReserveAll bool
DiskSize int64
NestedHV bool
}

func (d *Driver) NewVM(ref *types.ManagedObjectReference) *VirtualMachine {
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions step_hardware.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down