diff --git a/.changelog/23386.txt b/.changelog/23386.txt new file mode 100644 index 00000000000..49bac071a99 --- /dev/null +++ b/.changelog/23386.txt @@ -0,0 +1,3 @@ +```release-note:bug +scheduler: Fix a bug where reserved resources are not calculated correctly +``` diff --git a/nomad/structs/funcs_test.go b/nomad/structs/funcs_test.go index 1944ed659d5..c73d01720f1 100644 --- a/nomad/structs/funcs_test.go +++ b/nomad/structs/funcs_test.go @@ -105,6 +105,7 @@ func node2k() *Node { Grade: numalib.Performance, BaseSpeed: 1000, }}, + OverrideWitholdCompute: 1000, // set by client reserved field }, }, Memory: NodeMemoryResources{ diff --git a/nomad/structs/structs.go b/nomad/structs/structs.go index 1d1294ccd37..b5b0a1ec1f8 100644 --- a/nomad/structs/structs.go +++ b/nomad/structs/structs.go @@ -3191,7 +3191,7 @@ func (n *NodeResources) Comparable() *ComparableResources { c := &ComparableResources{ Flattened: AllocatedTaskResources{ Cpu: AllocatedCpuResources{ - CpuShares: int64(n.Processors.Topology.UsableCompute()), + CpuShares: int64(n.Processors.Topology.TotalCompute()), ReservedCores: reservableCores, }, Memory: AllocatedMemoryResources{