Skip to content

Commit 42960eb

Browse files
committed
cluster/apiserver - return alreadExists on prerunning in statWorkspace
1 parent d3a562b commit 42960eb

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

cluster/apiserver/apiserver/mains/workspace.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -513,13 +513,15 @@ func (s *Server) StartWorkspace(ctx context.Context, req *cordiumv1.StartWorkspa
513513
return nil, serr.Unauthorized("Workspace not owned by the User")
514514
}
515515

516-
spc, err := s.octeliumC.CordiumC().GetSpace(ctx, &rmetav1.GetOptions{
517-
Uid: ws.Status.SpaceRef.Uid,
518-
})
516+
spc, err := s.octeliumC.CordiumC().GetSpace(ctx, apivalidation.ObjectReferenceToRGetOptions(ws.Status.SpaceRef))
519517
if err != nil {
520518
return nil, grpcutils.K8sNotFoundOrInternalWithErr(err)
521519
}
522520

521+
if ucordiumv1.ToWorkspace(ws).IsPreRunning() || ucordiumv1.ToWorkspace(ws).IsRunning() {
522+
return nil, grpcutils.AlreadyExists("Workspace is already starting or running")
523+
}
524+
523525
if !ucordiumv1.ToWorkspace(ws).IsStopped() {
524526
return nil, serr.InvalidArg("Workspace cannot be started as it is not stopped")
525527
}

0 commit comments

Comments
 (0)