aboutsummaryrefslogtreecommitdiff
path: root/weed/server/master_server_handlers_admin.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2021-02-09 11:38:42 -0800
committerChris Lu <chris.lu@gmail.com>2021-02-09 11:38:42 -0800
commit2bf5ea87d6788fc1b82d36ffaed42ce0345b955e (patch)
treeb83fdc9ec478696ff43ebdf05f556ac6cd4e5724 /weed/server/master_server_handlers_admin.go
parentd221a937df38ff587e2392a313681b0a0f48138b (diff)
parent821c46edf10097200b986bd17dc01d3991cf57ff (diff)
downloadseaweedfs-2bf5ea87d6788fc1b82d36ffaed42ce0345b955e.tar.xz
seaweedfs-2bf5ea87d6788fc1b82d36ffaed42ce0345b955e.zip
Merge branch 'support_ssd_volume'
Diffstat (limited to 'weed/server/master_server_handlers_admin.go')
-rw-r--r--weed/server/master_server_handlers_admin.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/weed/server/master_server_handlers_admin.go b/weed/server/master_server_handlers_admin.go
index 34235384f..7b1ec1f87 100644
--- a/weed/server/master_server_handlers_admin.go
+++ b/weed/server/master_server_handlers_admin.go
@@ -3,6 +3,7 @@ package weed_server
import (
"context"
"fmt"
+ "github.com/chrislusf/seaweedfs/weed/storage"
"math/rand"
"net/http"
"strconv"
@@ -75,8 +76,8 @@ func (ms *MasterServer) volumeGrowHandler(w http.ResponseWriter, r *http.Request
}
if count, err = strconv.Atoi(r.FormValue("count")); err == nil {
- if ms.Topo.FreeSpace() < int64(count*option.ReplicaPlacement.GetCopyCount()) {
- err = fmt.Errorf("only %d volumes left, not enough for %d", ms.Topo.FreeSpace(), count*option.ReplicaPlacement.GetCopyCount())
+ if ms.Topo.AvailableSpaceFor(option) < int64(count*option.ReplicaPlacement.GetCopyCount()) {
+ err = fmt.Errorf("only %d volumes left, not enough for %d", ms.Topo.AvailableSpaceFor(option), count*option.ReplicaPlacement.GetCopyCount())
} else {
count, err = ms.vg.GrowByCountAndType(ms.grpcDialOption, count, option, ms.Topo)
}
@@ -136,7 +137,7 @@ func (ms *MasterServer) submitFromMasterServerHandler(w http.ResponseWriter, r *
}
func (ms *MasterServer) HasWritableVolume(option *topology.VolumeGrowOption) bool {
- vl := ms.Topo.GetVolumeLayout(option.Collection, option.ReplicaPlacement, option.Ttl)
+ vl := ms.Topo.GetVolumeLayout(option.Collection, option.ReplicaPlacement, option.Ttl, option.DiskType)
return vl.GetActiveVolumeCount(option) > 0
}
@@ -157,6 +158,10 @@ func (ms *MasterServer) getVolumeGrowOption(r *http.Request) (*topology.VolumeGr
if err != nil {
return nil, err
}
+ diskType, err := storage.ToDiskType(r.FormValue("disk"))
+ if err != nil {
+ return nil, err
+ }
preallocate := ms.preallocateSize
if r.FormValue("preallocate") != "" {
@@ -169,6 +174,7 @@ func (ms *MasterServer) getVolumeGrowOption(r *http.Request) (*topology.VolumeGr
Collection: r.FormValue("collection"),
ReplicaPlacement: replicaPlacement,
Ttl: ttl,
+ DiskType: diskType,
Prealloacte: preallocate,
DataCenter: r.FormValue("dataCenter"),
Rack: r.FormValue("rack"),