Skip to content

Commit

Permalink
Merge pull request #101 from flatcar-linux/kai/esx-memory
Browse files Browse the repository at this point in the history
esx: Use 2 GiB RAM on VMware VMs to pass the docker tests
  • Loading branch information
pothos authored Apr 30, 2020
2 parents 2fa28f7 + ee128b4 commit 406f540
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions platform/api/esx/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,12 @@ func (a *API) CreateDevice(name string, conf *conf.Conf, ips *IpPair) (*ESXMachi
// End of hack
}

plog.Debugf("Setting memory to 2 GiB")
err = a.setMemoryMB(vm, 2048)
if err != nil {
return nil, fmt.Errorf("setting memory: %v", err)
}

plog.Debugf("Adding serial port for VM")
err = a.addSerialPort(vm)
if err != nil {
Expand Down Expand Up @@ -735,6 +741,18 @@ func networkMap(finder *find.Finder, e *ovf.Envelope) (p []types.OvfNetworkMappi
return
}

func (a *API) setMemoryMB(vm *object.VirtualMachine, memoryMB int64) error {
task, err := vm.Reconfigure(a.ctx, types.VirtualMachineConfigSpec{
MemoryMB: memoryMB,
})

if err != nil {
return err
}

return task.Wait(a.ctx)
}

func (a *API) updateGuestVariable(vm *object.VirtualMachine, key, value string) error {
config := []types.BaseOptionValue{
&types.OptionValue{
Expand Down

0 comments on commit 406f540

Please sign in to comment.