35 if (running == NULL) {
55 bool any_created =
false;
57 for (GList *iter = rscs; iter != NULL; iter = iter->next) {
133 crm_debug(
"Scheduling probe of %s %s on %s",
141 add_expected_result(probe, rsc, node);
163 const char *reason = NULL;
168 reason =
"start-up probes are disabled";
176 reason =
"Pacemaker Remote nodes cannot run stonith agents";
181 reason =
"guest nodes cannot run resources containing guest nodes";
184 }
else if (rsc->is_remote_node) {
185 reason =
"Pacemaker Remote nodes cannot host remote connections";
196 reason =
"resource is inside a container";
200 reason =
"resource is orphaned";
204 reason =
"resource state is already known";
213 if (allowed == NULL) {
215 reason =
"resource has exclusive discovery but is not allowed "
221 reason =
"resource has exclusive discovery but is not enabled "
227 if (allowed == NULL) {
231 reason =
"node has discovery disabled";
240 reason =
"node's guest is stopped";
241 probe_then_start(guest, top);
244 }
else if (guest_resource_will_stop(node)) {
245 reason =
"node's guest will stop";
258 probe = probe_action(rsc, node);
265 if (!pe_rsc_is_clone(top)) {
288 "Skipping probe for %s on %s because %s",
308 && pe__same_node(probe->
node, then->
node)) {
309 const char *op = g_hash_table_lookup(then->
meta,
"stonith_action");
318 && (probe->
node != NULL) && (then->
node != NULL)
319 && !pe__same_node(probe->
node, then->
node)) {
348 GList *probes = NULL;
349 GList *then_actions = NULL;
375 }
else if ((first == NULL)
385 if ((order->
rh_rsc != NULL)
391 }
else if ((then == NULL)
409 order_flags = order->
flags;
415 if (probes == NULL) {
421 then_actions = g_list_prepend(NULL, then);
423 }
else if (order->
rh_rsc != NULL) {
426 if (then_actions == NULL) {
432 crm_trace(
"Implying 'probe then' orderings for '%s then %s' "
433 "(id=%d, type=%.6x)",
435 ((then == NULL)? order->rh_action_task : then->uuid),
438 for (GList *probe_iter = probes; probe_iter != NULL;
439 probe_iter = probe_iter->next) {
443 for (GList *then_iter = then_actions; then_iter != NULL;
444 then_iter = then_iter->next) {
448 if (probe_needed_before_action(probe, then)) {
454 g_list_free(then_actions);
495 crm_trace(
"Adding probe start orderings for 'unrunnable %s@%s "
496 "then instances of %s@%s'",
497 probe->
uuid, pe__node_name(probe->
node),
501 then_iter = then_iter->next) {
513 crm_trace(
"Adding probe start ordering for 'unrunnable %s@%s "
514 "then %s@%s' (type=%#.6x)",
515 probe->
uuid, pe__node_name(probe->
node),
543 bool interleave =
false;
547 if ((after == NULL) || (probe == NULL) || (probe->
rsc == NULL)
559 crm_trace(
"Adding probe restart orderings for '%s@%s then %s@%s'",
560 probe->
uuid, pe__node_name(probe->
node),
561 after->
uuid, pe__node_name(after->
node));
566 if ((after->
rsc != NULL)
568 && (probe->
rsc != after->
rsc)) {
570 GList *then_actions = NULL;
582 for (iter = then_actions; iter != NULL; iter = iter->next) {
590 g_list_free(then_actions);
596 if ((after->
rsc != NULL)
598 const char *interleave_s = g_hash_table_lookup(after->
rsc->
meta,
614 for (iter = after->
actions_after; iter != NULL; iter = iter->next) {
634 if ((after->
rsc == NULL)
647 && ((compatible_rsc == NULL)
648 || (compatible_rsc != after_wrapper->
action->
rsc))) {
653 crm_trace(
"Recursively adding probe restart orderings for "
654 "'%s@%s then %s@%s' (type=%#.6x)",
655 after->
uuid, pe__node_name(after->
node),
658 after_wrapper->
type);
660 add_restart_orderings_for_probe(probe, after_wrapper->
action);
688add_start_restart_orderings_for_rsc(gpointer
data, gpointer user_data)
691 GList *probes = NULL;
695 g_list_foreach(rsc->
children, add_start_restart_orderings_for_rsc,
704 for (GList *iter = probes; iter != NULL; iter = iter->next) {
707 for (GList *then_iter = probe->
actions_after; then_iter != NULL;
708 then_iter = then_iter->next) {
712 add_start_orderings_for_probe(probe, then);
713 add_restart_orderings_for_probe(probe, then->
action);
714 clear_actions_tracking_flag(rsc->
cluster);
766 GList *actions = NULL;
767 GList *probes = NULL;
772 start = actions->data;
773 g_list_free(actions);
777 crm_err(
"No start action for %s", rsc->
id);
784 actions = actions->next) {
793 clone_actions != NULL;
794 clone_actions = clone_actions->next) {
796 before = clone_actions->data;
811 if (first_rsc == NULL) {
828 for (GList *probe_iter = probes; probe_iter != NULL;
829 probe_iter = probe_iter->next) {
847 add_probe_orderings_for_stops(
scheduler);
864 for (GList *iter =
scheduler->
nodes; iter != NULL; iter = iter->next) {
866 const char *probed = NULL;
871 "the connection is unrecoverable", FALSE);
889 if (probed != NULL &&
crm_is_true(probed) == FALSE) {
@ pcmk__ar_if_on_same_node
Relation applies only if actions are on same node.
@ pcmk__ar_if_first_unmigratable
Relation applies only if 'first' cannot be part of a live migration.
@ pcmk__ar_first_implies_then
@ pcmk__ar_none
No relation (compare with equality rather than bit set)
@ pcmk__ar_if_required_on_same_node
Ordering applies only if 'first' is required and on same node as '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)
@ pcmk__ar_if_on_same_node_or_target
Actions are ordered if on same node (or migration target for migrate_to)
#define PCMK_ACTION_PROMOTE
#define PCMK_ACTION_START
@ pcmk_action_detect_loop
Whether action has already been processed by a recursive procedure.
@ pcmk_action_runnable
Whether action is runnable.
@ pcmk_action_pseudo
Whether action does not require invoking an agent.
@ pcmk_action_optional
Whether action should not be executed.
#define PCMK_ACTION_MONITOR
#define PCMK_ACTION_STONITH
#define PCMK_ACTION_DEMOTE
#define PCMK_ACTION_DO_SHUTDOWN
char * pcmk__op_key(const char *rsc_id, const char *op_type, guint interval_ms)
Generate an operation key (RESOURCE_ACTION_INTERVAL)
#define PCMK_RESOURCE_CLASS_STONITH
char * crm_strdup_printf(char const *format,...) G_GNUC_PRINTF(1
gboolean crm_is_true(const char *s)
#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)
pcmk_resource_t * uber_parent(pcmk_resource_t *rsc)
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)
G_GNUC_INTERNAL bool pcmk__is_failed_remote_node(const pcmk_node_t *node)
G_GNUC_INTERNAL pcmk_resource_t * pcmk__find_compatible_instance(const pcmk_resource_t *match_rsc, const pcmk_resource_t *rsc, enum rsc_role_e role, bool current)
G_GNUC_INTERNAL void pcmk__order_vs_unfence(const pcmk_resource_t *rsc, pcmk_node_t *node, pcmk_action_t *action, enum pcmk__action_relation_flags order)
#define crm_debug(fmt, args...)
#define crm_err(fmt, args...)
#define crm_trace(fmt, args...)
#define XML_ATTR_TE_NOWAIT
#define XML_AGENT_ATTR_CLASS
#define XML_RSC_ATTR_INTERLEAVE
pcmk_scheduler_t * scheduler
@ pcmk_probe_never
Always probe resource on node.
@ pcmk_probe_exclusive
Never probe resource on node.
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the value of an XML attribute.
bool pcmk__probe_rsc_on_node(pcmk_resource_t *rsc, pcmk_node_t *node)
void pcmk__order_probes(pcmk_scheduler_t *scheduler)
void pcmk__schedule_probes(pcmk_scheduler_t *scheduler)
bool pcmk__probe_resource_list(GList *rscs, pcmk_node_t *node)
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.
void pe_fence_node(pcmk_scheduler_t *scheduler, pcmk_node_t *node, const char *reason, bool priority_delay)
Schedule a fence action for a node.
GList * find_actions(GList *input, const char *key, const pcmk_node_t *on_node)
const pcmk_resource_t * pe__const_top_resource(const pcmk_resource_t *rsc, bool include_bundle)
gboolean order_actions(pcmk_action_t *lh_action, pcmk_action_t *rh_action, uint32_t flags)
#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__clear_action_flags(action, flags_to_clear)
#define pe__set_order_flags(order_flags, flags_to_set)
const char * pe_node_attribute_raw(const pcmk_node_t *node, const char *name)
#define pe__set_action_flags(action, flags_to_set)
void add_hash_param(GHashTable *hash, const char *name, const char *value)
pcmk_resource_t * pe__resource_contains_guest_node(const pcmk_scheduler_t *scheduler, const pcmk_resource_t *rsc)
bool pe__is_guest_or_remote_node(const pcmk_node_t *node)
bool pe__is_guest_node(const pcmk_node_t *node)
@ pcmk_rsc_variant_group
Group resource.
@ pcmk_rsc_variant_primitive
Primitive resource.
@ pcmk_rsc_removed
Whether resource has been removed from the configuration.
@ pcmk_rsc_failed
Whether resource is considered failed.
@ CRM_EX_NOT_RUNNING
Service safely stopped.
@ CRM_EX_PROMOTED
Service active and promoted.
@ pcmk_role_unknown
Resource role is unknown.
@ pcmk_role_promoted
Promoted.
@ pcmk_role_stopped
Stopped.
@ pcmk_sched_probe_resources
Cluster status and scheduling.
pcmk_node_t * pe_find_node_id(const GList *node_list, const char *id)
Find a node by ID in a list of nodes.
pcmk_node_t * pe_find_node(const GList *node_list, const char *node_name)
Find a node by name in a list of nodes.
bool pcmk__ends_with(const char *s, const char *match)
pcmk_action_t * lh_action
pcmk_action_t * rh_action
Implementation of pcmk_action_t.
pcmk_node_t * node
Node to execute action on, if any.
GList * actions_after
For Pacemaker use only.
GHashTable * meta
Meta-attributes relevant to action.
enum pe_action_flags flags
Group of enum pe_action_flags.
int required_runnable_before
pcmk_resource_t * rsc
Resource to apply action to, if any.
GList * actions_before
For Pacemaker use only.
Implementation of pcmk_node_t.
int rsc_discover_mode
Probe mode (enum pe_discover_e)
struct pe_node_shared_s * details
Basic node information.
const char * id
Node ID at the cluster layer.
gboolean online
Whether online.
const char * uname
Node name in cluster.
gboolean unclean
Whether node requires fencing.
gboolean remote_requires_reset
pcmk_resource_t * remote_rsc
Remote connection resource for node, if it is a Pacemaker Remote node.
gboolean rsc_discovery_enabled
Whether probes are allowed on node.
Implementation of pcmk_resource_t.
pcmk_assignment_methods_t * cmds
Resource assignment methods.
GList * running_on
Nodes where resource may be active.
enum pe_obj_types variant
Resource variant.
GHashTable * meta
Resource's meta-attributes.
GList * children
Resource's child resources, if any.
pcmk_scheduler_t * cluster
Cluster that resource is part of.
gboolean exclusive_discover
Whether exclusive probing is enabled.
pcmk_resource_t * container
Resource containing this one, if any.
GHashTable * known_on
Nodes where resource has been probed (key is node ID, not name)
gboolean is_remote_node
Whether this is a remote connection.
char * id
Resource ID in configuration.
pcmk_node_t * allocated_to
Node resource is assigned to.
GHashTable * allowed_nodes
Nodes where resource may run (key is node ID, not name)
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.
pcmk_resource_t * parent
Resource's parent resource, if any.
Implementation of pcmk_scheduler_t.
GList * actions
Scheduled actions.
GList * resources
Resources in cluster.
unsigned long long flags
Group of enum pcmk_scheduler_flags.
GList * nodes
Nodes in cluster.
GList * ordering_constraints
Ordering constraints.
bool(* create_probe)(pcmk_resource_t *rsc, pcmk_node_t *node)