38 if (pcmk__is_guest_or_bundle_node(node)) {
66 }
else if(node == NULL) {
70 crm_notice(
"We can fence %s without quorum because they're in our membership",
71 pcmk__node_name(node));
75 crm_trace(
"Cannot fence %s", pcmk__node_name(node));
121 GHashTable *
result = NULL;
124 for (
const GList *gIter = list; gIter != NULL; gIter = gIter->next) {
128 g_hash_table_insert(
result, (gpointer) new_node->
priv->
id, new_node);
179 pe__output_node_weights(
const pcmk_resource_t *rsc,
const char *comment,
185 GList *list = g_list_sort(g_hash_table_get_values(nodes),
188 for (
const GList *gIter = list; gIter != NULL; gIter = gIter->next) {
209 pe__log_node_weights(
const char *file,
const char *
function,
int line,
219 g_hash_table_iter_init(&iter, nodes);
220 while (g_hash_table_iter_next(&iter, NULL, (
void **) &node)) {
222 qb_log_from_external_source(
function, file,
223 "%s: %s allocation score on %s: %s",
226 pcmk__node_name(node),
229 qb_log_from_external_source(
function, file,
"%s: %s = %s",
231 comment, pcmk__node_name(node),
254 const char *comment, GHashTable *nodes,
267 pe__log_node_weights(file,
function, line, rsc, comment, nodes);
269 pe__output_node_weights(rsc, comment, nodes,
scheduler);
278 gIter != NULL; gIter = gIter->next) {
304 if (a == NULL && b == NULL) {
342 gIter != NULL; gIter = gIter->next) {
346 resource_node_score(child_rsc, node, score, tag);
354 (gpointer) match->
priv->
id, match);
358 "Enabling %s preference (%s) for %s on %s (now %s)",
360 pcmk__node_name(node),
369 resource_node_score(rsc, node, score, tag);
374 for (; gIter != NULL; gIter = gIter->next) {
377 resource_node_score(rsc, node_iter, score, tag);
385 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node_iter)) {
386 resource_node_score(rsc, node_iter, score, tag);
420 const char *value = g_hash_table_lookup(rsc->
priv->
meta,
433 "' is deprecated and will be removed in a " 434 "future release (just leave it unset)");
441 "because '%s' is not valid", rsc->
id, value);
454 "because '%s' only makes sense for promotable " 455 "clones", rsc->
id, value);
475 if ((first == NULL) || (then == NULL)) {
479 crm_trace(
"Creating action wrappers for ordering: %s then %s",
487 for (; gIter != NULL; gIter = gIter->next) {
490 if ((after->
action == then)
500 list = g_list_prepend(list, wrapper);
507 list = g_list_prepend(list, wrapper);
518 g_hash_table_destroy(ticket->
state);
529 if (pcmk__str_empty(ticket_id)) {
540 if (ticket == NULL) {
543 if (ticket == NULL) {
549 crm_trace(
"Creating ticket entry for %s", ticket_id);
551 ticket->
id = strdup(ticket_id);
568 return pcmk__xe_id(rsc->
priv->
xml);
577 gIter != NULL; gIter = gIter->next) {
588 lpc != NULL; lpc = lpc->next) {
602 gIter != NULL; gIter = gIter->next) {
617 }
else if ((rsc != NULL)
637 while (g_hash_table_iter_next(&iter, NULL, (
void **)&node)) {
638 if(node->details->online && node->details->unclean == FALSE && node->details->shutdown == FALSE) {
682 crm_debug(
"Updated next scheduler recheck to %s for %s",
703 GHashTable *hash,
const char *always_first,
708 CRM_CHECK((set_name != NULL) && (rule_data != NULL) && (hash != NULL)
715 if (xml_obj == NULL) {
721 always_first, FALSE, next_change);
733 const char *target_role = NULL;
736 target_role = g_hash_table_lookup(rsc->
priv->
meta,
794 GList *retval = NULL;
796 for (GList *gIter = rscs; gIter; gIter = gIter->next) {
806 retval = g_list_prepend(retval, rsc);
823 nodes = g_list_prepend(nodes, strdup(
"*"));
831 nodes = g_list_prepend(nodes, strdup(s));
849 GList *resources = NULL;
852 resources = g_list_prepend(resources, strdup(
"*"));
864 if (strstr(s,
":") != NULL) {
865 resources = g_list_prepend(resources, strdup(rsc->
id));
885 const char *rsc_id = rsc->
id;
888 if (pcmk__is_clone(
parent)) {
896 const char *value = NULL;
912 if (!
parse_op_key(pcmk__xe_history_key(xml_op), &op_id, NULL, NULL)) {
crm_time_t * crm_time_new_undefined(void)
Allocate memory for an uninitialized time object.
const pcmk_resource_t * pe__const_top_resource(const pcmk_resource_t *rsc, bool include_bundle)
#define CRM_CHECK(expr, failure_action)
pcmk_node_t * pcmk_find_node(const pcmk_scheduler_t *scheduler, const char *node_name)
Find a node by name in scheduler data.
enum pcmk__probe_mode probe_mode
void destroy_ticket(gpointer data)
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...)
#define pcmk__sched_err(scheduler, fmt...)
#define PCMK__NODE_ATTR_SHUTDOWN
#define pcmk__if_tracing(if_action, else_action)
void pe__clear_resource_flags_on_all(pcmk_scheduler_t *scheduler, uint64_t flag)
GHashTable * pe__node_list2table(const GList *list)
gboolean(* active)(pcmk_resource_t *rsc, gboolean all)
bool crm_time_is_defined(const crm_time_t *t)
Check whether a time object has been initialized yet.
void pe__update_recheck_time(time_t recheck, pcmk_scheduler_t *scheduler, const char *reason)
int(* message)(pcmk__output_t *out, const char *message_id,...)
const char * pcmk_readable_score(int score)
Return a displayable static string for a score value.
pcmk_resource_t * pe_find_resource_with_flags(GList *rsc_list, const char *id, enum pe_find flags)
struct crm_time_s crm_time_t
#define pcmk__config_warn(fmt...)
#define pcmk__rsc_trace(rsc, fmt, args...)
void pe__unpack_dataset_nvpairs(const xmlNode *xml_obj, const char *set_name, const pe_rule_eval_data_t *rule_data, GHashTable *hash, const char *always_first, pcmk_scheduler_t *scheduler)
#define pcmk__set_rsc_flags(resource, flags_to_set)
gboolean get_target_role(const pcmk_resource_t *rsc, enum rsc_role_e *role)
#define pcmk__config_err(fmt...)
void pe__clear_resource_flags_recursive(pcmk_resource_t *rsc, uint64_t flags)
pcmk_action_t * pe_fence_op(pcmk_node_t *node, const char *op, bool optional, const char *reason, bool priority_delay, pcmk_scheduler_t *scheduler)
pcmk__ticket_t * ticket_new(const char *ticket_id, pcmk_scheduler_t *scheduler)
#define PCMK_VALUE_DEFAULT
pcmk__scheduler_private_t * priv
GHashTable * ticket_constraints
GList * pe__rscs_with_tag(pcmk_scheduler_t *scheduler, const char *tag_name)
bool pe_can_fence(const pcmk_scheduler_t *scheduler, const pcmk_node_t *node)
#define PCMK__META_ON_NODE
const pcmk__rsc_methods_t * fns
void pcmk__free_node_copy(void *data)
void pe__show_node_scores_as(const char *file, const char *function, int line, bool to_log, const pcmk_resource_t *rsc, const char *comment, GHashTable *nodes, pcmk_scheduler_t *scheduler)
enum pe_quorum_policy no_quorum_policy
enum rsc_role_e pcmk_parse_role(const char *role)
Parse a resource role from a string role specification.
Also match clone instance ID from resource history.
gboolean ghash_free_str_str(gpointer key, gpointer value, gpointer user_data)
void pe_eval_nvpairs(xmlNode *top, const xmlNode *xml_obj, const char *set_name, const pe_rule_eval_data_t *rule_data, GHashTable *hash, const char *always_first, gboolean overwrite, crm_time_t *next_change)
Extract nvpair blocks contained by an XML element into a hash table.
pcmk__node_private_t * priv
gint pe__cmp_node_name(gconstpointer a, gconstpointer b)
time_t get_effective_time(pcmk_scheduler_t *scheduler)
#define crm_debug(fmt, args...)
pcmk_scheduler_t * scheduler
Actions are ordered (optionally, if no other flags are set)
void resource_location(pcmk_resource_t *rsc, const pcmk_node_t *node, int score, const char *tag, pcmk_scheduler_t *scheduler)
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the value of an XML attribute.
#define crm_trace(fmt, args...)
pcmk_node_t * assigned_node
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
pcmk__resource_private_t * priv
GList * pe__unames_with_tag(pcmk_scheduler_t *scheduler, const char *tag_name)
Wrappers for and extensions to libxml2.
#define PCMK_META_TARGET_ROLE
bool pe__resource_is_disabled(const pcmk_resource_t *rsc)
Match clone instances (even unique) by base name as well as exact ID.
pcmk_node_t * pe__copy_node(const pcmk_node_t *this_node)
#define pcmk__clear_rsc_flags(resource, flags_to_clear)
Act as if partition still holds quorum.
int pcmk__add_scores(int score1, int score2)
#define pcmk__str_copy(str)
long long crm_time_get_seconds_since_epoch(const crm_time_t *dt)
bool pcmk_xe_mask_probe_failure(const xmlNode *xml_op)
Check whether an action history entry represents a maskable probe.
#define PCMK_XE_META_ATTRIBUTES
GHashTable * allowed_nodes
xmlNode * pcmk__xe_next(const xmlNode *node, const char *element_name)
#define pcmk__assert(expr)
bool pe__rsc_running_on_only(const pcmk_resource_t *rsc, const pcmk_node_t *node)
GList * pe__build_node_name_list(pcmk_scheduler_t *scheduler, const char *s)
GHashTable * pcmk__strkey_table(GDestroyNotify key_destroy_func, GDestroyNotify value_destroy_func)
pcmk__action_result_t result
#define PCMK_ROLE_STARTED
pcmk_scheduler_t * scheduler
crm_time_t * crm_time_new(const char *string)
pcmk_resource_t * launcher
const char * pcmk__node_attr(const pcmk_node_t *node, const char *name, const char *target, enum pcmk__rsc_node node_type)
gboolean order_actions(pcmk_action_t *first, pcmk_action_t *then, uint32_t flags)
This structure contains everything that makes up a single output formatter.
gboolean parse_op_key(const char *key, char **rsc_id, char **op_type, guint *interval_ms)
bool pe__rsc_running_on_any(pcmk_resource_t *rsc, GList *node_list)
bool pe__shutdown_requested(const pcmk_node_t *node)
xmlNode * pe__failed_probe_for_rsc(const pcmk_resource_t *rsc, const char *name)
void pe__set_resource_flags_recursive(pcmk_resource_t *rsc, uint64_t flags)
int pcmk__numeric_strcasecmp(const char *s1, const char *s2)
const char * rsc_printable_id(const pcmk_resource_t *rsc)
GList * pe__filter_rsc_list(GList *rscs, GList *filter)
void trigger_unfencing(pcmk_resource_t *rsc, pcmk_node_t *node, const char *reason, pcmk_action_t *dependency, pcmk_scheduler_t *scheduler)
GList * pe__build_rsc_list(pcmk_scheduler_t *scheduler, const char *s)
Resource role is unknown.
char * pcmk__trim(char *str)
struct pcmk__node_details * details
#define pcmk__assert_alloc(nmemb, size)
bool pcmk__rsc_filtered_by_node(pcmk_resource_t *rsc, GList *only_node)
const char * pe__clone_child_id(const pcmk_resource_t *rsc)
#define crm_info(fmt, args...)
gint pe__cmp_rsc_priority(gconstpointer a, gconstpointer b)
No relation (compare with equality rather than bit set)
#define PCMK_SCORE_INFINITY
Integer score to use to represent "infinity".
gboolean pcmk__str_in_list(const gchar *s, const GList *lst, uint32_t flags)
void crm_time_free(crm_time_t *dt)
struct pcmk__node_assignment * assign