forked from TrueCloudLab/frostfs-node
[#1680] ir/netmap: Correlate node's state with network settings
Inner Ring should allow registering of storage nodes with `MAINTENANCE` state in the NeoFS network only if its configuration allows this status. Make `networkSettings.MaintenanceModeAllowed` to call `MaintenanceModeAllowed` method of underlying Netmap contract's client in order to assert state allowance. From now nodes will be accepted to the network with `MAINTENANCE` state only with the appropriate network configuration. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
876e132d22
commit
6b99f2a0df
1 changed files with 9 additions and 0 deletions
|
@ -1,6 +1,8 @@
|
||||||
package innerring
|
package innerring
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/innerring/processors/netmap/nodevalidation/state"
|
"github.com/nspcc-dev/neofs-node/pkg/innerring/processors/netmap/nodevalidation/state"
|
||||||
netmapclient "github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap"
|
netmapclient "github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap"
|
||||||
)
|
)
|
||||||
|
@ -16,5 +18,12 @@ type networkSettings netmapclient.Client
|
||||||
// and check allowance of storage node's maintenance mode according to it.
|
// and check allowance of storage node's maintenance mode according to it.
|
||||||
// Always returns state.ErrMaintenanceModeDisallowed.
|
// Always returns state.ErrMaintenanceModeDisallowed.
|
||||||
func (s *networkSettings) MaintenanceModeAllowed() error {
|
func (s *networkSettings) MaintenanceModeAllowed() error {
|
||||||
|
allowed, err := (*netmapclient.Client)(s).MaintenanceModeAllowed()
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("read maintenance mode's allowance from the Sidechain: %w", err)
|
||||||
|
} else if allowed {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
return state.ErrMaintenanceModeDisallowed
|
return state.ErrMaintenanceModeDisallowed
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue