Skip to content

Commit

Permalink
scheduler: fix reservation calc error (#1949)
Browse files Browse the repository at this point in the history
Signed-off-by: Joseph <joseph.t.lee@outlook.com>
  • Loading branch information
eahydra committed Mar 13, 2024
1 parent 61c0013 commit 9184517
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion pkg/scheduler/plugins/deviceshare/reservation.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,13 @@ func (p *Plugin) RestoreReservation(ctx context.Context, cycleState *framework.C
allocated = appendAllocatedByHints(minorHints, allocated, podAllocated)
}
}
remained := subtractAllocated(copyDeviceResources(allocatable), allocated, false)

result = append(result, reservationAlloc{
rInfo: rInfo,
allocatable: allocatable,
allocated: allocated,
remained: subtractAllocated(copyDeviceResources(allocatable), allocated, true),
remained: remained,
})
}
return result
Expand Down
2 changes: 1 addition & 1 deletion pkg/scheduler/plugins/reservation/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ func fitsNode(podRequest *framework.Resource, nodeInfo *framework.NodeInfo, node

var rRemained *framework.Resource
if rInfo != nil {
resources := quotav1.SubtractWithNonNegativeResult(rInfo.Allocatable, rInfo.Allocated)
resources := quotav1.Subtract(rInfo.Allocatable, rInfo.Allocated)
rRemained = framework.NewResource(resources)
} else {
rRemained = dummyResource
Expand Down

0 comments on commit 9184517

Please sign in to comment.