From c543762e23d5f38dc90365f6e9c04abc5aa5c0d4 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Tue, 6 Oct 2020 09:05:30 -0700 Subject: [PATCH] volume: auto expands -max setting I have tried to run weed volume but got errors... cmd: weed volume -max=0 -mserver="127.0.0.1:9333" -port=8080 -dir="/var/www/d1/sfs,/var/www/d2/sfs,/var/www/d3/sfs" log: I1006 15:09:26 17040 file_util.go:23] Folder /var/www/d1/sfs Permission: -rwxr-xr-x I1006 15:09:26 17040 file_util.go:23] Folder /var/www/d2/sfs Permission: -rwxr-xr-x I1006 15:09:26 17040 file_util.go:23] Folder /var/www/d3/sfs Permission: -rwxr-xr-x F1006 15:09:26 17040 volume.go:142] 3 directories by -dir, but only 1 max is set by -max What am I doing wrong? Thx. --- weed/command/volume.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/weed/command/volume.go b/weed/command/volume.go index dfc649ba5..d73c24ed1 100644 --- a/weed/command/volume.go +++ b/weed/command/volume.go @@ -138,6 +138,11 @@ func (v VolumeServerOptions) startVolumeServer(volumeFolders, maxVolumeCounts, v glog.Fatalf("The max specified in -max not a valid number %s", maxString) } } + if len(v.folderMaxLimits) == 1 && len(v.folders) > 1 { + for i := 0; i < len(v.folders)-1; i++ { + v.folderMaxLimits = append(v.folderMaxLimits, v.folderMaxLimits[0]) + } + } if len(v.folders) != len(v.folderMaxLimits) { glog.Fatalf("%d directories by -dir, but only %d max is set by -max", len(v.folders), len(v.folderMaxLimits)) }