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,
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)
397 if (possible_matches == NULL) {
400 g_list_free(possible_matches);
421 "Cancelling %s-interval %s action for %s on %s because " 424 pcmk__node_name(node),
442 for (GList *iter = probes; iter != NULL; iter = iter->next) {
463 for (GList *iter = stop_ops; iter != NULL; iter = iter->next) {
470 action->uuid, pcmk__node_name(node));
475 crm_debug(
"%s unrunnable on %s: stop is unrunnable",
476 action->uuid, pcmk__node_name(node));
488 g_list_free(stop_ops);
501 const struct op_history *op)
503 GList *possible_matches = NULL;
512 " role are not supported for anonymous clones)", op->id);
517 "Creating recurring action %s for %s on nodes " 518 "where it should not be running", op->id, rsc->
id);
521 iter != NULL; iter = iter->next) {
525 bool is_optional =
true;
532 cancel_if_running(rsc, node, op->key, op->name, op->interval_ms);
539 is_optional = (possible_matches != NULL);
540 g_list_free(possible_matches);
543 "Creating %s recurring action %s for %s (%s " 545 (is_optional?
"optional" :
"mandatory"),
546 op->key, op->id, rsc->
id, pcmk__node_name(stop_node));
548 stopped_mon =
custom_action(rsc, strdup(op->key), op->name, stop_node,
554 order_after_probes(rsc, stop_node, stopped_mon);
560 order_after_stops(rsc, stop_node, stopped_mon);
564 stopped_mon->uuid, pcmk__node_name(stop_node));
570 crm_notice(
"Start recurring %s-interval %s for " 573 stopped_mon->task, rsc->
id, pcmk__node_name(stop_node));
591 "Skipping recurring actions for blocked resource %s",
598 "Skipping recurring actions for %s " 599 "in maintenance mode", rsc->
id);
608 "Skipping recurring actions for %s on %s " 609 "in maintenance mode",
625 struct op_history op_history = { NULL, };
627 if (!is_recurring_history(rsc, op, &op_history)) {
638 free(op_history.key);
659 char *interval_ms_s = NULL;
661 pcmk__assert((rsc != NULL) && (task != NULL) && (node != NULL));
695 const char *task, guint interval_ms,
700 CRM_CHECK((rsc != NULL) && (task != NULL)
701 && (node != NULL) && (reason != NULL),
704 crm_info(
"Recurring %s-interval %s for %s will be stopped on %s: %s",
706 pcmk__node_name(node), reason);
748 guint interval_ms = 0;
754 return (interval_ms > 0);
#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)
xmlNode * pcmk__xe_first_child(const xmlNode *parent, const char *node_name, const char *attr_n, const char *attr_v)
#define crm_notice(fmt, args...)
'then' is runnable (and migratable) only if 'first' is runnable
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)
#define pcmk__rsc_trace(rsc, fmt, args...)
#define pcmk__rsc_info(rsc, fmt, args...)
Service active and promoted.
#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...)
#define PCMK_ACTION_RELOAD_AGENT
pcmk__node_private_t * priv
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...)
pcmk_scheduler_t * scheduler
Actions are ordered (optionally, if no other flags are set)
#define pcmk__clear_action_flags(action, flags_to_clear)
int pcmk_parse_interval_spec(const char *input, guint *result_ms)
Parse milliseconds from a Pacemaker interval specification.
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the value of an XML attribute.
#define PCMK_ROLE_STOPPED
#define do_crm_log(level, fmt, args...)
Log a message.
pcmk_node_t * assigned_node
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
#define PCMK_ACTION_START
pcmk__resource_private_t * priv
void pcmk__str_update(char **str, const char *value)
Wrappers for and extensions to libxml2.
enum rsc_role_e next_role
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
gboolean order_actions(pcmk_action_t *first, pcmk_action_t *then, uint32_t flags)
#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.
xmlNode * pcmk__xe_next(const xmlNode *node, const char *element_name)
#define pcmk__assert(expr)
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)
uint32_t(* action_flags)(pcmk_action_t *action, const pcmk_node_t *node)
#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)
enum rsc_role_e orig_role
#define PCMK_ACTION_MIGRATE_FROM
#define PCMK_ACTION_PROMOTE
#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)
struct pcmk__node_details * details
#define crm_info(fmt, args...)
const pcmk__assignment_methods_t * cmds
char * crm_strdup_printf(char const *format,...) G_GNUC_PRINTF(1