[#1900] node: Do not override maintenance state on bootstrap

In previous implementation node always sent bootstrap requests with
"online" network state. This provoked switching to online of the nodes
under maintenance.

Signed-off-by: Leonard Lyubich <ctulhurider@gmail.com>
This commit is contained in:
Leonard Lyubich 2022-10-17 19:28:22 +04:00 committed by fyrchik
parent f76516a883
commit d96139b201

View file

@ -837,8 +837,22 @@ func (c *cfg) handleLocalNodeInfo(ni *netmap.NodeInfo) {
// bootstrap sets local node's netmap status to "online". // bootstrap sets local node's netmap status to "online".
func (c *cfg) bootstrap() error { func (c *cfg) bootstrap() error {
ni := c.cfgNodeInfo.localInfo ni := c.cfgNodeInfo.localInfo
// switch to online except when under maintenance
if st := c.cfgNetmap.state.controlNetmapStatus(); st == control.NetmapStatus_MAINTENANCE {
ni.SetMaintenance()
c.log.Info("bootstrap with untouched node state",
zap.Stringer("state", st),
)
} else {
ni.SetOnline() ni.SetOnline()
c.log.Info("bootstrapping with online state",
zap.Stringer("previous", st),
)
}
prm := nmClient.AddPeerPrm{} prm := nmClient.AddPeerPrm{}
prm.SetNodeInfo(ni) prm.SetNodeInfo(ni)