41 xe_interval(
const xmlNode *xml)
43 guint interval_ms = 0U;
64 const char *
id = NULL;
73 || (xe_interval(op) != interval_ms)) {
77 if (pcmk__xe_id(op) == NULL) {
85 "same name and interval combination more " 86 "than once per resource)", pcmk__xe_id(op),
id);
110 op_cannot_recur(
const char *
name)
131 struct op_history *op)
133 const char *role = NULL;
135 op->interval_ms = xe_interval(xml);
136 if (op->interval_ms == 0) {
140 op->id = pcmk__xe_id(xml);
141 if (pcmk__str_empty(op->id)) {
147 if (op_cannot_recur(op->name)) {
149 op->id, pcmk__s(op->name,
"unnamed"));
154 if (is_op_dup(rsc, op->name, op->interval_ms)) {
175 "Ignoring %s (%s-interval %s for %s) because it is " 176 "disabled or no longer in configuration",
202 GList *possible_matches = NULL;
206 "%s will be mandatory because resource is unmanaged",
219 if (possible_matches == NULL) {
221 "%s will be mandatory because it is not active on %s",
222 key, pcmk__node_name(node));
226 for (
const GList *iter = possible_matches;
227 iter != NULL; iter = iter->next) {
233 "%s will be mandatory because " 234 "it needs to be rescheduled", key);
235 g_list_free(possible_matches);
240 g_list_free(possible_matches);
255 const pcmk_node_t *node,
const struct op_history *op)
258 bool is_optional =
true;
259 bool role_match =
false;
267 is_optional = active_recurring_should_be_optional(rsc, node, op->key,
275 role_match = (rsc->
next_role == monitor_role);
280 char *after_key = NULL;
311 "%s recurring action %s because %s configured for %s role " 313 (is_optional?
"Cancelling" :
"Ignoring"), op->key, op->id,
320 "Creating %s recurring action %s for %s (%s %s on %s)",
321 (is_optional?
"optional" :
"mandatory"), op->key,
323 pcmk__node_name(node));
325 mon =
custom_action(rsc, strdup(op->key), op->name, node, is_optional,
341 rsc->
id, pcmk__node_name(node));
351 NULL, strdup(mon->
uuid), mon,
357 NULL, strdup(mon->
uuid), mon,
391 const char *key,
const char *
name, guint interval_ms)
396 if (possible_matches == NULL) {
399 g_list_free(possible_matches);
419 "Cancelling %s-interval %s action for %s on %s because " 439 for (GList *iter = probes; iter != NULL; iter = iter->next) {
460 for (GList *iter = stop_ops; iter != NULL; iter = iter->next) {
467 action->uuid, pcmk__node_name(node));
472 crm_debug(
"%s unrunnable on %s: stop is unrunnable",
473 action->uuid, pcmk__node_name(node));
485 g_list_free(stop_ops);
498 const struct op_history *op)
500 GList *possible_matches = NULL;
509 " role are not supported for anonymous clones)", op->id);
514 "Creating recurring action %s for %s on nodes " 515 "where it should not be running", op->id, rsc->
id);
517 for (GList *iter = rsc->
cluster->
nodes; iter != NULL; iter = iter->next) {
520 bool is_optional =
true;
527 cancel_if_running(rsc, node, op->key, op->name, op->interval_ms);
533 is_optional = (possible_matches != NULL);
534 g_list_free(possible_matches);
537 "Creating %s recurring action %s for %s (%s " 539 (is_optional?
"optional" :
"mandatory"),
540 op->key, op->id, rsc->
id, pcmk__node_name(stop_node));
542 stopped_mon =
custom_action(rsc, strdup(op->key), op->name, stop_node,
548 order_after_probes(rsc, stop_node, stopped_mon);
554 order_after_stops(rsc, stop_node, stopped_mon);
558 stopped_mon->uuid, pcmk__node_name(stop_node));
564 crm_notice(
"Start recurring %s-interval %s for " 567 stopped_mon->task, rsc->
id, pcmk__node_name(stop_node));
585 "Skipping recurring actions for blocked resource %s",
592 "Skipping recurring actions for %s " 593 "in maintenance mode", rsc->
id);
602 "Skipping recurring actions for %s on %s " 603 "in maintenance mode",
619 struct op_history op_history = { NULL, };
621 if (!is_recurring_history(rsc, op, &op_history)) {
626 recurring_op_for_active(rsc, start, rsc->
allocated_to, &op_history);
628 recurring_op_for_inactive(rsc, rsc->
allocated_to, &op_history);
630 free(op_history.key);
651 char *interval_ms_s = NULL;
653 CRM_ASSERT((rsc != NULL) && (task != NULL) && (node != NULL));
687 const char *task, guint interval_ms,
692 CRM_CHECK((rsc != NULL) && (task != NULL)
693 && (node != NULL) && (reason != NULL),
696 crm_info(
"Recurring %s-interval %s for %s will be stopped on %s: %s",
698 pcmk__node_name(node), reason);
725 task, node, TRUE, rsc->
cluster);
740 guint interval_ms = 0;
746 return (interval_ms > 0);
pcmk_assignment_methods_t * cmds
#define CRM_CHECK(expr, failure_action)
void trigger_unfencing(pcmk_resource_t *rsc, pcmk_node_t *node, const char *reason, pcmk_action_t *dependency, pcmk_scheduler_t *scheduler)
#define crm_notice(fmt, args...)
'then' is runnable (and migratable) only if 'first' is runnable
pcmk_scheduler_t * cluster
const char * pcmk_role_text(enum rsc_role_e role)
Get readable description of a resource role.
G_GNUC_INTERNAL void pcmk__new_ordering(pcmk_resource_t *first_rsc, char *first_task, pcmk_action_t *first_action, pcmk_resource_t *then_rsc, char *then_task, pcmk_action_t *then_action, uint32_t flags, pcmk_scheduler_t *sched)
uint32_t(* action_flags)(pcmk_action_t *action, const pcmk_node_t *node)
#define pcmk__rsc_trace(rsc, fmt, args...)
gboolean order_actions(pcmk_action_t *lh_action, pcmk_action_t *rh_action, uint32_t flags)
#define pcmk__rsc_info(rsc, fmt, args...)
Service active and promoted.
enum rsc_role_e next_role
#define pcmk__insert_meta(obj, name, value)
#define pcmk__config_err(fmt...)
#define PCMK_ACTION_MONITOR
#define PCMK_ACTION_MIGRATE_TO
GList * pe__resource_actions(const pcmk_resource_t *rsc, const pcmk_node_t *node, const char *task, bool require_node)
Find all actions of given type for a resource.
#define PCMK_XA_OPERATION
enum rsc_role_e pcmk_parse_role(const char *role)
Parse a resource role from a string role specification.
#define pcmk__rsc_debug(rsc, fmt, args...)
char int pcmk_parse_interval_spec(const char *input, guint *result_ms)
Parse milliseconds from a Pacemaker interval specification.
#define PCMK_ACTION_RELOAD_AGENT
GList * find_actions_exact(GList *input, const char *key, const pcmk_node_t *on_node)
#define PCMK_ACTION_DEMOTE
int pcmk__guint_from_hash(GHashTable *table, const char *key, guint default_val, guint *result)
bool pcmk__action_is_recurring(const pcmk_action_t *action)
#define crm_debug(fmt, args...)
Actions are ordered (optionally, if no other flags are set)
#define pcmk__clear_action_flags(action, flags_to_clear)
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the value of an XML attribute.
xmlNode * pcmk__xe_first_child(const xmlNode *parent, const char *node_name, const char *attr_n, const char *attr_v)
#define PCMK_ROLE_STOPPED
#define do_crm_log(level, fmt, args...)
Log a message.
char * crm_strdup_printf(char const *format,...) G_GNUC_PRINTF(1
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
struct pe_node_shared_s * details
#define PCMK_ACTION_START
void pcmk__str_update(char **str, const char *value)
Wrappers for and extensions to libxml2.
void pcmk__create_recurring_actions(pcmk_resource_t *rsc)
char * pcmk__op_key(const char *rsc_id, const char *op_type, guint interval_ms)
Generate an operation key (RESOURCE_ACTION_INTERVAL)
bool pcmk__str_any_of(const char *s,...) G_GNUC_NULL_TERMINATED
#define PCMK_ACTION_CANCEL
pcmk_action_t * custom_action(pcmk_resource_t *rsc, char *key, const char *task, const pcmk_node_t *on_node, gboolean optional, pcmk_scheduler_t *scheduler)
Create or update an action object.
void pe__add_action_expected_result(pcmk_action_t *action, int expected_result)
xmlNode * pcmk__find_action_config(const pcmk_resource_t *rsc, const char *action_name, guint interval_ms, bool include_disabled)
#define PCMK_META_INTERVAL
#define start_action(rsc, node, optional)
void pcmk__schedule_cancel(pcmk_resource_t *rsc, const char *call_id, const char *task, guint interval_ms, const pcmk_node_t *node, const char *reason)
#define PCMK_ACTION_MIGRATE_FROM
pcmk_node_t * allocated_to
#define PCMK_ACTION_PROMOTE
enum pe_action_flags flags
#define pcmk__set_action_flags(action, flags_to_set)
const char * pcmk__readable_interval(guint interval_ms)
void pcmk__reschedule_recurring(pcmk_resource_t *rsc, const char *task, guint interval_ms, pcmk_node_t *node)
Resource role is unknown.
pcmk_action_t * pcmk__new_cancel_action(pcmk_resource_t *rsc, const char *task, guint interval_ms, const pcmk_node_t *node)
xmlNode * pcmk__xe_next_same(const xmlNode *node)
#define crm_info(fmt, args...)