@@ -1070,22 +1070,20 @@ func (m *Monitor) finalizeWorkspaceContent(ctx context.Context, wso *workspaceOb
1070
1070
return & csapi.GitStatus {}, nil
1071
1071
}
1072
1072
1073
- if pvcFeatureEnabled {
1074
- // only set status to started if we actually confirmed that workspace is ready and we are about to do actual disposal
1075
- // otherwise we risk overwriting previous disposal status
1076
- if ! markedDisposalStatusStarted {
1077
- statusStarted := & workspaceDisposalStatus {
1078
- Status : DisposalStarted ,
1079
- }
1080
- err = m .manager .markDisposalStatus (ctx , workspaceID , statusStarted )
1081
- if err != nil {
1082
- tracing .LogError (span , err )
1083
- log .WithError (err ).Error ("was unable to update pod's start disposal status - this might cause an incorrect disposal status" )
1084
- } else {
1085
- markedDisposalStatusStarted = true
1086
- }
1073
+ if ! markedDisposalStatusStarted {
1074
+ statusStarted := & workspaceDisposalStatus {
1075
+ Status : DisposalStarted ,
1087
1076
}
1077
+ err = m .manager .markDisposalStatus (ctx , workspaceID , statusStarted )
1078
+ if err != nil {
1079
+ tracing .LogError (span , err )
1080
+ log .WithError (err ).Error ("was unable to update pod's start disposal status - this might cause an incorrect disposal status" )
1081
+ } else {
1082
+ markedDisposalStatusStarted = true
1083
+ }
1084
+ }
1088
1085
1086
+ if pvcFeatureEnabled {
1089
1087
// pvc was created with the name of the pod. see createDefiniteWorkspacePod()
1090
1088
pvcName := wso .Pod .Name
1091
1089
if ! createdVolumeSnapshot {
@@ -1241,48 +1239,12 @@ func (m *Monitor) finalizeWorkspaceContent(ctx context.Context, wso *workspaceOb
1241
1239
deletedPVC = true
1242
1240
}
1243
1241
} else if doSnapshot {
1244
- // we're not yet finalizing - start the process
1245
1242
snc , err = m .manager .connectToWorkspaceDaemon (ctx , * wso )
1246
1243
if err != nil {
1247
1244
tracing .LogError (span , err )
1248
1245
return nil , status .Errorf (codes .Unavailable , "cannot connect to workspace daemon: %q" , err )
1249
1246
}
1250
1247
1251
- var workspaceExistsResult * wsdaemon.IsWorkspaceExistsResponse
1252
- workspaceExistsResult , err = snc .IsWorkspaceExists (ctx , & wsdaemon.IsWorkspaceExistsRequest {Id : workspaceID })
1253
- if err != nil {
1254
- tracing .LogError (span , err )
1255
- return nil , err
1256
- }
1257
- if ! workspaceExistsResult .Exists {
1258
- // nothing to backup, workspace does not exist
1259
- return nil , status .Error (codes .NotFound , "workspace does not exist" )
1260
- }
1261
-
1262
- // make sure that workspace was ready, otherwise there is no need to backup anything
1263
- // as we might backup corrupted workspace state
1264
- // this also ensures that if INITIALIZING still going, that we will wait for it to finish before disposing the workspace
1265
- _ , err = snc .WaitForInit (ctx , & wsdaemon.WaitForInitRequest {Id : workspaceID })
1266
- if err != nil {
1267
- tracing .LogError (span , err )
1268
- return nil , err
1269
- }
1270
-
1271
- // only set status to started if we actually confirmed that workspace is ready and we are about to do actual disposal
1272
- // otherwise we risk overwriting previous disposal status
1273
- if ! markedDisposalStatusStarted {
1274
- statusStarted := & workspaceDisposalStatus {
1275
- Status : DisposalStarted ,
1276
- }
1277
- err = m .manager .markDisposalStatus (ctx , workspaceID , statusStarted )
1278
- if err != nil {
1279
- tracing .LogError (span , err )
1280
- log .WithError (err ).Error ("was unable to update pod's start disposal status - this might cause an incorrect disposal status" )
1281
- } else {
1282
- markedDisposalStatusStarted = true
1283
- }
1284
- }
1285
-
1286
1248
// if this is a prebuild take a snapshot and mark the workspace
1287
1249
var res * wsdaemon.TakeSnapshotResponse
1288
1250
res , err = snc .TakeSnapshot (ctx , & wsdaemon.TakeSnapshotRequest {Id : workspaceID })
0 commit comments