[#1916] control: Check maintenance allowance on Control server

In previous implementation turning to maintenance mode using NeoFS CLI
required NeoFS API endpoint. This was not convenient from the user
perspective. It's worth to move networks settings' check to the server
side.

Add `force_maintenance` field to `SetNetmapStatusRequest.Body` message
of Control API. Add `force` flag to `neofs-cli control set-status`
command which sets corresponding field in the requests body if status is
`maintenance`. Force flag is ignored for any other status.

Signed-off-by: Leonard Lyubich <ctulhurider@gmail.com>
This commit is contained in:
Leonard Lyubich 2022-10-18 19:42:14 +04:00 committed by LeL
parent c50603494b
commit 60e9de8d63
10 changed files with 346 additions and 272 deletions

View file

@ -34,7 +34,15 @@ type HealthChecker interface {
// NodeState is an interface of storage node network state.
type NodeState interface {
SetNetmapStatus(control.NetmapStatus) error
// SetNetmapStatus switches the storage node to the given network status.
//
// If status is control.NetmapStatus_MAINTENANCE and maintenance is allowed
// in the network settings, the node additionally starts local maintenance.
SetNetmapStatus(st control.NetmapStatus) error
// ForceMaintenance works like SetNetmapStatus(control.NetmapStatus_MAINTENANCE)
// but starts local maintenance regardless of the network settings.
ForceMaintenance() error
}
// Option of the Server's constructor.