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

delay deletion of volume definitions #256

Merged
merged 1 commit into from
Apr 9, 2024
Merged
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
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
Loading