return appropriate error under 'decom status' (#15213)

fixes #15208
This commit is contained in:
Harshavardhana 2022-07-01 16:21:23 -07:00 committed by GitHub
parent 0ea5c9d8e8
commit 0fee993a4b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -19,6 +19,7 @@ package cmd
import (
"encoding/json"
"fmt"
"net/http"
"github.com/gorilla/mux"
@ -149,8 +150,10 @@ func (a adminAPIHandlers) StatusPool(w http.ResponseWriter, r *http.Request) {
idx := globalEndpoints.GetPoolIdx(v)
if idx == -1 {
apiErr := toAdminAPIErr(ctx, errInvalidArgument)
apiErr.Description = fmt.Sprintf("specified pool '%s' not found, please specify a valid pool", v)
// We didn't find any matching pools, invalid input
writeErrorResponseJSON(ctx, w, toAdminAPIErr(ctx, errInvalidArgument), r.URL)
writeErrorResponseJSON(ctx, w, apiErr, r.URL)
return
}

View file

@ -921,7 +921,7 @@ func (z *erasureServerPools) Status(ctx context.Context, idx int) (PoolStatus, e
pi, err := z.getDecommissionPoolSpaceInfo(idx)
if err != nil {
return PoolStatus{}, errInvalidArgument
return PoolStatus{}, err
}
poolInfo := z.poolMeta.Pools[idx]