Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cannot initialize workspace: no backup found #9600

Merged
merged 2 commits into from
Apr 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions components/ws-daemon/pkg/content/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ func (s *WorkspaceService) DisposeWorkspace(ctx context.Context, req *api.Dispos

sess := s.store.Get(req.Id)
if sess == nil {
return nil, status.Error(codes.NotFound, "workspace does not exist")
return nil, status.Error(codes.NotFound, "cannot find workspace during DisposeWorkspace")
}

// We were asked to do a backup of a session that was never ready. There seems to have been some state drift here - tell the caller.
Expand Down Expand Up @@ -643,7 +643,7 @@ func (s *WorkspaceService) WaitForInit(ctx context.Context, req *api.WaitForInit

session := s.store.Get(req.Id)
if session == nil {
return nil, status.Error(codes.NotFound, "workspace does not exist")
return nil, status.Error(codes.NotFound, "cannot find workspace during WaitForInit")
}

// the next call will block until the workspace is initialized
Expand All @@ -664,7 +664,7 @@ func (s *WorkspaceService) TakeSnapshot(ctx context.Context, req *api.TakeSnapsh

sess := s.store.Get(req.Id)
if sess == nil {
return nil, status.Error(codes.NotFound, "workspace does not exist")
return nil, status.Error(codes.NotFound, "cannot find workspace during TakeSnapshot")
}
if !sess.IsReady() {
return nil, status.Error(codes.FailedPrecondition, "workspace is not ready")
Expand Down Expand Up @@ -725,7 +725,7 @@ func (s *WorkspaceService) BackupWorkspace(ctx context.Context, req *api.BackupW
// i.e. location = /mnt/disks/ssd0/workspaces- + req.Id
// It would also need to setup the remote storagej
// ... but in the worse case we *could* backup locally and then upload manually
return nil, status.Error(codes.NotFound, "workspace does not exist")
return nil, status.Error(codes.NotFound, "cannot find workspace during BackupWorkspace")
}
if sess.RemoteStorageDisabled {
return nil, status.Errorf(codes.FailedPrecondition, "workspace has no remote storage")
Expand Down
3 changes: 2 additions & 1 deletion components/ws-manager/pkg/manager/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,9 @@ func actOnPodEvent(ctx context.Context, m actingManager, status *api.WorkspaceSt
}

_, gone := wso.Pod.Annotations[wsk8s.ContainerIsGoneAnnotation]
_, alreadyFinalized := wso.Pod.Annotations[disposalStatusAnnotation]

if terminated || gone {
if (terminated || gone) && !alreadyFinalized {
// We start finalizing the workspace content only after the container is gone. This way we ensure there's
// no process modifying the workspace content as we create the backup.
go m.finalizeWorkspaceContent(ctx, wso)
Expand Down