Repository: minio/minio (language: go)

Issue:
Cannot show decom status for pool that's healing
When there's a pool that's currently healing, then `mc admin decom status alias` doesn't work. Specifically `mc admin decom status alias <pool>` doesn't work for that pool. Currently it triggers an mc segmentation fault (see https://github.com/minio/mc/issues/4141), but even after that is fixed, it would probably show an "invalid argument" error message that doesn't really tell much.

I think the underlying problem is that https://github.com/minio/minio/blob/RELEASE.2022-06-20T23-13-45Z/cmd/erasure-server-pool-decom.go#L900 is in the code path for `mc admin decom status`. Furthermore, this error isn't forwarded to the client (see https://github.com/minio/minio/blob/RELEASE.2022-06-20T23-13-45Z/cmd/erasure-server-pool-decom.go#L924), so the client cannot know that the ongoing healing operation is the problem. In any case, I think an ongoing healing operation shouldn't prevent showing the pool status.

Version used: 2022-06-20T23:13:45Z


Discussion / hints:
This is on purpose @haslersn for now - we haven't had the time to stabilize some things in certain areas

So running 

- Healing
- Decom 

At the same time can take quite a few IOPs from the system, so it is not advisable to do them together. Finish healing first to make sure namespace has the correct necessary state and then perform decomission. 

Decommission saves some states as objects on the namespace, if disks are in the partial healing stage there is potential for this decom state might get lost or lose HA to avoid such complications it is not yet finalized on how to do them safely. 

We may not get to this anytime soon.  However, regarding error let me see what we can return.. 

Fix patch:
diff --git a/cmd/admin-handlers-pools.go b/cmd/admin-handlers-pools.go
index f4aaf91e87d64..50e6cdec4a00b 100644
--- a/cmd/admin-handlers-pools.go
+++ b/cmd/admin-handlers-pools.go
@@ -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
 	}
 
diff --git a/cmd/erasure-server-pool-decom.go b/cmd/erasure-server-pool-decom.go
index d9e1d2a3b3898..f79ae869e0eff 100644
--- a/cmd/erasure-server-pool-decom.go
+++ b/cmd/erasure-server-pool-decom.go
@@ -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]


Test patch: