[#1681] node: Block only Object service ops under maintenance

In previous implementation node blocked any operation of local object
storage in maintenance mode. There is a need to perform some storage
operations like data evacuation or restoration.

Do not call block storage engine in maintenance mode. Make all Object
service operations to return `apistatus.NodeUnderMaintenance` error from
each local op.

Signed-off-by: Leonard Lyubich <ctulhurider@gmail.com>
This commit is contained in:
Leonard Lyubich 2022-10-04 17:01:16 +04:00 committed by fyrchik
parent 082602b668
commit 713aea06fa
8 changed files with 86 additions and 31 deletions

View file

@ -8,6 +8,8 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/engine"
internal "github.com/nspcc-dev/neofs-node/pkg/services/object/internal/client"
internalclient "github.com/nspcc-dev/neofs-node/pkg/services/object/internal/client"
"github.com/nspcc-dev/neofs-node/pkg/services/object/util"
apistatus "github.com/nspcc-dev/neofs-sdk-go/client/status"
"github.com/nspcc-dev/neofs-sdk-go/object"
)
@ -26,6 +28,8 @@ type clientWrapper struct {
}
type storageEngineWrapper struct {
state util.NodeState
engine *engine.StorageEngine
}
@ -170,6 +174,11 @@ func (c *clientWrapper) getObject(exec *execCtx, info coreclient.NodeInfo) (*obj
}
func (e *storageEngineWrapper) get(exec *execCtx) (*object.Object, error) {
if e.state != nil && e.state.IsMaintenance() {
var st apistatus.NodeUnderMaintenance
return nil, st
}
if exec.headOnly() {
var headPrm engine.HeadPrm
headPrm.WithAddress(exec.address())