forked from TrueCloudLab/frostfs-node
[#922] node: Block data ops of storage engine via Control API
There is a need to block execution of local object storage operations if node is put into maintenance mode (resume if the node is taken out of maintenance mode). Call `BlockExecution` method if `ControlService.SetNetmapStatus` was called with `MAINTENANCE` status. Call `ResumeExecution` if it was called with another status. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
29644e9bc2
commit
6b1ce99c35
1 changed files with 13 additions and 0 deletions
|
@ -252,7 +252,20 @@ 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")
|
||||
|
||||
func (c *cfg) SetNetmapStatus(st control.NetmapStatus) error {
|
||||
if st == control.NetmapStatus_MAINTENANCE {
|
||||
return c.cfgObject.cfgLocalStorage.localStorage.BlockExecution(errNodeMaintenance)
|
||||
}
|
||||
|
||||
err := c.cfgObject.cfgLocalStorage.localStorage.ResumeExecution()
|
||||
if err != nil {
|
||||
c.log.Error("failed to resume local object operations",
|
||||
zap.String("error", err.Error()),
|
||||
)
|
||||
}
|
||||
|
||||
if !c.needBootstrap() {
|
||||
return errRelayBootstrap
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue