39 if (consider_score && (node->
weight < 0)) {
44 if (consider_guest && pcmk__is_guest_or_bundle_node(node)) {
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)",
231 pcmk__node_name(
node1), pcmk__node_name(
node2),
232 node1_score, node2_score);
236 if (node1_score < node2_score) {
238 pcmk__node_name(
node1), pcmk__node_name(
node2),
239 node1_score, node2_score);
255 crm_trace(
"%s before %s (greater capacity by %d attributes)",
256 pcmk__node_name(
node1), pcmk__node_name(
node2),
260 crm_trace(
"%s after %s (lower capacity by %d attributes)",
269 crm_trace(
"%s before %s (%d resources < %d)",
270 pcmk__node_name(
node1), pcmk__node_name(
node2),
275 crm_trace(
"%s after %s (%d resources > %d)",
276 pcmk__node_name(
node1), pcmk__node_name(
node2),
283 if (preferred != NULL) {
284 if (pcmk__same_node(preferred,
node1)) {
285 crm_trace(
"%s before %s (preferred node)",
286 pcmk__node_name(
node1), pcmk__node_name(
node2));
288 }
else if (pcmk__same_node(preferred,
node2)) {
289 crm_trace(
"%s after %s (not preferred node)",
290 pcmk__node_name(
node1), pcmk__node_name(
node2));
300 pcmk__node_name(
node1), pcmk__node_name(
node2));
304 pcmk__node_name(
node1), pcmk__node_name(
node2));
324 return g_list_sort_with_data(nodes, compare_nodes, active_node);
345 g_hash_table_iter_init(&iter, nodes);
346 while (g_hash_table_iter_next(&iter, NULL, (
void **) &node)) {
365 const char *strategy_str =
373 crm_info(
"Applying node health strategy '%s'", strategy_str);
380 for (GList *iter =
scheduler->
nodes; iter != NULL; iter = iter->next) {
388 crm_info(
"Overall system health of %s is %d",
389 pcmk__node_name(node), health);
395 bool constrain =
true;
408 rsc->
id, pcmk__node_name(node));
427 GHashTable *allowed_nodes = NULL;
429 if ((rsc == NULL) || (node == NULL)) {
431 }
else if (rsc->
parent == NULL) {
436 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)
#define pcmk__rsc_trace(rsc, fmt, args...)
void pcmk__copy_node_tables(const pcmk_resource_t *rsc, GHashTable **copy)
GList * pcmk__sort_nodes(GList *nodes, pcmk_node_t *active_node)
enum pcmk__health_strategy pcmk__parse_health_strategy(const char *value)
const char * pcmk__cluster_option(GHashTable *options, const char *name)
pcmk_scheduler_t * data_set
pcmk_resource_t * container
bool pcmk__any_node_available(GHashTable *nodes)
#define PCMK_META_ALLOW_UNHEALTHY_NODES
#define PCMK_VALUE_MINIMAL
#define crm_trace(fmt, args...)
GList * pcmk__copy_node_list(const GList *list, bool reset)
struct pe_node_shared_s * details
Wrappers for and extensions to libxml2.
void pcmk__apply_node_health(pcmk_scheduler_t *scheduler)
const char * placement_strategy
G_GNUC_INTERNAL int pcmk__compare_node_capacities(const pcmk_node_t *node1, const pcmk_node_t *node2)
#define PCMK_OPT_NODE_HEALTH_STRATEGY
G_GNUC_INTERNAL pcmk__location_t * pcmk__new_location(const char *id, pcmk_resource_t *rsc, int node_score, const char *discover_mode, pcmk_node_t *foo_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
#define PCMK_OPT_NODE_HEALTH_BASE
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)
#define PCMK_VALUE_BALANCED
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 crm_info(fmt, args...)
pcmk_resource_t * remote_rsc
#define PCMK_SCORE_INFINITY
Integer score to use to represent "infinity".
GHashTable * allowed_nodes