41xe_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);
105op_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;
511 && pcmk__str_eq(stop_node->details->uname, node->
details->
uname,
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);
542 if (!stop_node->details->online || stop_node->details->unclean) {
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__ar_first_implies_then
@ pcmk__ar_unrunnable_first_blocks
'then' is runnable (and migratable) only if 'first' is runnable
@ pcmk__ar_ordered
Actions are ordered (optionally, if no other flags are set)
#define PCMK_ACTION_CANCEL
#define PCMK_ACTION_PROMOTE
#define PCMK_ACTION_START
#define PCMK_ACTION_MIGRATE_FROM
@ pcmk_action_runnable
Whether action is runnable.
@ pcmk_action_reschedule
Whether action is recurring monitor that must be rescheduled if active.
@ pcmk_action_optional
Whether action should not be executed.
#define PCMK_ACTION_MIGRATE_TO
#define PCMK_ACTION_MONITOR
#define PCMK_ACTION_RELOAD_AGENT
#define PCMK_ACTION_DEMOTE
char * pcmk__op_key(const char *rsc_id, const char *op_type, guint interval_ms)
Generate an operation key (RESOURCE_ACTION_INTERVAL)
char guint crm_parse_interval_spec(const char *input)
Parse milliseconds from a Pacemaker interval specification.
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.
const char * role2text(enum rsc_role_e role)
enum rsc_role_e text2role(const char *role)
const char * pcmk__readable_interval(guint interval_ms)
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 crm_info(fmt, args...)
#define do_crm_log(level, fmt, args...)
Log a message.
#define crm_notice(fmt, args...)
#define CRM_CHECK(expr, failure_action)
#define crm_debug(fmt, args...)
#define pcmk__config_err(fmt...)
#define XML_LRM_ATTR_INTERVAL
#define XML_LRM_ATTR_TASK
#define XML_LRM_ATTR_CALLID
#define XML_LRM_ATTR_INTERVAL_MS
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the value of an XML attribute.
pcmk_action_t * pcmk__new_cancel_action(pcmk_resource_t *rsc, const char *task, guint interval_ms, const pcmk_node_t *node)
bool pcmk__action_is_recurring(const pcmk_action_t *action)
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)
void pcmk__reschedule_recurring(pcmk_resource_t *rsc, const char *task, guint interval_ms, pcmk_node_t *node)
void pcmk__create_recurring_actions(pcmk_resource_t *rsc)
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.
gboolean order_actions(pcmk_action_t *lh_action, pcmk_action_t *rh_action, uint32_t flags)
#define start_action(rsc, node, optional)
#define pe_rsc_debug(rsc, fmt, args...)
#define pe_rsc_trace(rsc, fmt, args...)
void pe__add_action_expected_result(pcmk_action_t *action, int expected_result)
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.
#define pe_rsc_info(rsc, fmt, args...)
#define pe__clear_action_flags(action, flags_to_clear)
void trigger_unfencing(pcmk_resource_t *rsc, pcmk_node_t *node, const char *reason, pcmk_action_t *dependency, pcmk_scheduler_t *scheduler)
xmlNode * pcmk__find_action_config(const pcmk_resource_t *rsc, const char *action_name, guint interval_ms, bool include_disabled)
GList * find_actions_exact(GList *input, const char *key, const pcmk_node_t *on_node)
#define pe__set_action_flags(action, flags_to_set)
void add_hash_param(GHashTable *hash, const char *name, const char *value)
@ pcmk_rsc_unique
Whether resource is not an anonymous clone instance.
@ pcmk_rsc_maintenance
Whether resource, its node, or entire cluster is in maintenance mode.
@ pcmk_rsc_blocked
Whether resource is blocked from further action.
@ pcmk_rsc_managed
Whether resource is managed.
@ CRM_EX_NOT_RUNNING
Service safely stopped.
@ CRM_EX_PROMOTED
Service active and promoted.
@ pcmk_role_started
Started.
@ pcmk_role_unknown
Resource role is unknown.
@ pcmk_role_unpromoted
Unpromoted.
@ pcmk_role_promoted
Promoted.
@ pcmk_role_stopped
Stopped.
#define PCMK__ROLE_STOPPED
void pcmk__str_update(char **str, const char *value)
int pcmk__guint_from_hash(GHashTable *table, const char *key, guint default_val, guint *result)
bool pcmk__str_any_of(const char *s,...) G_GNUC_NULL_TERMINATED
Implementation of pcmk_action_t.
GHashTable * meta
Meta-attributes relevant to action.
char * cancel_task
If task is "cancel", the action being cancelled.
enum pe_action_flags flags
Group of enum pe_action_flags.
Implementation of pcmk_node_t.
struct pe_node_shared_s * details
Basic node information.
gboolean online
Whether online.
const char * uname
Node name in cluster.
gboolean unclean
Whether node requires fencing.
gboolean maintenance
Whether in maintenance mode.
Implementation of pcmk_resource_t.
pcmk_assignment_methods_t * cmds
Resource assignment methods.
pcmk_scheduler_t * cluster
Cluster that resource is part of.
char * id
Resource ID in configuration.
pcmk_node_t * allocated_to
Node resource is assigned to.
unsigned long long flags
Group of enum pcmk_rsc_flags.
enum rsc_role_e next_role
Resource's scheduled next role.
enum rsc_role_e role
Resource's current role.
xmlNode * ops_xml
Configuration of resource operations (possibly expanded from template)
GList * nodes
Nodes in cluster.
uint32_t(* action_flags)(pcmk_action_t *action, const pcmk_node_t *node)
xmlNode * first_named_child(const xmlNode *parent, const char *name)
xmlNode * crm_next_same_xml(const xmlNode *sibling)
Get next instance of same XML tag.