tier: Add force param to force tiering removal (#20355)

Currently, it is not possible to remove a tier if it is not accessible
or contains some data, add a force flag to make the removal successful
in that case.
This commit is contained in:
Anis Eleuch
2024-09-12 21:44:05 +01:00
committed by GitHub
parent 398ffb1136
commit e47d787adb
4 changed files with 13 additions and 9 deletions

View File

@@ -198,12 +198,14 @@ func (api adminAPIHandlers) RemoveTierHandler(w http.ResponseWriter, r *http.Req
vars := mux.Vars(r)
tier := vars["tier"]
force := r.Form.Get("force") == "true"
if err := globalTierConfigMgr.Reload(ctx, objAPI); err != nil {
writeErrorResponseJSON(ctx, w, toAdminAPIErr(ctx, err), r.URL)
return
}
if err := globalTierConfigMgr.Remove(ctx, tier); err != nil {
if err := globalTierConfigMgr.Remove(ctx, tier, force); err != nil {
writeErrorResponseJSON(ctx, w, toAdminAPIErr(ctx, err), r.URL)
return
}