Skip to content

Commit

Permalink
delay deletion of volume definitions
Browse files Browse the repository at this point in the history
We delete the volume definition in order to have resource definitions without
resources. This is useful when we want to keep snapshots without having the
associated resources around.

During the volume deletion, we first delete the volume definition. This may be
causing a bug in DRBD 9.2, so we delay the deletion until after all resources
are gone, at which point DRBD has fully shut down the resource.

Signed-off-by: Moritz Wanzenböck <[email protected]>
  • Loading branch information
WanzenBug committed Mar 29, 2024
1 parent 8168c98 commit 16c206a
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions pkg/client/linstor.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,13 +372,6 @@ func (s *Linstor) Delete(ctx context.Context, volId string) error {
"volume": volId,
}).Info("deleting volume")

// Delete the volume definition. This marks a resources as being in the process of deletion.
err := s.client.ResourceDefinitions.DeleteVolumeDefinition(ctx, volId, 0)
if nil404(err) != nil {
// We continue with the cleanup on 404, maybe the previous cleanup was interrupted
return err
}

resources, err := s.client.Resources.GetAll(ctx, volId)
if err != nil {
return nil404(err)
Expand All @@ -398,6 +391,13 @@ func (s *Linstor) Delete(ctx context.Context, volId string) error {
}
}

// Delete the volume definition. This indicates the normal deletion is complete.
err = s.client.ResourceDefinitions.DeleteVolumeDefinition(ctx, volId, 0)
if nil404(err) != nil {
// We continue with the cleanup on 404, maybe the previous cleanup was interrupted
return err
}

err = s.deleteResourceDefinitionAndGroupIfUnused(ctx, volId)
if err != nil {
return err
Expand Down

0 comments on commit 16c206a

Please sign in to comment.