This commit is contained in:
zhoujunhao 2018-08-24 18:04:09 +08:00
parent 56adf09ca2
commit ee2afcc226

View File

@ -285,6 +285,7 @@ func (n *NodeService) InstallNode(nodeID string) *utils.APIHandleError {
func (n *NodeService) InitStatus(nodeIP string) (*model.InitStatus, *utils.APIHandleError) {
var hostnode client.HostNode
gotNode := false
var status model.InitStatus
i := 0
for !gotNode && i < 3 {
list, err := n.GetAllNode()
@ -305,14 +306,15 @@ func (n *NodeService) InitStatus(nodeIP string) (*model.InitStatus, *utils.APIHa
i++
}
if i != 10 {
return nil, utils.CreateAPIHandleError(400, fmt.Errorf("can't find node with given ip %s", nodeIP))
status.Status = 3
status.StatusCN = "等待节点加入集群中"
return &status, nil
}
nodeUID := hostnode.ID
node, err := n.GetNode(nodeUID)
if err != nil {
return nil, err
}
var status model.InitStatus
for _, val := range node.NodeStatus.Conditions {
if node.Alived || (val.Type == client.NodeInit && val.Status == client.ConditionTrue) {
status.Status = 0