From d6c01199c864f50e9122fe555ed25660456cb3b5 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 19 Sep 2022 21:52:15 +0400 Subject: [PATCH] [#1680] node: Return `MAINTENANCE` status in corresponding mode Make storage node to return `NODE_UNDER_MAINTENANCE` status error on each local object operation if the node is in `MAINTENANCE` mode. Pass `apistatus.NodeUnderMaintenance` to `StorageEngine.BlockExecution` during `ControlService.SetNetmapStatus` RPC processing. Signed-off-by: Leonard Lyubich --- cmd/neofs-node/netmap.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/neofs-node/netmap.go b/cmd/neofs-node/netmap.go index 7b0057f35..1587e7bfe 100644 --- a/cmd/neofs-node/netmap.go +++ b/cmd/neofs-node/netmap.go @@ -16,6 +16,7 @@ import ( netmapTransportGRPC "github.com/nspcc-dev/neofs-node/pkg/network/transport/netmap/grpc" "github.com/nspcc-dev/neofs-node/pkg/services/control" netmapService "github.com/nspcc-dev/neofs-node/pkg/services/netmap" + apistatus "github.com/nspcc-dev/neofs-sdk-go/client/status" netmapSDK "github.com/nspcc-dev/neofs-sdk-go/netmap" subnetid "github.com/nspcc-dev/neofs-sdk-go/subnet/id" "github.com/nspcc-dev/neofs-sdk-go/version" @@ -318,7 +319,7 @@ func addNewEpochAsyncNotificationHandler(c *cfg, h event.Handler) { var errRelayBootstrap = errors.New("setting netmap status is forbidden in relay mode") -var errNodeMaintenance = errors.New("node is in maintenance mode") +var errNodeMaintenance apistatus.NodeUnderMaintenance func (c *cfg) SetNetmapStatus(st control.NetmapStatus) error { switch st {