mirror of
https://github.com/minio/minio.git
synced 2024-12-26 23:25:54 -05:00
profiler: Download API returns error when all nodes fail (#6525)
When download profiling data API fails to gather profiling data from all nodes for any reason (including profiler not enabled), return 400 http code with the appropriate json message.
This commit is contained in:
parent
ed703c065d
commit
6c7c6bec91
@ -355,8 +355,7 @@ func (a adminAPIHandlers) DownloadProfilingHandler(w http.ResponseWriter, r *htt
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return 200 OK
|
profilingDataFound := false
|
||||||
w.WriteHeader(http.StatusOK)
|
|
||||||
|
|
||||||
// Initialize a zip writer which will provide a zipped content
|
// Initialize a zip writer which will provide a zipped content
|
||||||
// of profiling data of all nodes
|
// of profiling data of all nodes
|
||||||
@ -371,6 +370,8 @@ func (a adminAPIHandlers) DownloadProfilingHandler(w http.ResponseWriter, r *htt
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
profilingDataFound = true
|
||||||
|
|
||||||
// Send profiling data to zip as file
|
// Send profiling data to zip as file
|
||||||
header, err := zip.FileInfoHeader(dummyFileInfo{
|
header, err := zip.FileInfoHeader(dummyFileInfo{
|
||||||
name: fmt.Sprintf("profiling-%d", i),
|
name: fmt.Sprintf("profiling-%d", i),
|
||||||
@ -391,6 +392,11 @@ func (a adminAPIHandlers) DownloadProfilingHandler(w http.ResponseWriter, r *htt
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !profilingDataFound {
|
||||||
|
writeErrorResponseJSON(w, ErrAdminProfilerNotEnabled, r.URL)
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// extractHealInitParams - Validates params for heal init API.
|
// extractHealInitParams - Validates params for heal init API.
|
||||||
|
@ -291,6 +291,7 @@ const (
|
|||||||
ErrInvalidColumnIndex
|
ErrInvalidColumnIndex
|
||||||
ErrMissingHeaders
|
ErrMissingHeaders
|
||||||
ErrAdminConfigNotificationTargetsFailed
|
ErrAdminConfigNotificationTargetsFailed
|
||||||
|
ErrAdminProfilerNotEnabled
|
||||||
)
|
)
|
||||||
|
|
||||||
// error code to APIError structure, these fields carry respective
|
// error code to APIError structure, these fields carry respective
|
||||||
@ -892,6 +893,11 @@ var errorCodeResponse = map[APIErrorCode]APIError{
|
|||||||
Description: "Configuration update failed due an unsuccessful attempt to connect to one or more notification servers",
|
Description: "Configuration update failed due an unsuccessful attempt to connect to one or more notification servers",
|
||||||
HTTPStatusCode: http.StatusBadRequest,
|
HTTPStatusCode: http.StatusBadRequest,
|
||||||
},
|
},
|
||||||
|
ErrAdminProfilerNotEnabled: {
|
||||||
|
Code: "XMinioAdminProfilerNotEnabled",
|
||||||
|
Description: "Unable to perform the requested operation because profiling is not enabled",
|
||||||
|
HTTPStatusCode: http.StatusBadRequest,
|
||||||
|
},
|
||||||
ErrAdminCredentialsMismatch: {
|
ErrAdminCredentialsMismatch: {
|
||||||
Code: "XMinioAdminCredentialsMismatch",
|
Code: "XMinioAdminCredentialsMismatch",
|
||||||
Description: "Credentials in config mismatch with server environment variables",
|
Description: "Credentials in config mismatch with server environment variables",
|
||||||
|
Loading…
Reference in New Issue
Block a user