From 4114028a6390dcc19254e6d675c1f48d30ea086c Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 1 Dec 2020 17:57:37 +0300 Subject: [PATCH] [#222] Add shard amount check There should be at least one correctly set up shard in node config. Signed-off-by: Alex Vanin --- cmd/neofs-node/config.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/neofs-node/config.go b/cmd/neofs-node/config.go index 987dfe359..eadc46ff5 100644 --- a/cmd/neofs-node/config.go +++ b/cmd/neofs-node/config.go @@ -449,6 +449,7 @@ func initShardOptions(c *cfg) { configPath(writeCachePrefix, cfgBlobStorTreePath), ) if useCache && writeCachePath == "" { + c.log.Warn("incorrect writeCache path, ignore shard") break } @@ -458,6 +459,7 @@ func initShardOptions(c *cfg) { configPath(blobPrefix, cfgBlobStorTreePath), ) if blobPath == "" { + c.log.Warn("incorrect blobStor path, ignore shard") break } @@ -545,6 +547,10 @@ func initShardOptions(c *cfg) { ) } + if len(opts) == 0 { + fatalOnErr(errors.New("no correctly set up shards, exit")) + } + c.cfgObject.cfgLocalStorage.shardOpts = opts }