Example #1
0
func (e eccListener) NotifyNodeUpdate(nType ecc.NotifyUpdateType, nodeAddress string) {
	if nType == ecc.NOTIFY_UPDATE_ADD {
		log.Infof("New Node joined the cluster : %s", nodeAddress)
		AddPeer(nodeAddress)
	} else if nType == ecc.NOTIFY_UPDATE_DELETE {
		log.Infof("Node left the cluster : %s", nodeAddress)
		DeletePeer(nodeAddress)
	}
}
Example #2
0
func (d *Daemon) identifyInterfaceToBind() *net.Interface {
	// If the user isnt binding an interface using --iface option and let the daemon to
	// identify the interface, the daemon will try its best to identify the best interface
	// for the job.
	// In a few auto-install / zerotouch config scenarios, eligible interfaces may
	// be identified after the socketplane daemon is up and running.

	for {
		var intf *net.Interface
		if d.clusterListener != "" {
			intf, _ = net.InterfaceByName(d.clusterListener)
		} else {
			intf = InterfaceToBind()
		}
		if intf != nil {
			return intf
		}
		time.Sleep(time.Second * 5)
		log.Infof("Identifying interface to bind ... Use --iface option for static binding")
	}
	return nil
}