mirror of
https://gitee.com/rainbond/Rainbond.git
synced 2024-12-02 19:57:42 +08:00
[REV] optimize node reg to hosts,and optimize collect system info for master
This commit is contained in:
parent
0bee99c65a
commit
01b9bbef76
@ -87,7 +87,9 @@ func Run(c *option.Conf) error {
|
||||
logrus.Errorf(err.Error())
|
||||
return err
|
||||
}
|
||||
getInfoForMaster(s)
|
||||
if !s.HostNode.Role.HasRule("compute"){
|
||||
getInfoForMaster(s)
|
||||
}
|
||||
ms.Cluster.UpdateNode(s.HostNode)
|
||||
if err := ms.Start(); err != nil {
|
||||
logrus.Errorf(err.Error())
|
||||
|
@ -395,7 +395,7 @@ func (r *RNodeClient) handleErrAndCode(err error, code int) *util.APIHandleError
|
||||
return util.CreateAPIHandleError(code, err)
|
||||
}
|
||||
if code != 200 {
|
||||
return util.CreateAPIHandleError(code, fmt.Errorf("error with code %d", code))
|
||||
return util.CreateAPIHandleError(code, fmt.Errorf("error with code %d,details %s", code,err.Error()))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -196,6 +196,7 @@ func (n *NodeCluster) loadAndWatchNodes() error {
|
||||
if !node.Alived {
|
||||
node.Alived = true
|
||||
node.UpTime = time.Now()
|
||||
n.UpdateNode(node)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -226,15 +227,16 @@ func (n *NodeCluster) loadAndWatchNodes() error {
|
||||
if node := n.getNodeFromKey(string(ev.Kv.Key)); node != nil {
|
||||
node.Alived = true
|
||||
node.UpTime = time.Now()
|
||||
RegToHost(node, "add")
|
||||
//getInfoForMaster(node)
|
||||
n.UpdateNode(node)
|
||||
RegToHost(node, "add")
|
||||
}
|
||||
case ev.Type == client.EventTypeDelete:
|
||||
if node := n.getNodeFromKey(string(ev.Kv.Key)); node != nil {
|
||||
node.Alived = false
|
||||
node.DownTime = time.Now()
|
||||
RegToHost(node, "del")
|
||||
n.UpdateNode(node)
|
||||
RegToHost(node, "del")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user