Skip to content

Commit b11472d

Browse files
authored
Merge pull request #3981 from nrwahl2/nrwahl2-controller_first
Drop things from controller
2 parents e53ccac + 5494b7d commit b11472d

23 files changed

+226
-606
lines changed

daemons/controld/controld_attrd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ handle_attr_error(void)
5555

5656
} else if (pcmk__is_set(controld_globals.fsa_input_register, R_SHUTDOWN)) {
5757
// Fast-track shutdown since unable to request via attribute
58-
register_fsa_input(C_FSA_INTERNAL, I_FAIL, NULL);
58+
controld_fsa_append(C_FSA_INTERNAL, I_FAIL, NULL);
5959
}
6060
}
6161

daemons/controld/controld_callbacks.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ crmd_ha_msg_filter(xmlNode * msg)
4646

4747
level = LOG_WARNING;
4848
new_input.msg = msg;
49-
register_fsa_error_adv(C_FSA_INTERNAL, I_ELECTION, NULL, &new_input,
49+
register_fsa_error_adv(I_ELECTION, NULL, &new_input,
5050
__func__);
5151
}
5252

@@ -228,7 +228,7 @@ peer_update_callback(enum pcmk__node_update type, pcmk__node_status_t *node,
228228
if (!appeared && controld_is_local_node(node->name)) {
229229
/* Did we get evicted? */
230230
crm_notice("Our peer connection failed");
231-
register_fsa_input(C_CRMD_STATUS_CALLBACK, I_ERROR, NULL);
231+
controld_fsa_append(C_CRMD_STATUS_CALLBACK, I_ERROR, NULL);
232232

233233
} else if (pcmk__str_eq(node->name, controld_globals.dc_name,
234234
pcmk__str_casei)
@@ -244,7 +244,7 @@ peer_update_callback(enum pcmk__node_update type, pcmk__node_status_t *node,
244244
crm_notice("Our peer on the DC (%s) is dead",
245245
controld_globals.dc_name);
246246

247-
register_fsa_input(C_CRMD_STATUS_CALLBACK, I_ELECTION, NULL);
247+
controld_fsa_append(C_CRMD_STATUS_CALLBACK, I_ELECTION, NULL);
248248
controld_delete_node_state(node->name, controld_section_attrs,
249249
cib_none);
250250

@@ -276,7 +276,7 @@ peer_update_callback(enum pcmk__node_update type, pcmk__node_status_t *node,
276276
alive, appeared, (down? down->id : -1));
277277

278278
if (appeared && (alive > 0) && !is_remote) {
279-
register_fsa_input_before(C_FSA_INTERNAL, I_NODE_JOIN, NULL);
279+
controld_fsa_prepend(C_FSA_INTERNAL, I_NODE_JOIN, NULL);
280280
}
281281

282282
if (down) {

daemons/controld/controld_cib.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ handle_cib_disconnect(gpointer user_data)
3838
if (pcmk__is_set(controld_globals.fsa_input_register, R_CIB_CONNECTED)) {
3939
// @TODO This should trigger a reconnect, not a shutdown
4040
crm_crit("Lost connection to the CIB manager, shutting down");
41-
register_fsa_input(C_FSA_INTERNAL, I_ERROR, NULL);
41+
controld_fsa_append(C_FSA_INTERNAL, I_ERROR, NULL);
4242
controld_clear_fsa_input_flags(R_CIB_CONNECTED);
4343

4444
} else { // Expected
@@ -91,7 +91,7 @@ do_cib_updated(const char *event, xmlNode * msg)
9191

9292
populate_cib_nodes(controld_node_update_quick|controld_node_update_all,
9393
__func__);
94-
register_fsa_input(C_FSA_INTERNAL, I_ELECTION, NULL);
94+
controld_fsa_append(C_FSA_INTERNAL, I_ELECTION, NULL);
9595
}
9696
}
9797

@@ -195,7 +195,7 @@ do_cib_control(long long action,
195195
} else {
196196
crm_err("Could not complete CIB registration %d times... "
197197
"hard error", cib_retries);
198-
register_fsa_error(C_FSA_INTERNAL, I_ERROR, NULL);
198+
register_fsa_error(I_ERROR);
199199
}
200200
}
201201
}

daemons/controld/controld_control.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ do_ha_control(long long action,
7979

8080
if (!registered) {
8181
controld_set_fsa_input_flags(R_HA_DISCONNECTED);
82-
register_fsa_error(C_FSA_INTERNAL, I_ERROR, NULL);
82+
register_fsa_error(I_ERROR);
8383
return;
8484
}
8585

@@ -122,7 +122,7 @@ do_shutdown_req(long long action,
122122
CRM_SYSTEM_CRMD, CRM_OP_SHUTDOWN_REQ, NULL);
123123

124124
if (!pcmk__cluster_send_message(NULL, pcmk_ipc_controld, msg)) {
125-
register_fsa_error(C_FSA_INTERNAL, I_ERROR, NULL);
125+
register_fsa_error(I_ERROR);
126126
}
127127
pcmk__xml_free(msg);
128128
}
@@ -349,7 +349,7 @@ do_startup(long long action,
349349

350350
lrm_state_init_local();
351351
if (controld_init_fsa_timers() == FALSE) {
352-
register_fsa_error(C_FSA_INTERNAL, I_ERROR, NULL);
352+
register_fsa_error(I_ERROR);
353353
}
354354
}
355355

@@ -456,7 +456,7 @@ do_stop(long long action,
456456
{
457457
crm_trace("Closing IPC server");
458458
mainloop_del_ipc_server(ipcs); ipcs = NULL;
459-
register_fsa_input(C_FSA_INTERNAL, I_TERMINATE, NULL);
459+
controld_fsa_append(C_FSA_INTERNAL, I_TERMINATE, NULL);
460460
}
461461

462462
/* A_STARTED */
@@ -516,15 +516,15 @@ do_started(long long action,
516516
ipcs = pcmk__serve_controld_ipc(&crmd_callbacks);
517517
if (ipcs == NULL) {
518518
crm_err("Failed to create IPC server: shutting down and inhibiting respawn");
519-
register_fsa_error(C_FSA_INTERNAL, I_ERROR, NULL);
519+
register_fsa_error(I_ERROR);
520520
} else {
521521
crm_notice("Pacemaker controller successfully started and accepting connections");
522522
}
523523
controld_set_fsa_input_flags(R_ST_REQUIRED);
524524
controld_timer_fencer_connect(GINT_TO_POINTER(TRUE));
525525

526526
controld_clear_fsa_input_flags(R_STARTING);
527-
register_fsa_input(msg_data->fsa_cause, I_PENDING, NULL);
527+
controld_fsa_append(msg_data->fsa_cause, I_PENDING, NULL);
528528
}
529529

530530
/* A_RECOVER */
@@ -536,7 +536,7 @@ do_recover(long long action,
536536
controld_set_fsa_input_flags(R_IN_RECOVERY);
537537
crm_warn("Fast-tracking shutdown in response to errors");
538538

539-
register_fsa_input(C_FSA_INTERNAL, I_TERMINATE, NULL);
539+
controld_fsa_append(C_FSA_INTERNAL, I_TERMINATE, NULL);
540540
}
541541

542542
static void
@@ -555,7 +555,7 @@ config_query_callback(xmlNode * msg, int call_id, int rc, xmlNode * output, void
555555
fsa_data_t *msg_data = NULL;
556556

557557
crm_err("Local CIB query resulted in an error: %s", pcmk_strerror(rc));
558-
register_fsa_error(C_FSA_INTERNAL, I_ERROR, NULL);
558+
register_fsa_error(I_ERROR);
559559

560560
if (rc == -EACCES || rc == -pcmk_err_schema_validation) {
561561
crm_err("The cluster is mis-configured - shutting down and staying down");
@@ -573,7 +573,7 @@ config_query_callback(xmlNode * msg, int call_id, int rc, xmlNode * output, void
573573
fsa_data_t *msg_data = NULL;
574574

575575
crm_err("Local CIB query for " PCMK_XE_CRM_CONFIG " section failed");
576-
register_fsa_error(C_FSA_INTERNAL, I_ERROR, NULL);
576+
register_fsa_error(I_ERROR);
577577
goto bail;
578578
}
579579

@@ -696,12 +696,12 @@ crm_shutdown(int nsig)
696696

697697
if (pcmk__is_set(controld_globals.fsa_input_register, R_SHUTDOWN)) {
698698
crm_err("Escalating shutdown");
699-
register_fsa_input_before(C_SHUTDOWN, I_ERROR, NULL);
699+
controld_fsa_prepend(C_SHUTDOWN, I_ERROR, NULL);
700700
return;
701701
}
702702

703703
controld_set_fsa_input_flags(R_SHUTDOWN);
704-
register_fsa_input(C_SHUTDOWN, I_SHUTDOWN, NULL);
704+
controld_fsa_append(C_SHUTDOWN, I_SHUTDOWN, NULL);
705705

706706
/* If shutdown timer doesn't have a period set, use the default
707707
*

daemons/controld/controld_election.c

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
static void
2323
election_win_cb(pcmk_cluster_t *cluster)
2424
{
25-
register_fsa_input(C_FSA_INTERNAL, I_ELECTION_DC, NULL);
25+
controld_fsa_append(C_FSA_INTERNAL, I_ELECTION_DC, NULL);
2626
}
2727

2828
void
@@ -100,12 +100,8 @@ do_election_vote(long long action,
100100
}
101101

102102
if (not_voting) {
103-
if (AM_I_DC) {
104-
register_fsa_input(C_FSA_INTERNAL, I_RELEASE_DC, NULL);
105-
106-
} else {
107-
register_fsa_input(C_FSA_INTERNAL, I_PENDING, NULL);
108-
}
103+
controld_fsa_append(C_FSA_INTERNAL, (AM_I_DC? I_RELEASE_DC : I_PENDING),
104+
NULL);
109105
return;
110106
}
111107

@@ -134,7 +130,7 @@ do_election_count_vote(long long action,
134130
enum crmd_fsa_input current_input, fsa_data_t * msg_data)
135131
{
136132
enum election_result rc = 0;
137-
ha_msg_input_t *vote = fsa_typed_data(fsa_dt_ha_msg);
133+
ha_msg_input_t *vote = NULL;
138134

139135
if (pcmk__peer_cache == NULL) {
140136
if (!pcmk__is_set(controld_globals.fsa_input_register, R_SHUTDOWN)) {
@@ -143,12 +139,15 @@ do_election_count_vote(long long action,
143139
return;
144140
}
145141

142+
pcmk__assert((msg_data != NULL) && (msg_data->data != NULL));
143+
vote = msg_data->data;
144+
146145
rc = election_count_vote(controld_globals.cluster, vote->msg,
147146
(cur_state != S_STARTING));
148147
switch(rc) {
149148
case election_start:
150149
election_reset(controld_globals.cluster);
151-
register_fsa_input(C_FSA_INTERNAL, I_ELECTION, NULL);
150+
controld_fsa_append(C_FSA_INTERNAL, I_ELECTION, NULL);
152151
break;
153152

154153
case election_lost:
@@ -157,11 +156,11 @@ do_election_count_vote(long long action,
157156
if (pcmk__is_set(controld_globals.fsa_input_register, R_THE_DC)) {
158157
cib_t *cib_conn = controld_globals.cib_conn;
159158

160-
register_fsa_input(C_FSA_INTERNAL, I_RELEASE_DC, NULL);
159+
controld_fsa_append(C_FSA_INTERNAL, I_RELEASE_DC, NULL);
161160
cib_conn->cmds->set_secondary(cib_conn, cib_none);
162161

163162
} else if (cur_state != S_STARTING) {
164-
register_fsa_input(C_FSA_INTERNAL, I_PENDING, NULL);
163+
controld_fsa_append(C_FSA_INTERNAL, I_PENDING, NULL);
165164
}
166165
break;
167166

@@ -178,7 +177,7 @@ feature_update_callback(xmlNode * msg, int call_id, int rc, xmlNode * output, vo
178177

179178
crm_notice("Feature update failed: %s " QB_XS " rc=%d",
180179
pcmk_strerror(rc), rc);
181-
register_fsa_error(C_FSA_INTERNAL, I_ERROR, NULL);
180+
register_fsa_error(I_ERROR);
182181
}
183182
}
184183

@@ -269,7 +268,7 @@ do_dc_release(long long action,
269268
fsa_cib_anon_update_discard_reply(PCMK_XE_STATUS, update);
270269
pcmk__xml_free(update);
271270
}
272-
register_fsa_input(C_FSA_INTERNAL, I_RELEASE_SUCCESS, NULL);
271+
controld_fsa_append(C_FSA_INTERNAL, I_RELEASE_SUCCESS, NULL);
273272

274273
} else {
275274
crm_err("Unknown DC action %s", fsa_action2string(action));

daemons/controld/controld_execd.c

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ lrm_connection_destroy(void)
5151
{
5252
if (pcmk__is_set(controld_globals.fsa_input_register, R_LRM_CONNECTED)) {
5353
crm_crit("Lost connection to local executor");
54-
register_fsa_input(C_FSA_INTERNAL, I_ERROR, NULL);
54+
controld_fsa_append(C_FSA_INTERNAL, I_ERROR, NULL);
5555
controld_clear_fsa_input_flags(R_LRM_CONNECTED);
5656
}
5757
}
@@ -339,7 +339,7 @@ try_local_executor_connect(long long action, fsa_data_t *msg_data,
339339
"%d time%s: %s", lrm_state->num_lrm_register_fails,
340340
pcmk__plural_s(lrm_state->num_lrm_register_fails),
341341
pcmk_rc_str(rc));
342-
register_fsa_error(C_FSA_INTERNAL, I_ERROR, NULL);
342+
register_fsa_error(I_ERROR);
343343
}
344344

345345
/* A_LRM_CONNECT */
@@ -361,7 +361,7 @@ do_lrm_control(long long action,
361361
}
362362
lrm_state = controld_get_executor_state(NULL, true);
363363
if (lrm_state == NULL) {
364-
register_fsa_error(C_FSA_INTERNAL, I_ERROR, NULL);
364+
register_fsa_error(I_ERROR);
365365
return;
366366
}
367367

@@ -953,7 +953,7 @@ get_lrm_resource(lrm_state_t *lrm_state, const xmlNode *rsc_xml,
953953
* remote node, which is not an FSA failure.
954954
*/
955955
if (lrm_state_is_local(lrm_state) == TRUE) {
956-
register_fsa_error(C_FSA_INTERNAL, I_FAIL, NULL);
956+
register_fsa_error(I_FAIL);
957957
}
958958
return rc;
959959
}
@@ -1386,24 +1386,25 @@ metadata_complete(int pid, const pcmk__action_result_t *result, void *user_data)
13861386
free_metadata_cb_data(data);
13871387
}
13881388

1389-
/* A_LRM_INVOKE */
13901389
void
1391-
do_lrm_invoke(long long action,
1392-
enum crmd_fsa_cause cause,
1393-
enum crmd_fsa_state cur_state,
1394-
enum crmd_fsa_input current_input, fsa_data_t * msg_data)
1390+
controld_invoke_execd(fsa_data_t *msg_data)
13951391
{
13961392
lrm_state_t *lrm_state = NULL;
13971393
const char *crm_op = NULL;
13981394
const char *from_sys = NULL;
13991395
const char *from_host = NULL;
14001396
const char *operation = NULL;
1401-
ha_msg_input_t *input = fsa_typed_data(fsa_dt_ha_msg);
14021397
const char *user_name = NULL;
1403-
const char *target_node = lrm_op_target(input->xml);
1398+
ha_msg_input_t *input = NULL;
1399+
const char *target_node = NULL;
14041400
gboolean is_remote_node = FALSE;
14051401
bool crm_rsc_delete = FALSE;
14061402

1403+
pcmk__assert((msg_data != NULL) && (msg_data->data != NULL));
1404+
1405+
input = msg_data->data;
1406+
target_node = lrm_op_target(input->xml);
1407+
14071408
// Message routed to the local node is targeting a specific, non-local node
14081409
is_remote_node = !controld_is_local_node(target_node);
14091410

@@ -1568,7 +1569,7 @@ do_lrm_invoke(long long action,
15681569
} else {
15691570
crm_err("Invalid execution request: unknown command '%s' (bug?)",
15701571
crm_op);
1571-
register_fsa_error(C_FSA_INTERNAL, I_ERROR, NULL);
1572+
register_fsa_error(I_ERROR);
15721573
}
15731574
}
15741575

@@ -1871,7 +1872,7 @@ should_nack_action(const char *action)
18711872
if (pcmk__is_set(controld_globals.fsa_input_register, R_SHUTDOWN)
18721873
&& pcmk__str_eq(action, PCMK_ACTION_START, pcmk__str_none)) {
18731874

1874-
register_fsa_input(C_SHUTDOWN, I_SHUTDOWN, NULL);
1875+
controld_fsa_append(C_SHUTDOWN, I_SHUTDOWN, NULL);
18751876
return "Not attempting start due to shutdown in progress";
18761877
}
18771878

@@ -2031,7 +2032,7 @@ do_lrm_rsc_op(lrm_state_t *lrm_state, lrmd_rsc_info_t *rsc, xmlNode *msg,
20312032
fake_op_status(lrm_state, op, PCMK_EXEC_NOT_CONNECTED,
20322033
PCMK_OCF_UNKNOWN_ERROR, pcmk_rc_str(rc));
20332034
process_lrm_event(lrm_state, op, NULL, NULL);
2034-
register_fsa_error(C_FSA_INTERNAL, I_FAIL, NULL);
2035+
register_fsa_error(I_FAIL);
20352036

20362037
} else {
20372038
crm_err("Could not initiate %s action for resource %s remotely on %s: "

daemons/controld/controld_execd_state.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,9 @@ lrm_state_cancel(lrm_state_t *lrm_state, const char *rsc_id, const char *action,
681681
}
682682

683683
/* Figure out a way to make this async?
684-
* NOTICE: Currently it's synced and directly acknowledged in do_lrm_invoke(). */
684+
* NOTICE: Currently it's synced and directly acknowledged in
685+
* controld_invoke_execd().
686+
*/
685687
if (is_remote_lrmd_ra(NULL, NULL, rsc_id)) {
686688
return remote_ra_cancel(lrm_state, rsc_id, action, interval_ms);
687689
}

0 commit comments

Comments
 (0)