| 1922 | } |
| 1923 | |
| 1924 | xmlNode * |
| 1925 | create_operation_update(xmlNode * parent, lrmd_event_data_t * op, const char *caller_version, int target_rc, |
| 1926 | const char *origin, int level) |
| 1927 | { |
| 1928 | char *key = NULL; |
| 1929 | char *magic = NULL; |
| 1930 | char *op_id = NULL; |
| 1931 | char *local_user_data = NULL; |
| 1932 | |
| 1933 | xmlNode *xml_op = NULL; |
| 1934 | const char *task = NULL; |
| 1935 | gboolean dc_munges_migrate_ops = (compare_version(caller_version, "3.0.3") < 0); |
| 1936 | gboolean dc_needs_unique_ops = (compare_version(caller_version, "3.0.6") < 0); |
| 1937 | |
| 1938 | CRM_CHECK(op != NULL, return NULL); |
| 1939 | do_crm_log(level, "%s: Updating resouce %s after %s %s op (interval=%d)", |
| 1940 | origin, op->rsc_id, services_lrm_status_str(op->op_status), op->op_type, op->interval); |
| 1941 | |
| 1942 | if (op->op_status == PCMK_LRM_OP_CANCELLED) { |
| 1943 | crm_trace("Ignoring cancelled op"); |
| 1944 | return NULL; |
| 1945 | } |
| 1946 | |
| 1947 | crm_trace("DC version: %s", caller_version); |
| 1948 | |
| 1949 | task = op->op_type; |
| 1950 | /* remap the task name under various scenarios |
| 1951 | * this makes life easier for the PE when its trying determin the current state |
| 1952 | */ |
| 1953 | if (crm_str_eq(task, "reload", TRUE)) { |
| 1954 | if (op->op_status == PCMK_LRM_OP_DONE) { |
| 1955 | task = CRMD_ACTION_START; |
| 1956 | } else { |
| 1957 | task = CRMD_ACTION_STATUS; |
| 1958 | } |
| 1959 | |
| 1960 | } else if (dc_munges_migrate_ops && crm_str_eq(task, CRMD_ACTION_MIGRATE, TRUE)) { |
| 1961 | /* if the migrate_from fails it will have enough info to do the right thing */ |
| 1962 | if (op->op_status == PCMK_LRM_OP_DONE) { |
| 1963 | task = CRMD_ACTION_STOP; |
| 1964 | } else { |
| 1965 | task = CRMD_ACTION_STATUS; |
| 1966 | } |
| 1967 | |
| 1968 | } else if (dc_munges_migrate_ops |
| 1969 | && op->op_status == PCMK_LRM_OP_DONE && crm_str_eq(task, CRMD_ACTION_MIGRATED, TRUE)) { |
| 1970 | task = CRMD_ACTION_START; |
| 1971 | } |
| 1972 | |
| 1973 | key = generate_op_key(op->rsc_id, task, op->interval); |
| 1974 | if (dc_needs_unique_ops && op->interval > 0) { |
| 1975 | op_id = strdup(key); |
| 1976 | |
| 1977 | } else if (crm_str_eq(task, CRMD_ACTION_NOTIFY, TRUE)) { |
| 1978 | const char *n_type = crm_meta_value(op->params, "notify_type"); |
| 1979 | const char *n_task = crm_meta_value(op->params, "notify_operation"); |
| 1980 | |
| 1981 | CRM_LOG_ASSERT(n_type != NULL); |
no test coverage detected