diff --git a/pkg/scheduler/plugins/deviceshare/reservation.go b/pkg/scheduler/plugins/deviceshare/reservation.go index b9593d6e0..ab18c0a86 100644 --- a/pkg/scheduler/plugins/deviceshare/reservation.go +++ b/pkg/scheduler/plugins/deviceshare/reservation.go @@ -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 diff --git a/pkg/scheduler/plugins/reservation/plugin.go b/pkg/scheduler/plugins/reservation/plugin.go index 92809f2ea..3f432b833 100644 --- a/pkg/scheduler/plugins/reservation/plugin.go +++ b/pkg/scheduler/plugins/reservation/plugin.go @@ -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