diff --git a/pkg/spaces/service.go b/pkg/spaces/service.go index e77cd813387acb1cf8c4dfc95bf795422ac8732c..14f1cef1acc68a21844649940e833848393e75bc 100644 --- a/pkg/spaces/service.go +++ b/pkg/spaces/service.go @@ -63,3 +63,14 @@ func IsSpaceAvailable(ctx context.Context, spcs Spaces, spaceId string) error { return nil } + +func CheckState(ctx context.Context, spcs Spaces, spaceID string) error { + sp, err := spcs.Get(ctx, spaceID) + if err != nil { + return errors.Wrap(err, "fail to get space") + } + if sp.State == StateMigration { + return errors.Errorf("space '%s' is migrating, fail to do operation", sp.ID) + } + return nil +}