def p_dispatch_nodes(): nodeIp = None ldap_ip = utility.get_ldap_server() clusterInfo = OpenLdap.p_get_clusterInfo_by_ccIp(ldap_ip,g_cc_ip) if clusterInfo!=None: nodes = OpenLdap.p_get_nodeInfo_by_clusterName(ldap_ip,clusterInfo.clusterName) if nodes!=None and len(nodes)>0: nodeIp = nodes[0].hostIp return nodeIp
def run(self): logger.debug('p_get_nodeInfo_byClusterName_thread start ....') global g_nc_heart_beat while True: ldap_ip = utility.get_ldap_server() ret = OpenLdap.p_is_register(ldap_ip,thd_SERVICE_TYPE.CLOUD_CC,utility.get_local_publicip()) if ret: clusterInfo = OpenLdap.p_get_clusterInfo_by_ccIp(ldap_ip,g_cc_ip) if clusterInfo != None: nodeList = OpenLdap.p_get_nodeInfo_by_clusterName(ldap_ip,clusterInfo.clusterName) if nodeList != None: for nodeInfo in nodeList: g_nc_heart_beat[nodeInfo.hostIp] = time.time() break time.sleep(HEART_BEAT_INTV) logger.debug('waiting in p_get_nodeInfo_byClusterName_thread()!!!')