39 if (consider_score && (node->
weight < 0)) {
47 if (guest->
fns->
location(guest, NULL, FALSE) == NULL) {
66 GHashTable *new_table = NULL;
74 g_hash_table_iter_init(&iter, nodes);
75 while (g_hash_table_iter_next(&iter, NULL, (gpointer *) &node)) {
78 g_hash_table_insert(new_table, (gpointer) new_node->
details->
id,
93 destroy_node_tables(gpointer
data)
95 g_hash_table_destroy((GHashTable *)
data);
122 g_hash_table_insert(*copy, rsc->
id,
125 for (
const GList *iter = rsc->
children; iter != NULL; iter = iter->next) {
147 CRM_ASSERT((rsc != NULL) && (backup != NULL));
155 for (GList *iter = rsc->
children; iter != NULL; iter = iter->next) {
174 for (
const GList *iter = list; iter != NULL; iter = iter->next) {
202 compare_nodes(gconstpointer a, gconstpointer b, gpointer
data)
229 if (node1_score > node2_score) {
230 crm_trace(
"%s before %s (score %d > %d)",
232 node1_score, node2_score);
236 if (node1_score < node2_score) {
239 node1_score, node2_score);
254 crm_trace(
"%s before %s (greater capacity by %d attributes)",
258 crm_trace(
"%s after %s (lower capacity by %d attributes)",
267 crm_trace(
"%s before %s (%d resources < %d)",
273 crm_trace(
"%s after %s (%d resources > %d)",
281 if (preferred != NULL) {
282 if (pe__same_node(preferred,
node1)) {
283 crm_trace(
"%s before %s (preferred node)",
286 }
else if (pe__same_node(preferred,
node2)) {
287 crm_trace(
"%s after %s (not preferred node)",
322 return g_list_sort_with_data(nodes, compare_nodes, active_node);
343 g_hash_table_iter_init(&iter, nodes);
344 while (g_hash_table_iter_next(&iter, NULL, (
void **) &node)) {
370 crm_info(
"Applying node health strategy '%s'", strategy_str);
377 for (GList *iter =
scheduler->
nodes; iter != NULL; iter = iter->next) {
385 crm_info(
"Overall system health of %s is %d",
386 pe__node_name(node), health);
392 bool constrain =
true;
405 rsc->
id, pe__node_name(node));
424 GHashTable *allowed_nodes = NULL;
426 if ((rsc == NULL) || (node == NULL)) {
428 }
else if (rsc->
parent == NULL) {
433 return g_hash_table_lookup(allowed_nodes, node->
details->
id);
pcmk_node_t * pe__copy_node(const pcmk_node_t *this_node)
pcmk_node_t *(* location)(const pcmk_resource_t *rsc, GList **list, int current)
List nodes where a resource (or any of its children) is.
GList * children
Resource's child resources, if any.
G_GNUC_INTERNAL pe__location_t * pcmk__new_location(const char *id, pcmk_resource_t *rsc, int node_score, const char *discover_mode, pcmk_node_t *foo_node)
void pcmk__copy_node_tables(const pcmk_resource_t *rsc, GHashTable **copy)
GHashTable * meta
Resource's meta-attributes.
const char * pe_pref(GHashTable *options, const char *name)
GList * pcmk__sort_nodes(GList *nodes, pcmk_node_t *active_node)
enum pcmk__health_strategy pcmk__parse_health_strategy(const char *value)
pcmk_scheduler_t * data_set
Cluster that node is part of.
pcmk_resource_t * container
Resource containing this one, if any.
Implementation of pcmk_scheduler_t.
GList * resources
Resources in cluster.
bool pcmk__any_node_available(GHashTable *nodes)
GList * nodes
Nodes in cluster.
int weight
Node score for a given resource.
pcmk_resource_t * parent
Resource's parent resource, if any.
Implementation of pcmk_resource_t.
#define PCMK__OPT_NODE_HEALTH_BASE
#define crm_trace(fmt, args...)
GList * pcmk__copy_node_list(const GList *list, bool reset)
struct pe_node_shared_s * details
Basic node information.
const char * uname
Node name in cluster.
GHashTable * config_hash
Cluster properties.
gboolean standby
Whether in standby mode.
Implementation of pcmk_node_t.
void pcmk__apply_node_health(pcmk_scheduler_t *scheduler)
const char * placement_strategy
Value of placement-strategy property.
#define PCMK__OPT_NODE_HEALTH_STRATEGY
const char * id
Node ID at the cluster layer.
G_GNUC_INTERNAL int pcmk__compare_node_capacities(const pcmk_node_t *node1, const pcmk_node_t *node2)
#define PCMK__META_ALLOW_UNHEALTHY_NODES
bool pe__is_guest_node(const pcmk_node_t *node)
GHashTable * pcmk__copy_node_table(GHashTable *nodes)
GHashTable * pcmk__strkey_table(GDestroyNotify key_destroy_func, GDestroyNotify value_destroy_func)
pcmk__action_result_t result
pcmk_rsc_methods_t * fns
Resource object methods.
pcmk_scheduler_t * scheduler
void pcmk__restore_node_tables(pcmk_resource_t *rsc, GHashTable *backup)
pcmk_node_t * pcmk__top_allowed_node(const pcmk_resource_t *rsc, const pcmk_node_t *node)
gboolean shutdown
Whether shutting down.
gboolean maintenance
Whether in maintenance mode.
bool pcmk__node_available(const pcmk_node_t *node, bool consider_score, bool consider_guest)
gboolean crm_is_true(const char *s)
int pe__sum_node_health_scores(const pcmk_node_t *node, int base_health)
#define pe_rsc_trace(rsc, fmt, args...)
gboolean unclean
Whether node requires fencing.
#define crm_info(fmt, args...)
gboolean online
Whether online.
pcmk_resource_t * remote_rsc
Remote connection resource for node, if it is a Pacemaker Remote node.
char * id
Resource ID in configuration.
GHashTable * allowed_nodes
Nodes where resource may run (key is node ID, not name)