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

Function calculate_active_ops

lib/pengine/unpack.c:1398–1445  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1396}
1397
1398void
1399calculate_active_ops(GListPtr sorted_op_list, int *start_index, int *stop_index)
1400{
1401 int counter = -1;
1402 int implied_monitor_start = -1;
1403 int implied_master_start = -1;
1404 const char *task = NULL;
1405 const char *status = NULL;
1406 GListPtr gIter = sorted_op_list;
1407
1408 *stop_index = -1;
1409 *start_index = -1;
1410
1411 for (; gIter != NULL; gIter = gIter->next) {
1412 xmlNode *rsc_op = (xmlNode *) gIter->data;
1413
1414 counter++;
1415
1416 task = crm_element_value(rsc_op, XML_LRM_ATTR_TASK);
1417 status = crm_element_value(rsc_op, XML_LRM_ATTR_OPSTATUS);
1418
1419 if (safe_str_eq(task, CRMD_ACTION_STOP)
1420 && safe_str_eq(status, "0")) {
1421 *stop_index = counter;
1422
1423 } else if (safe_str_eq(task, CRMD_ACTION_START) ||
1424 safe_str_eq(task, CRMD_ACTION_MIGRATED)) {
1425 *start_index = counter;
1426
1427 } else if ((implied_monitor_start <= *stop_index) && safe_str_eq(task, CRMD_ACTION_STATUS)) {
1428 const char *rc = crm_element_value(rsc_op, XML_LRM_ATTR_RC);
1429
1430 if (safe_str_eq(rc, "0") || safe_str_eq(rc, "8")) {
1431 implied_monitor_start = counter;
1432 }
1433 } else if (safe_str_eq(task, CRMD_ACTION_PROMOTE) || safe_str_eq(task, CRMD_ACTION_DEMOTE)) {
1434 implied_master_start = counter;
1435 }
1436 }
1437
1438 if (*start_index == -1) {
1439 if (implied_master_start != -1) {
1440 *start_index = implied_master_start;
1441 } else if (implied_monitor_start != -1) {
1442 *start_index = implied_monitor_start;
1443 }
1444 }
1445}
1446
1447static void
1448unpack_lrm_rsc_state(node_t * node, xmlNode * rsc_entry, pe_working_set_t * data_set)

Callers 3

unpack_lrm_rsc_stateFunction · 0.85
extract_operationsFunction · 0.85
check_actions_forFunction · 0.85

Calls 1

crm_element_valueFunction · 0.85

Tested by

no test coverage detected