aboutsummaryrefslogtreecommitdiff
path: root/weed/server/master_server_handlers_admin.go
diff options
context:
space:
mode:
authorChris Lu <chrislusf@users.noreply.github.com>2019-10-31 08:58:45 -0700
committerGitHub <noreply@github.com>2019-10-31 08:58:45 -0700
commit08c83b1a594f9270c75b1d42bc3bb583b38b2916 (patch)
treecc5c6fb841ebf5391dd09cad0126b211a62d367b /weed/server/master_server_handlers_admin.go
parent8479452934bb54441d0a6cf52ad64b7099bcdc6d (diff)
parent1294999d8b60b6ee8f562264c19caa95391371b0 (diff)
downloadseaweedfs-08c83b1a594f9270c75b1d42bc3bb583b38b2916.tar.xz
seaweedfs-08c83b1a594f9270c75b1d42bc3bb583b38b2916.zip
Merge pull request #1099 from iliul/enhanced-api-logic
enhanced master api logic
Diffstat (limited to 'weed/server/master_server_handlers_admin.go')
-rw-r--r--weed/server/master_server_handlers_admin.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/weed/server/master_server_handlers_admin.go b/weed/server/master_server_handlers_admin.go
index 486bf31f4..a5d976008 100644
--- a/weed/server/master_server_handlers_admin.go
+++ b/weed/server/master_server_handlers_admin.go
@@ -18,9 +18,10 @@ import (
)
func (ms *MasterServer) collectionDeleteHandler(w http.ResponseWriter, r *http.Request) {
- collection, ok := ms.Topo.FindCollection(r.FormValue("collection"))
+ collectionName := r.FormValue("collection")
+ collection, ok := ms.Topo.FindCollection(collectionName)
if !ok {
- writeJsonError(w, r, http.StatusBadRequest, fmt.Errorf("collection %s does not exist", r.FormValue("collection")))
+ writeJsonError(w, r, http.StatusBadRequest, fmt.Errorf("collection %s does not exist", collectionName))
return
}
for _, server := range collection.ListVolumeServers() {
@@ -35,7 +36,10 @@ func (ms *MasterServer) collectionDeleteHandler(w http.ResponseWriter, r *http.R
return
}
}
- ms.Topo.DeleteCollection(r.FormValue("collection"))
+ ms.Topo.DeleteCollection(collectionName)
+
+ w.WriteHeader(http.StatusNoContent)
+ return
}
func (ms *MasterServer) dirStatusHandler(w http.ResponseWriter, r *http.Request) {
@@ -53,6 +57,7 @@ func (ms *MasterServer) volumeVacuumHandler(w http.ResponseWriter, r *http.Reque
gcThreshold, err = strconv.ParseFloat(gcString, 32)
if err != nil {
glog.V(0).Infof("garbageThreshold %s is not a valid float number: %v", gcString, err)
+ writeJsonError(w, r, http.StatusNotAcceptable, fmt.Errorf("garbageThreshold %s is not a valid float number", gcString))
return
}
}