Skip to content

Commit f3a5cb4

Browse files
clumensnrwahl2
authored andcommitted
Refactor: daemons: Remove the down_opts enum.
This has only ever had two values, which basically just means it's a bool.
1 parent 96e3d7f commit f3a5cb4

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

daemons/controld/controld_remote_ra.c

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -295,20 +295,15 @@ remote_node_up(const char *node_name)
295295
pcmk__xml_free(update);
296296
}
297297

298-
enum down_opts {
299-
DOWN_KEEP_LRM,
300-
DOWN_ERASE_LRM
301-
};
302-
303298
/*!
304299
* \internal
305300
* \brief Handle cluster communication related to pacemaker_remote node leaving
306301
*
307302
* \param[in] node_name Name of lost node
308-
* \param[in] opts Whether to keep or erase LRM history
303+
* \param[in] erase_lrm If \c true, erase the LRM history
309304
*/
310305
static void
311-
remote_node_down(const char *node_name, const enum down_opts opts)
306+
remote_node_down(const char *node_name, bool erase_lrm)
312307
{
313308
xmlNode *update;
314309
int call_opt = crmd_cib_smart_opt();
@@ -321,7 +316,7 @@ remote_node_down(const char *node_name, const enum down_opts opts)
321316
* up. However, after a successful fence, clear the history so we don't
322317
* think resources are still running on the node.
323318
*/
324-
if (opts == DOWN_ERASE_LRM) {
319+
if (erase_lrm) {
325320
controld_delete_node_history(node_name, false, call_opt);
326321
}
327322

@@ -381,7 +376,7 @@ check_remote_node_state(const remote_ra_cmd_t *cmd)
381376
if (ra_data) {
382377
if (!pcmk__is_set(ra_data->status, takeover_complete)) {
383378
/* Stop means down if we didn't successfully migrate elsewhere */
384-
remote_node_down(cmd->rsc_id, DOWN_KEEP_LRM);
379+
remote_node_down(cmd->rsc_id, false);
385380
} else if (AM_I_DC == FALSE) {
386381
/* Only the connection host and DC track node state,
387382
* so if the connection migrated elsewhere and we aren't DC,
@@ -659,7 +654,7 @@ remote_lrm_op_callback(lrmd_event_data_t * op)
659654
lrm_state->node_name);
660655
/* Do roughly what a 'stop' on the remote-resource would do */
661656
handle_remote_ra_stop(lrm_state, NULL);
662-
remote_node_down(lrm_state->node_name, DOWN_KEEP_LRM);
657+
remote_node_down(lrm_state->node_name, false);
663658
/* now fake the reply of a successful 'stop' */
664659
synthesize_lrmd_success(NULL, lrm_state->node_name,
665660
PCMK_ACTION_STOP);
@@ -1334,11 +1329,11 @@ remote_ra_process_pseudo(xmlNode *xml)
13341329
* peer cache state will be incorrect unless and until the guest is
13351330
* recovered.
13361331
*/
1337-
if (result) {
1332+
if (result != NULL) {
13381333
const char *remote = pcmk__xe_id(result);
13391334

1340-
if (remote) {
1341-
remote_node_down(remote, DOWN_ERASE_LRM);
1335+
if (remote != NULL) {
1336+
remote_node_down(remote, true);
13421337
}
13431338
}
13441339
}

0 commit comments

Comments
 (0)