@@ -54,11 +54,9 @@ save_cib_contents(xmlNode *msg, int call_id, int rc, xmlNode *output,
5454 id );
5555
5656 if (pcmk__xml_write_file (output , filename , true) != pcmk_rc_ok ) {
57- crm_err ("Could not save Cluster Information Base to %s after scheduler crash" ,
58- filename );
57+ crm_err ("Could not save CIB to %s after scheduler crash" , filename );
5958 } else {
60- crm_notice ("Saved Cluster Information Base to %s after scheduler crash" ,
61- filename );
59+ crm_notice ("Saved CIB to %s after scheduler crash" , filename );
6260 }
6361 free (filename );
6462 }
@@ -79,18 +77,14 @@ handle_disconnect(void)
7977 char * uuid_str = pcmk__generate_uuid ();
8078
8179 crm_crit ("Lost connection to the scheduler "
82- QB_XS " CIB will be saved to " PCMK_SCHEDULER_INPUT_DIR "/pe-core-%s.bz2" ,
80+ QB_XS " CIB will be saved to "
81+ PCMK_SCHEDULER_INPUT_DIR "/pe-core-%s.bz2" ,
8382 uuid_str );
8483
85- /*
86- * The scheduler died...
87- *
88- * Save the current CIB so that we have a chance of
89- * figuring out what killed it.
90- *
91- * Delay raising the I_ERROR until the query below completes or
92- * 5s is up, whichever comes first.
84+ /* Save the current CIB so that we have a chance of figuring out what
85+ * killed the scheduler.
9386 *
87+ * Delay registering an I_ERROR until the query completes or times out.
9488 */
9589 rc = controld_globals .cib_conn -> cmds -> query (controld_globals .cib_conn ,
9690 NULL , NULL , cib_none );
@@ -99,7 +93,6 @@ handle_disconnect(void)
9993
10094 controld_clear_fsa_input_flags (R_PE_CONNECTED );
10195 controld_trigger_fsa ();
102- return ;
10396}
10497
10598static void
@@ -111,25 +104,28 @@ handle_reply(pcmk_schedulerd_api_reply_t *reply)
111104 return ;
112105 }
113106
107+ pcmk__assert (reply != NULL );
114108 msg_ref = reply -> data .graph .reference ;
115109
116110 if (msg_ref == NULL ) {
117- crm_err ("%s - Ignoring calculation with no reference", CRM_OP_PECALC );
111+ crm_err (CRM_OP_PECALC " - Ignoring calculation with no reference" );
118112
119113 } else if (pcmk__str_eq (msg_ref , controld_globals .fsa_pe_ref ,
120114 pcmk__str_none )) {
121- ha_msg_input_t fsa_input ;
122- xmlNode * crm_data_node ;
115+ ha_msg_input_t fsa_input = { NULL , NULL } ;
116+ xmlNode * crm_data_node = NULL ;
123117
124118 controld_stop_sched_timer ();
125119
126- /* do_te_invoke (which will eventually process the fsa_input we are constructing
127- * here) requires that fsa_input.xml be non-NULL. That will only happen if
128- * copy_ha_msg_input (which is called by register_fsa_input_adv) sees the
129- * fsa_input.msg that it is expecting. The scheduler's IPC dispatch function
130- * gave us the values we need, we just need to put them into XML.
120+ /* do_te_invoke() (which will eventually process the fsa_input we are
121+ * constructing here) requires that fsa_input.xml be non-NULL. That will
122+ * happen only if copy_ha_msg_input() (which is called by
123+ * register_fsa_input_adv()) sees the fsa_input.msg that it is
124+ * expecting. The scheduler's IPC dispatch function gave us the values
125+ * we need, so we just need to put them into XML.
131126 *
132- * The name of the top level element here is irrelevant. Nothing checks it.
127+ * The name of the top-level element here is irrelevant. Nothing checks
128+ * it.
133129 */
134130 fsa_input .msg = pcmk__xe_create (NULL , "dummy-reply" );
135131 pcmk__xe_set (fsa_input .msg , PCMK_XA_REFERENCE , msg_ref );
@@ -151,15 +147,13 @@ static void
151147scheduler_event_callback (pcmk_ipc_api_t * api , enum pcmk_ipc_event event_type ,
152148 crm_exit_t status , void * event_data , void * user_data )
153149{
154- pcmk_schedulerd_api_reply_t * reply = event_data ;
155-
156150 switch (event_type ) {
157151 case pcmk_ipc_event_disconnect :
158152 handle_disconnect ();
159153 break ;
160154
161155 case pcmk_ipc_event_reply :
162- handle_reply (reply );
156+ handle_reply (( pcmk_schedulerd_api_reply_t * ) event_data );
163157 break ;
164158
165159 default :
@@ -170,7 +164,7 @@ scheduler_event_callback(pcmk_ipc_api_t *api, enum pcmk_ipc_event event_type,
170164static bool
171165new_schedulerd_ipc_connection (void )
172166{
173- int rc ;
167+ int rc = pcmk_rc_ok ;
174168
175169 controld_set_fsa_input_flags (R_PE_REQUIRED );
176170
@@ -185,7 +179,8 @@ new_schedulerd_ipc_connection(void)
185179
186180 pcmk_register_ipc_callback (schedulerd_api , scheduler_event_callback , NULL );
187181
188- rc = pcmk__connect_ipc_retry_conrefused (schedulerd_api , pcmk_ipc_dispatch_main , 3 );
182+ rc = pcmk__connect_ipc_retry_conrefused (schedulerd_api ,
183+ pcmk_ipc_dispatch_main , 3 );
189184 if (rc != pcmk_rc_ok ) {
190185 crm_err ("Error connecting to %s: %s" ,
191186 pcmk_ipc_name (schedulerd_api , true), pcmk_rc_str (rc ));
@@ -214,23 +209,24 @@ controld_shutdown_schedulerd_ipc(void)
214209static void do_pe_invoke_callback (xmlNode * msg , int call_id , int rc ,
215210 xmlNode * output , void * user_data );
216211
217- /* A_PE_START, A_PE_STOP, O_PE_RESTART */
212+ // A_PE_START, A_PE_STOP, O_PE_RESTART
218213void
219- do_pe_control (long long action ,
220- enum crmd_fsa_cause cause ,
221- enum crmd_fsa_state cur_state ,
222- enum crmd_fsa_input current_input , fsa_data_t * msg_data )
214+ do_pe_control (long long action , enum crmd_fsa_cause cause ,
215+ enum crmd_fsa_state cur_state , enum crmd_fsa_input current_input ,
216+ fsa_data_t * msg_data )
223217{
224218 if (pcmk__is_set (action , A_PE_STOP )) {
225219 controld_clear_fsa_input_flags (R_PE_REQUIRED );
226220 pcmk_disconnect_ipc (schedulerd_api );
227221 handle_disconnect ();
228222 }
223+
229224 if (pcmk__is_set (action , A_PE_START )
230225 && !pcmk__is_set (controld_globals .fsa_input_register , R_PE_CONNECTED )) {
231226
232227 if (cur_state == S_STOPPING ) {
233- crm_info ("Ignoring request to connect to scheduler while shutting down" );
228+ crm_info ("Ignoring request to connect to scheduler while shutting "
229+ "down" );
234230
235231 } else if (!new_schedulerd_ipc_connection ()) {
236232 crm_warn ("Could not connect to scheduler" );
0 commit comments