From e5f01047a41486892bcb89c862654e068bb92fc6 Mon Sep 17 00:00:00 2001 From: Wenbo Zhang Date: Wed, 20 Mar 2024 17:02:11 +0800 Subject: [PATCH] fix rollback unthoroughly when allocate error Signed-off-by: Wenbo Zhang --- pkg/scheduler/framework/statement.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/scheduler/framework/statement.go b/pkg/scheduler/framework/statement.go index fb834818fd..22bd7ebb92 100644 --- a/pkg/scheduler/framework/statement.go +++ b/pkg/scheduler/framework/statement.go @@ -389,8 +389,10 @@ func (s *Statement) Commit() { case Allocate: err := s.allocate(op.task) if err != nil { - s.ssn.cache.RevertVolumes(op.task, op.task.PodVolumes) - klog.Errorf("Failed to allocate task: for %s", err.Error()) + if e := s.unallocate(op.task); e != nil { + klog.Errorf("Failed to unallocate task <%v/%v>: %v.", op.task.Namespace, op.task.Name, e) + } + klog.Errorf("Failed to allocate task <%v/%v>: %v.", op.task.Namespace, op.task.Name, err) } } }