Skip to content

Commit

Permalink
vcsim: apply vm spec NumCoresPerSocket (#930)
Browse files Browse the repository at this point in the history
We set the default to 1 in the spec, but did not apply to the config.

Fixes #929
  • Loading branch information
dougm authored Nov 21, 2017
1 parent d077273 commit 2a8a516
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions govc/test/object.bats
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,9 @@ load test_helper
run govc object.collect -s -type VirtualMachine / summary.guest.toolsStatus
assert_matches toolsNotInstalled

run govc object.collect -s /DC0/vm/DC0_H0_VM0 config.hardware.numCoresPerSocket
assert_success 1

run govc object.collect -s -type ClusterComputeResource / summary.effectiveCpu
assert_number

Expand Down
4 changes: 4 additions & 0 deletions simulator/virtual_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ func (vm *VirtualMachine) apply(spec *types.VirtualMachineConfigSpec) {
vm.Summary.Config.NumCpu = vm.Config.Hardware.NumCPU
}

if spec.NumCoresPerSocket != 0 {
vm.Config.Hardware.NumCoresPerSocket = spec.NumCoresPerSocket
}

vm.Config.ExtraConfig = append(vm.Config.ExtraConfig, spec.ExtraConfig...)

vm.Config.Modified = time.Now()
Expand Down

0 comments on commit 2a8a516

Please sign in to comment.