| 1457 | } |
| 1458 | |
| 1459 | static lrmd_event_data_t * |
| 1460 | construct_op(xmlNode * rsc_op, const char *rsc_id, const char *operation) |
| 1461 | { |
| 1462 | lrmd_event_data_t *op = NULL; |
| 1463 | const char *op_delay = NULL; |
| 1464 | const char *op_timeout = NULL; |
| 1465 | const char *op_interval = NULL; |
| 1466 | GHashTable *params = NULL; |
| 1467 | |
| 1468 | const char *transition = NULL; |
| 1469 | |
| 1470 | CRM_LOG_ASSERT(rsc_id != NULL); |
| 1471 | |
| 1472 | op = calloc(1, sizeof(lrmd_event_data_t)); |
| 1473 | op->type = lrmd_event_exec_complete; |
| 1474 | op->op_type = strdup(operation); |
| 1475 | op->op_status = PCMK_LRM_OP_PENDING; |
| 1476 | op->rc = -1; |
| 1477 | op->rsc_id = strdup(rsc_id); |
| 1478 | op->interval = 0; |
| 1479 | op->timeout = 0; |
| 1480 | op->start_delay = 0; |
| 1481 | |
| 1482 | if (rsc_op == NULL) { |
| 1483 | CRM_LOG_ASSERT(safe_str_eq(CRMD_ACTION_STOP, operation)); |
| 1484 | op->user_data = NULL; |
| 1485 | /* the stop_all_resources() case |
| 1486 | * by definition there is no DC (or they'd be shutting |
| 1487 | * us down). |
| 1488 | * So we should put our version here. |
| 1489 | */ |
| 1490 | op->params = g_hash_table_new_full(crm_str_hash, g_str_equal, |
| 1491 | g_hash_destroy_str, g_hash_destroy_str); |
| 1492 | |
| 1493 | g_hash_table_insert(op->params, |
| 1494 | strdup(XML_ATTR_CRM_VERSION), strdup(CRM_FEATURE_SET)); |
| 1495 | |
| 1496 | crm_trace("Constructed %s op for %s", operation, rsc_id); |
| 1497 | return op; |
| 1498 | } |
| 1499 | |
| 1500 | params = xml2list(rsc_op); |
| 1501 | g_hash_table_remove(params, CRM_META "_op_target_rc"); |
| 1502 | |
| 1503 | op_delay = crm_meta_value(params, XML_OP_ATTR_START_DELAY); |
| 1504 | op_timeout = crm_meta_value(params, XML_ATTR_TIMEOUT); |
| 1505 | op_interval = crm_meta_value(params, XML_LRM_ATTR_INTERVAL); |
| 1506 | |
| 1507 | op->interval = crm_parse_int(op_interval, "0"); |
| 1508 | op->timeout = crm_parse_int(op_timeout, "0"); |
| 1509 | op->start_delay = crm_parse_int(op_delay, "0"); |
| 1510 | |
| 1511 | if (safe_str_neq(operation, RSC_STOP)) { |
| 1512 | op->params = params; |
| 1513 | |
| 1514 | } else { |
| 1515 | rsc_history_t *entry = g_hash_table_lookup(resource_history, rsc_id); |
| 1516 |
no test coverage detected