From e4b771cb8229849161a6e8b9432235aa54aba8d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B1=88=E8=BD=A9?= Date: Thu, 22 Nov 2018 22:02:11 +0800 Subject: [PATCH] =?UTF-8?q?=E9=81=BF=E5=85=8D=E6=B2=A1=E6=9C=89objs?= =?UTF-8?q?=E6=97=B6=E6=95=B0=E7=BB=84=E8=AE=BF=E9=97=AE=E8=B6=8A=E7=95=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/cloudcommon/db/taskman/tasks.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/cloudcommon/db/taskman/tasks.go b/pkg/cloudcommon/db/taskman/tasks.go index 0cc20d85da..d976d91cac 100644 --- a/pkg/cloudcommon/db/taskman/tasks.go +++ b/pkg/cloudcommon/db/taskman/tasks.go @@ -216,6 +216,10 @@ func (manager *STaskManager) NewParallelTask(ctx context.Context, taskName strin return nil, fmt.Errorf("task %s not found", taskName) } + if len(objs) == 0 { + return nil, fmt.Errorf("failed to do task %s with zero objs", taskName) + } + log.Debugf("number of objs: %d", len(objs)) lockman.LockClass(ctx, objs[0].GetModelManager(), userCred.GetProjectId()) defer lockman.ReleaseClass(ctx, objs[0].GetModelManager(), userCred.GetProjectId())