Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

esx: Use 2 GiB RAM on VMware VMs to pass the docker tests #101

Merged
merged 1 commit into from
Apr 30, 2020
Merged
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
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