[#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>
support/v0.34
Leonard Lyubich 2022-10-17 19:28:22 +04:00 committed by fyrchik
parent f76516a883
commit d96139b201
1 changed files with 15 additions and 1 deletions

View File

@ -837,7 +837,21 @@ func (c *cfg) handleLocalNodeInfo(ni *netmap.NodeInfo) {
// bootstrap sets local node's netmap status to "online".
func (c *cfg) bootstrap() error {
ni := c.cfgNodeInfo.localInfo
ni.SetOnline()
// 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()
c.log.Info("bootstrapping with online state",
zap.Stringer("previous", st),
)
}
prm := nmClient.AddPeerPrm{}
prm.SetNodeInfo(ni)