aboutsummaryrefslogtreecommitdiff
path: root/weed/topology
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2021-02-18 19:10:20 -0800
committerChris Lu <chris.lu@gmail.com>2021-02-18 19:10:20 -0800
commit73958e357dba827cd82e3ed8b277d865aae37a72 (patch)
tree94637c8e0a90419a4517128170198f61eccf545c /weed/topology
parent776f49746930ef3eabf8361886161f18ca3e2c8c (diff)
downloadseaweedfs-73958e357dba827cd82e3ed8b277d865aae37a72.tar.xz
seaweedfs-73958e357dba827cd82e3ed8b277d865aae37a72.zip
add descriptive error if no free volumes
Diffstat (limited to 'weed/topology')
-rw-r--r--weed/topology/volume_growth.go22
1 files changed, 12 insertions, 10 deletions
diff --git a/weed/topology/volume_growth.go b/weed/topology/volume_growth.go
index 4b0a4837e..8941a049b 100644
--- a/weed/topology/volume_growth.go
+++ b/weed/topology/volume_growth.go
@@ -1,6 +1,7 @@
package topology
import (
+ "encoding/json"
"fmt"
"github.com/chrislusf/seaweedfs/weed/storage/types"
"math/rand"
@@ -25,15 +26,15 @@ This package is created to resolve these replica placement issues:
*/
type VolumeGrowOption struct {
- Collection string
- ReplicaPlacement *super_block.ReplicaPlacement
- Ttl *needle.TTL
- DiskType types.DiskType
- Prealloacte int64
- DataCenter string
- Rack string
- DataNode string
- MemoryMapMaxSizeMb uint32
+ Collection string `json:"collection,omitempty"`
+ ReplicaPlacement *super_block.ReplicaPlacement `json:"replication,omitempty"`
+ Ttl *needle.TTL `json:"ttl,omitempty"`
+ DiskType types.DiskType `json:"disk,omitempty"`
+ Prealloacte int64 `json:"prealloacte,omitempty"`
+ DataCenter string `json:"dataCenter,omitempty"`
+ Rack string `json:"rack,omitempty"`
+ DataNode string `json:"dataNode,omitempty"`
+ MemoryMapMaxSizeMb uint32 `json:"memoryMapMaxSizeMb,omitempty"`
}
type VolumeGrowth struct {
@@ -41,7 +42,8 @@ type VolumeGrowth struct {
}
func (o *VolumeGrowOption) String() string {
- return fmt.Sprintf("Collection:%s, ReplicaPlacement:%v, Ttl:%v, DataCenter:%s, Rack:%s, DataNode:%s", o.Collection, o.ReplicaPlacement, o.Ttl, o.DataCenter, o.Rack, o.DataNode)
+ blob, _ := json.Marshal(o)
+ return string(blob)
}
func NewDefaultVolumeGrowth() *VolumeGrowth {