⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 control.c

📁 linux集群服务器软件代码包
💻 C
📖 第 1 页 / 共 2 页
字号:
		if(te_subsystem != NULL) {		te_subsystem->pid      = -1;			te_subsystem->path     = BIN_DIR;		te_subsystem->name     = CRM_SYSTEM_TENGINE;		te_subsystem->command  = BIN_DIR"/"CRM_SYSTEM_TENGINE;		te_subsystem->args     = NULL;		te_subsystem->flag_connected = R_TE_CONNECTED;			te_subsystem->flag_required  = R_TE_REQUIRED;				} else {		was_error = TRUE;	}		if(pe_subsystem != NULL) {		pe_subsystem->pid      = -1;			pe_subsystem->path     = BIN_DIR;		pe_subsystem->name     = CRM_SYSTEM_PENGINE;		pe_subsystem->command  = BIN_DIR"/"CRM_SYSTEM_PENGINE;		pe_subsystem->args     = NULL;		pe_subsystem->flag_connected = R_PE_CONNECTED;			pe_subsystem->flag_required  = R_PE_REQUIRED;				} else {		was_error = TRUE;	}	if(was_error) {		register_fsa_error(C_FSA_INTERNAL, I_ERROR, NULL);	}		return I_NULL;}/*	 A_STOP	*/enum crmd_fsa_inputdo_stop(long long action,	enum crmd_fsa_cause cause,	enum crmd_fsa_state cur_state,	enum crmd_fsa_input current_input,	fsa_data_t *msg_data){	/* nothing to do yet */	/* todo: shut down any remaining CRM resources */		return I_NULL;}/*	 A_STARTED	*/enum crmd_fsa_inputdo_started(long long action,	   enum crmd_fsa_cause cause,	   enum crmd_fsa_state cur_state,	   enum crmd_fsa_input current_input,	   fsa_data_t *msg_data){	if(is_set(fsa_input_register, R_CCM_DATA) == FALSE) {		crm_info("Delaying start, CCM (%.16llx) not connected",			 R_CCM_DATA);		crmd_fsa_stall();		return I_NULL;	} else if(is_set(fsa_input_register, R_LRM_CONNECTED) == FALSE) {		crm_info("Delaying start, LRM (%.16llx) not connected",			 R_LRM_CONNECTED);		crmd_fsa_stall();		return I_NULL;	} else if(is_set(fsa_input_register, R_CIB_CONNECTED) == FALSE) {		crm_info("Delaying start, CIB (%.16llx) not connected",			 R_CIB_CONNECTED);		crmd_fsa_stall();		return I_NULL;	} else if(is_set(fsa_input_register, R_PEER_DATA) == FALSE) {		HA_Message *	msg = NULL;		/* try reading from HA */		crm_info("Delaying start, Peer data (%.16llx) not recieved",			 R_PEER_DATA);		crm_devel("Looking for a HA message");		msg = fsa_cluster_conn->llc_ops->readmsg(fsa_cluster_conn, 0);		if(msg != NULL) {			crm_devel("There was a HA message"); 			crm_msg_del(msg);		}				startTimer(wait_timer);		crmd_fsa_stall();		return I_NULL;	}	crm_info("The local CRM is operational");	clear_bit_inplace(fsa_input_register, R_STARTING);	register_fsa_input(msg_data->fsa_cause, I_PENDING, NULL);		return I_NULL;}/*	 A_RECOVER	*/enum crmd_fsa_inputdo_recover(long long action,	   enum crmd_fsa_cause cause,	   enum crmd_fsa_state cur_state,	   enum crmd_fsa_input current_input,	   fsa_data_t *msg_data){	crm_err("Action %s (%.16llx) not supported\n",	       fsa_action2string(action), action);	register_fsa_input(C_FSA_INTERNAL, I_SHUTDOWN, NULL);	return I_NULL;}/*	 A_READCONFIG	*/enum crmd_fsa_inputdo_read_config(long long action,	       enum crmd_fsa_cause cause,	       enum crmd_fsa_state cur_state,	       enum crmd_fsa_input current_input,	       fsa_data_t *msg_data){	crm_data_t *cib_copy = get_cib_copy(fsa_cib_conn);	crm_data_t *config   = get_object_root(XML_CIB_TAG_CRMCONFIG, cib_copy);	xml_child_iter(		config, iter, XML_CIB_TAG_NVPAIR,		const char *name  = crm_element_value(iter, XML_NVPAIR_ATTR_NAME);		const char *value = crm_element_value(iter, XML_NVPAIR_ATTR_VALUE);		if(name == NULL || value == NULL) {			continue;					} else if(safe_str_eq(name, XML_CONFIG_ATTR_DC_BEAT)) {			dc_heartbeat->period_ms = atoi(value);					} else if(safe_str_eq(name, XML_CONFIG_ATTR_DC_DEADTIME)) {			election_trigger->period_ms = atoi(value);		} else if(safe_str_eq(name, XML_CONFIG_ATTR_FORCE_QUIT)) {			shutdown_escalation_timer->period_ms = atoi(value);		} else if(safe_str_eq(name, XML_CONFIG_ATTR_REANNOUNCE)) {			fsa_join_reannouce = atoi(value);		}		);			if(dc_heartbeat->period_ms < 1) {		/* sensible default */		dc_heartbeat->period_ms = 1000;			}	if(fsa_join_reannouce < 0) {		fsa_join_reannouce = 100; /* how many times should we let					   * go by before reannoucning					   * ourselves to the DC					   */	}		election_timeout->period_ms   = dc_heartbeat->period_ms * 6;	integration_timer->period_ms  = dc_heartbeat->period_ms * 6;	finalization_timer->period_ms = dc_heartbeat->period_ms * 6;		if(election_trigger->period_ms < 1	   || election_trigger->period_ms > election_timeout->period_ms) {		/* sensible default */		election_trigger->period_ms = election_timeout->period_ms * 2;	}		if(shutdown_escalation_timer->period_ms < 1	   || election_timeout->period_ms > shutdown_escalation_timer->period_ms) {		/* sensible default */		shutdown_escalation_timer->period_ms			= election_timeout->period_ms * 3 * 100;	}	return I_NULL;}gbooleancrm_shutdown(int nsig, gpointer unused){	if (crmd_mainloop != NULL && g_main_is_running(crmd_mainloop)) {		if(is_set(fsa_input_register, R_SHUTDOWN)) {			crm_err("Escalating the shutdown");			register_fsa_input_before(C_SHUTDOWN, I_ERROR, NULL);			s_crmd_fsa(C_SHUTDOWN);		} else {			set_bit_inplace(fsa_input_register, R_SHUTDOWN);			set_bit_inplace(fsa_input_register, R_STAYDOWN);			/* fast track the case where no-one else is out there */			if(AM_I_DC) {				election_timeout->fsa_input = I_TERMINATE;			}			if(is_set(fsa_input_register, R_SHUTDOWN)) {				/* cant rely on this... */				startTimer(shutdown_escalation_timer);				register_fsa_input(C_SHUTDOWN, I_SHUTDOWN, NULL);			s_crmd_fsa(C_SHUTDOWN);			} else {				crm_err("Could not set R_SHUTDOWN");				exit(LSB_EXIT_ENOTSUPPORTED);			}		}			} else {		crm_info("exit from shutdown");		exit(LSB_EXIT_OK);	    	}	return TRUE;}gbooleanregister_with_ha(ll_cluster_t *hb_cluster, const char *client_name){	int facility;		if(safe_val3(NULL, hb_cluster, llc_ops, errmsg) == NULL) {		crm_crit("cluster errmsg function unavailable");	}		crm_info("Signing in with Heartbeat");	if (hb_cluster->llc_ops->signon(hb_cluster, client_name)!= HA_OK) {		crm_err("Cannot sign on with heartbeat: %s",			hb_cluster->llc_ops->errmsg(hb_cluster));		return FALSE;	}	/* change the logging facility to the one used by heartbeat daemon */	crm_info("Switching to Heartbeat logger");	if (( facility =	      hb_cluster->llc_ops->get_logfacility(hb_cluster)) > 0) {		cl_log_set_facility(facility); 	}		crm_verbose("Facility: %d", facility);	  	crm_devel("Be informed of CRM messages");	if (HA_OK != hb_cluster->llc_ops->set_msg_callback(		    hb_cluster, T_CRM, crmd_ha_msg_callback, hb_cluster)){				crm_err("Cannot set msg callback: %s",			hb_cluster->llc_ops->errmsg(hb_cluster));		return FALSE;	}#if 0	crm_devel("Be informed of Node Status changes");	if (HA_OK != hb_cluster->llc_ops->set_nstatus_callback(		    hb_cluster, crmd_ha_status_callback, hb_cluster)){				crm_err("Cannot set nstatus callback: %s",			hb_cluster->llc_ops->errmsg(hb_cluster));		return FALSE;	}#endif		crm_devel("Be informed of CRM Client Status changes");	if (HA_OK != hb_cluster->llc_ops->set_cstatus_callback(		    hb_cluster, crmd_client_status_callback, hb_cluster)) {		crm_err("Cannot set cstatus callback: %s\n",			hb_cluster->llc_ops->errmsg(hb_cluster));		return FALSE;	}	crm_info("beekhof: Client Status callback set");	crm_devel("Adding channel to mainloop");	G_main_add_IPC_Channel(		G_PRIORITY_HIGH, hb_cluster->llc_ops->ipcchan(hb_cluster),		FALSE, crmd_ha_msg_dispatch, hb_cluster /* userdata  */,  		crmd_ha_connection_destroy);	crm_devel("Finding our node name");	if ((fsa_our_uname =	     hb_cluster->llc_ops->get_mynodeid(hb_cluster)) == NULL) {		crm_err("get_mynodeid() failed");		return FALSE;	}	crm_info("FSA Hostname: %s", fsa_our_uname);	/* Async get client status information in the cluster */	crm_devel("Requesting an initial dump of CRMD client_status");	crm_info("beekhof: Requesting Client Status");	fsa_cluster_conn->llc_ops->client_status(		fsa_cluster_conn, NULL, CRM_SYSTEM_CRMD, -1);		return TRUE;    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -