41 xe_interval(
const xmlNode *xml)
61 const char *
id = NULL;
68 || (xe_interval(op) != interval_ms)) {
80 "same name and interval combination more " 81 "than once per resource)",
ID(op),
id);
105 op_cannot_recur(
const char *
name)
126 struct op_history *op)
128 const char *role = NULL;
130 op->interval_ms = xe_interval(xml);
131 if (op->interval_ms == 0) {
136 if (pcmk__str_empty(op->id)) {
142 if (op_cannot_recur(op->name)) {
144 op->id, pcmk__s(op->name,
"unnamed"));
149 if (is_op_dup(rsc, op->name, op->interval_ms)) {
170 "Ignoring %s (%s-interval %s for %s) because it is " 171 "disabled or no longer in configuration",
197 GList *possible_matches = NULL;
200 pe_rsc_trace(rsc,
"%s will be mandatory because resource is unmanaged",
213 if (possible_matches == NULL) {
214 pe_rsc_trace(rsc,
"%s will be mandatory because it is not active on %s",
215 key, pe__node_name(node));
219 for (
const GList *iter = possible_matches;
220 iter != NULL; iter = iter->next) {
226 "%s will be mandatory because " 227 "it needs to be rescheduled", key);
228 g_list_free(possible_matches);
233 g_list_free(possible_matches);
248 const pcmk_node_t *node,
const struct op_history *op)
251 bool is_optional =
true;
259 is_optional = active_recurring_should_be_optional(rsc, node, op->key,
262 if ((!is_default_role && (rsc->
next_role != op->role))
267 char *after_key = NULL;
298 "%s recurring action %s because %s configured for %s role " 300 (is_optional?
"Cancelling" :
"Ignoring"), op->key, op->id,
307 "Creating %s recurring action %s for %s (%s %s on %s)",
308 (is_optional?
"optional" :
"mandatory"), op->key,
310 pe__node_name(node));
312 mon =
custom_action(rsc, strdup(op->key), op->name, node, is_optional,
321 pe_rsc_trace(rsc,
"%s is unrunnable because no node is available",
326 pe_rsc_info(rsc,
"Start %s-interval %s for %s on %s",
328 rsc->
id, pe__node_name(node));
338 NULL, strdup(mon->
uuid), mon,
344 NULL, strdup(mon->
uuid), mon,
378 const char *key,
const char *
name, guint interval_ms)
383 if (possible_matches == NULL) {
386 g_list_free(possible_matches);
406 "Cancelling %s-interval %s action for %s on %s because " 426 for (GList *iter = probes; iter != NULL; iter = iter->next) {
447 for (GList *iter = stop_ops; iter != NULL; iter = iter->next) {
454 action->uuid, pe__node_name(node));
459 crm_debug(
"%s unrunnable on %s: stop is unrunnable",
460 action->uuid, pe__node_name(node));
472 g_list_free(stop_ops);
485 const struct op_history *op)
487 GList *possible_matches = NULL;
496 " role are not supported for anonymous clones)", op->id);
500 pe_rsc_trace(rsc,
"Creating recurring action %s for %s on nodes " 501 "where it should not be running", op->id, rsc->
id);
503 for (GList *iter = rsc->
cluster->
nodes; iter != NULL; iter = iter->next) {
506 bool is_optional =
true;
513 cancel_if_running(rsc, node, op->key, op->name, op->interval_ms);
519 is_optional = (possible_matches != NULL);
520 g_list_free(possible_matches);
523 "Creating %s recurring action %s for %s (%s " 525 (is_optional?
"optional" :
"mandatory"),
526 op->key, op->id, rsc->
id, pe__node_name(stop_node));
528 stopped_mon =
custom_action(rsc, strdup(op->key), op->name, stop_node,
534 order_after_probes(rsc, stop_node, stopped_mon);
540 order_after_stops(rsc, stop_node, stopped_mon);
543 pe_rsc_debug(rsc,
"%s unrunnable on %s: node unavailable)",
544 stopped_mon->uuid, pe__node_name(stop_node));
550 crm_notice(
"Start recurring %s-interval %s for " 553 stopped_mon->task, rsc->
id, pe__node_name(stop_node));
570 pe_rsc_trace(rsc,
"Skipping recurring actions for blocked resource %s",
577 "in maintenance mode", rsc->
id);
586 "Skipping recurring actions for %s on %s " 587 "in maintenance mode",
596 pe_rsc_trace(rsc,
"Creating any recurring actions needed for %s", rsc->
id);
601 struct op_history op_history = { NULL, };
603 if (!is_recurring_history(rsc, op, &op_history)) {
608 recurring_op_for_active(rsc, start, rsc->
allocated_to, &op_history);
610 recurring_op_for_inactive(rsc, rsc->
allocated_to, &op_history);
612 free(op_history.key);
633 char *interval_ms_s = NULL;
635 CRM_ASSERT((rsc != NULL) && (task != NULL) && (node != NULL));
667 const char *task, guint interval_ms,
672 CRM_CHECK((rsc != NULL) && (task != NULL)
673 && (node != NULL) && (reason != NULL),
676 crm_info(
"Recurring %s-interval %s for %s will be stopped on %s: %s",
678 pe__node_name(node), reason);
705 task, node, TRUE, rsc->
cluster);
720 guint interval_ms = 0;
727 return (interval_ms > 0);
pcmk_assignment_methods_t * cmds
Resource assignment methods.
#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
Cluster that resource is part of.
xmlNode * ops_xml
Configuration of resource operations (possibly expanded from template)
#define pe_rsc_debug(rsc, fmt, args...)
Whether action should not be executed.
#define pe__set_action_flags(action, flags_to_set)
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)
enum rsc_role_e role
Resource's current role.
gboolean order_actions(pcmk_action_t *lh_action, pcmk_action_t *rh_action, uint32_t flags)
xmlNode * first_named_child(const xmlNode *parent, const char *name)
Service active and promoted.
enum rsc_role_e next_role
Resource's scheduled next role.
Implementation of pcmk_action_t.
#define pcmk__config_err(fmt...)
char * cancel_task
If task is "cancel", the action being cancelled.
#define PCMK_ACTION_MONITOR
Whether resource, its node, or entire cluster is in maintenance mode.
#define XML_LRM_ATTR_INTERVAL
#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.
GList * nodes
Nodes in cluster.
#define XML_LRM_ATTR_TASK
#define PCMK_ACTION_RELOAD_AGENT
const char * role2text(enum rsc_role_e role)
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)
Implementation of pcmk_resource_t.
#define crm_debug(fmt, args...)
Actions are ordered (optionally, if no other flags are set)
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the value of an XML attribute.
#define pe__clear_action_flags(action, flags_to_clear)
#define do_crm_log(level, fmt, args...)
Log a message.
#define PCMK__ROLE_STOPPED
char * crm_strdup_printf(char const *format,...) G_GNUC_PRINTF(1
GHashTable * meta
Meta-attributes relevant to action.
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
struct pe_node_shared_s * details
Basic node information.
#define PCMK_ACTION_START
unsigned long long flags
Group of enum pcmk_rsc_flags.
const char * uname
Node name in cluster.
void pcmk__str_update(char **str, const char *value)
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)
Whether resource is blocked from further action.
Implementation of pcmk_node_t.
enum rsc_role_e text2role(const char *role)
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)
Whether action is runnable.
void add_hash_param(GHashTable *hash, const char *name, const char *value)
#define start_action(rsc, node, optional)
char guint crm_parse_interval_spec(const char *input)
Parse milliseconds from a Pacemaker interval specification.
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
#define XML_LRM_ATTR_INTERVAL_MS
pcmk_node_t * allocated_to
Node resource is assigned to.
#define XML_LRM_ATTR_CALLID
#define PCMK_ACTION_PROMOTE
enum pe_action_flags flags
Group of enum pe_action_flags.
gboolean maintenance
Whether in maintenance mode.
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.
#define pe_rsc_trace(rsc, fmt, args...)
pcmk_action_t * pcmk__new_cancel_action(pcmk_resource_t *rsc, const char *task, guint interval_ms, const pcmk_node_t *node)
Whether action is recurring monitor that must be rescheduled if active.
Whether resource is managed.
gboolean unclean
Whether node requires fencing.
#define crm_info(fmt, args...)
gboolean online
Whether online.
Whether resource is not an anonymous clone instance.
#define pe_rsc_info(rsc, fmt, args...)
char * id
Resource ID in configuration.
xmlNode * crm_next_same_xml(const xmlNode *sibling)
Get next instance of same XML tag.