| 1459 | } |
| 1460 | |
| 1461 | static void |
| 1462 | rsc_order_first(resource_t * lh_rsc, order_constraint_t * order, pe_working_set_t * data_set) |
| 1463 | { |
| 1464 | GListPtr gIter = NULL; |
| 1465 | GListPtr lh_actions = NULL; |
| 1466 | action_t *lh_action = order->lh_action; |
| 1467 | resource_t *rh_rsc = order->rh_rsc; |
| 1468 | |
| 1469 | crm_trace("Processing LH of ordering constraint %d", order->id); |
| 1470 | CRM_ASSERT(lh_rsc != NULL); |
| 1471 | |
| 1472 | if (lh_action != NULL) { |
| 1473 | lh_actions = g_list_prepend(NULL, lh_action); |
| 1474 | |
| 1475 | } else if (lh_action == NULL) { |
| 1476 | lh_actions = find_actions_by_task(lh_rsc->actions, lh_rsc, order->lh_action_task); |
| 1477 | } |
| 1478 | |
| 1479 | if (lh_actions == NULL && lh_rsc != rh_rsc) { |
| 1480 | char *key = NULL; |
| 1481 | char *rsc_id = NULL; |
| 1482 | char *op_type = NULL; |
| 1483 | int interval = 0; |
| 1484 | |
| 1485 | parse_op_key(order->lh_action_task, &rsc_id, &op_type, &interval); |
| 1486 | key = generate_op_key(lh_rsc->id, op_type, interval); |
| 1487 | |
| 1488 | if (lh_rsc->fns->state(lh_rsc, TRUE) != RSC_ROLE_STOPPED || safe_str_neq(op_type, RSC_STOP)) { |
| 1489 | pe_rsc_trace(lh_rsc, "No LH-Side (%s/%s) found for constraint %d with %s - creating", |
| 1490 | lh_rsc->id, order->lh_action_task, order->id, order->rh_action_task); |
| 1491 | lh_action = custom_action(lh_rsc, key, op_type, NULL, TRUE, TRUE, data_set); |
| 1492 | lh_actions = g_list_prepend(NULL, lh_action); |
| 1493 | } else { |
| 1494 | free(key); |
| 1495 | pe_rsc_trace(lh_rsc, "No LH-Side (%s/%s) found for constraint %d with %s - ignoring", |
| 1496 | lh_rsc->id, order->lh_action_task, order->id, order->rh_action_task); |
| 1497 | } |
| 1498 | |
| 1499 | free(op_type); |
| 1500 | free(rsc_id); |
| 1501 | } |
| 1502 | |
| 1503 | gIter = lh_actions; |
| 1504 | for (; gIter != NULL; gIter = gIter->next) { |
| 1505 | action_t *lh_action_iter = (action_t *) gIter->data; |
| 1506 | |
| 1507 | if (rh_rsc == NULL && order->rh_action) { |
| 1508 | rh_rsc = order->rh_action->rsc; |
| 1509 | } |
| 1510 | if (rh_rsc) { |
| 1511 | rsc_order_then(lh_action_iter, rh_rsc, order); |
| 1512 | |
| 1513 | } else if (order->rh_action) { |
| 1514 | order_actions(lh_action_iter, order->rh_action, order->type); |
| 1515 | } |
| 1516 | } |
| 1517 | |
| 1518 | g_list_free(lh_actions); |
no test coverage detected