MCPcopy Create free account
hub / github.com/ClusterLabs/pacemaker / stage6

Function stage6

pengine/allocate.c:1248–1367  ·  view source on GitHub ↗

* Create dependancies for stonith and shutdown operations */

Source from the content-addressed store, hash-verified

1246 * Create dependancies for stonith and shutdown operations
1247 */
1248gboolean
1249stage6(pe_working_set_t * data_set)
1250{
1251 action_t *dc_down = NULL;
1252 action_t *dc_fence = NULL;
1253 action_t *stonith_op = NULL;
1254 action_t *last_stonith = NULL;
1255 gboolean integrity_lost = FALSE;
1256 action_t *all_stopped = get_pseudo_op(ALL_STOPPED, data_set);
1257 action_t *done = get_pseudo_op(STONITH_DONE, data_set);
1258 gboolean need_stonith = FALSE;
1259 GListPtr gIter = data_set->nodes;
1260
1261 crm_trace("Processing fencing and shutdown cases");
1262
1263 if (is_set(data_set->flags, pe_flag_stonith_enabled)
1264 && (is_set(data_set->flags, pe_flag_have_quorum)
1265 || data_set->no_quorum_policy == no_quorum_ignore
1266 || data_set->no_quorum_policy == no_quorum_suicide)) {
1267 need_stonith = TRUE;
1268 }
1269
1270 if (need_stonith && any_managed_resouces(data_set) == FALSE) {
1271 crm_notice("Delaying fencing operations until there are resources to manage");
1272 need_stonith = FALSE;
1273 }
1274
1275 for (; gIter != NULL; gIter = gIter->next) {
1276 node_t *node = (node_t *) gIter->data;
1277
1278 stonith_op = NULL;
1279 if (node->details->unclean && need_stonith) {
1280 pe_warn("Scheduling Node %s for STONITH", node->details->uname);
1281
1282 stonith_op = pe_fence_op(node, NULL, data_set);
1283
1284 stonith_constraints(node, stonith_op, data_set);
1285
1286 if (node->details->is_dc) {
1287 dc_down = stonith_op;
1288 dc_fence = stonith_op;
1289
1290 } else {
1291 if (last_stonith) {
1292 order_actions(last_stonith, stonith_op, pe_order_optional);
1293 }
1294 last_stonith = stonith_op;
1295 }
1296
1297 } else if (node->details->online && node->details->shutdown) {
1298 action_t *down_op = NULL;
1299
1300 crm_notice("Scheduling Node %s for shutdown", node->details->uname);
1301
1302 down_op = custom_action(NULL, strdup(CRM_OP_SHUTDOWN),
1303 CRM_OP_SHUTDOWN, node, FALSE, TRUE, data_set);
1304
1305 shutdown_constraints(node, down_op, data_set);

Callers 1

do_calculationsFunction · 0.85

Calls 10

get_pseudo_opFunction · 0.85
is_setFunction · 0.85
any_managed_resoucesFunction · 0.85
pe_fence_opFunction · 0.85
stonith_constraintsFunction · 0.85
order_actionsFunction · 0.85
custom_actionFunction · 0.85
shutdown_constraintsFunction · 0.85
add_hash_paramFunction · 0.85
find_actionsFunction · 0.85

Tested by

no test coverage detected