Skip to content

Commit

Permalink
feat: add status handling for DatabaseSnapshotCannotDeleteInUseError …
Browse files Browse the repository at this point in the history
…error and update comment

Signed-off-by: hlts2 <[email protected]>
  • Loading branch information
hlts2 committed Nov 26, 2024
1 parent 9a1e756 commit f8e810a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/driver/controller_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ func (d *Driver) CreateSnapshot(context.Context, *csi.CreateSnapshotRequest) (*c
return nil, status.Error(codes.Unimplemented, "")
}

// DeleteSnapshot is part of implementing Snapshot & Restore functionality, but we don't support that
// DeleteSnapshot is part of implementing Snapshot & Restore functionality, and it will be supported in the future.
func (d *Driver) DeleteSnapshot(ctx context.Context, req *csi.DeleteSnapshotRequest) (*csi.DeleteSnapshotResponse, error) {
log.Info().
Str("snapshot_id", req.GetSnapshotId()).
Expand All @@ -613,6 +613,8 @@ func (d *Driver) DeleteSnapshot(ctx context.Context, req *csi.DeleteSnapshotRequ
// Str("volume_id", snapshotID).
// Msg("Snapshot already deleted from Civo API")
// return &csi.DeleteSnapshotResponse{}, nil
// } else if strings.Contains(err.Error(), "DatabaseSnapshotCannotDeleteInUseError") {
// return nil, status.Errorf(codes.FailedPrecondition, "failed to delete snapshot %q, it is currently in use, err: %s", snapshotID, err)
// }
// return nil, status.Errorf(codes.Internal, "failed to delete snapshot %q, err: %s", snapshotID, err)
// }
Expand Down

0 comments on commit f8e810a

Please sign in to comment.