static void node_op_history_clear(struct assembly *assembly) { qb_map_iter_t *iter; struct operation_history *oh; const char *key; struct resource *r; qb_enter(); iter = qb_map_iter_create(op_history_map); while ((key = qb_map_iter_next(iter, (void **)&oh)) != NULL) { r = oh->resource; if (r->assembly == assembly) { /* stop the recurring monitor. */ if (qb_loop_timer_is_running(NULL, r->monitor_timer) && r->monitor_op) { recurring_monitor_stop(r->monitor_op); } qb_map_rm(op_history_map, key); free(oh->rsc_id); free(oh->operation); free(oh->op_digest); free(oh); } } qb_map_iter_free(iter); qb_leave(); }
static void recurring_monitor_stop(struct pe_operation *op) { struct resource * r = (struct resource *)op->resource; if (qb_loop_timer_is_running(NULL, r->monitor_timer)) { qb_loop_timer_del(NULL, r->monitor_timer); pe_resource_unref(op); } r->monitor_op = NULL; pe_resource_unref(op); }
static void recurring_monitor_start(struct pe_operation *op) { struct resource * r = (struct resource *)op->resource; if (!qb_loop_timer_is_running(NULL, r->monitor_timer)) { pe_resource_ref(op); r->monitor_op = op; resource_monitor_execute(op); } else { qb_util_stopwatch_stop(op->time_execed); pe_resource_completed(op, OCF_OK); pe_resource_unref(op); } }
static void reset_one_shot_tmo(void*data) { int32_t res; qb_loop_t *l = data; if (reset_timer_step == 0) { res = qb_loop_timer_del(l, reset_th); ck_assert_int_eq(res, -EINVAL); res = qb_loop_timer_is_running(l, reset_th); ck_assert_int_eq(res, QB_FALSE); res = qb_loop_timer_add(l, QB_LOOP_LOW, 8*QB_TIME_NS_IN_MSEC, l, reset_one_shot_tmo, &reset_th); ck_assert_int_eq(res, 0); } reset_timer_step++; }
static void op_history_delete(struct pe_operation *op) { struct resource *r; qb_map_iter_t *iter; const char *key; struct operation_history *oh; qb_enter(); /* * Delete this resource from any operational histories */ iter = qb_map_iter_create(op_history_map); while ((key = qb_map_iter_next(iter, (void **)&oh)) != NULL) { r = (struct resource *)oh->resource; if (r == op->resource) { /* stop the recurring monitor. */ if (qb_loop_timer_is_running(NULL, r->monitor_timer) && r->monitor_op) { recurring_monitor_stop(r->monitor_op); } qb_map_rm(op_history_map, key); free(oh->rsc_id); free(oh->operation); free(oh->op_digest); free(oh); } } qb_map_iter_free(iter); qb_util_stopwatch_stop(op->time_execed); pe_resource_completed(op, OCF_OK); pe_resource_unref(op); qb_leave(); }