pacemaker  2.0.5-ba59be712
Scalable High-Availability cluster resource manager
pcmki_sched_utils.h
Go to the documentation of this file.
1 /*
2  * Copyright 2004-2019 the Pacemaker project contributors
3  *
4  * The version control history for this file may have further details.
5  *
6  * This source code is licensed under the GNU Lesser General Public License
7  * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
8  */
9 
10 #ifndef PENGINE_AUTILS__H
11 # define PENGINE_AUTILS__H
12 
13 #include <stdbool.h> // bool
14 #include <glib.h> // GList, GHashTable, gboolean, guint
15 #include <crm/crm.h> // GListPtr
16 #include <crm/lrmd.h> // lrmd_event_data_t
17 #include <crm/cib.h> // cib_t
18 #include <crm/pengine/pe_types.h>
19 #include <crm/pengine/internal.h>
20 #include <pcmki/pcmki_scheduler.h>
21 
22 /* Constraint helper functions */
24 
26 
27 pe__location_t *rsc2node_new(const char *id, pe_resource_t *rsc, int weight,
28  const char *discovery_mode, pe_node_t *node,
29  pe_working_set_t *data_set);
30 
31 extern gboolean rsc_colocation_new(const char *id, const char *node_attr, int score,
32  pe_resource_t * rsc_lh, pe_resource_t * rsc_rh,
33  const char *state_lh, const char *state_rh,
34  pe_working_set_t * data_set);
35 
36 extern gboolean rsc_ticket_new(const char *id, pe_resource_t * rsc_lh, pe_ticket_t * ticket,
37  const char *state_lh, const char *loss_policy,
38  pe_working_set_t * data_set);
39 
40 GHashTable *pcmk__copy_node_table(GHashTable *nodes);
41 GList *pcmk__copy_node_list(const GList *list, bool reset);
42 GList *sort_nodes_by_weight(GList *nodes, pe_node_t *active_node,
43  pe_working_set_t *data_set);
44 
45 extern gboolean can_run_resources(const pe_node_t * node);
46 extern gboolean native_assign_node(pe_resource_t * rsc, GListPtr candidates, pe_node_t * chosen,
47  gboolean force);
49 
50 extern void log_action(unsigned int log_level, const char *pre_text,
51  pe_action_t * action, gboolean details);
52 
53 gboolean can_run_any(GHashTable * nodes);
55  pe_resource_t *rsc, enum rsc_role_e filter,
56  gboolean current,
57  pe_working_set_t *data_set);
59  enum rsc_role_e filter, gboolean current);
60 gboolean is_child_compatible(pe_resource_t *child_rsc, pe_node_t * local_node, enum rsc_role_e filter, gboolean current);
61 bool assign_node(pe_resource_t * rsc, pe_node_t * node, gboolean force);
65 
70 };
71 
72 extern enum filter_colocation_res
74  rsc_colocation_t * constraint, gboolean preview);
75 
76 extern int compare_capacity(const pe_node_t * node1, const pe_node_t * node2);
77 extern void calculate_utilization(GHashTable * current_utilization,
78  GHashTable * utilization, gboolean plus);
79 
80 extern void process_utilization(pe_resource_t * rsc, pe_node_t ** prefer, pe_working_set_t * data_set);
81 pe_action_t *create_pseudo_resource_op(pe_resource_t * rsc, const char *task, bool optional, bool runnable, pe_working_set_t *data_set);
82 pe_action_t *pe_cancel_op(pe_resource_t *rsc, const char *name,
83  guint interval_ms, pe_node_t *node,
84  pe_working_set_t *data_set);
86 
87 xmlNode *pcmk__create_history_xml(xmlNode *parent, lrmd_event_data_t *event,
88  const char *caller_version, int target_rc,
89  const char *node, const char *origin,
90  int level);
91 
92 # define LOAD_STOPPED "load_stopped"
93 
95  pe_working_set_t * data_set, cib_t *cib,
96  const char *quorum, const char *watchdog, GListPtr node_up, GListPtr node_down, GListPtr node_fail,
97  GListPtr op_inject, GListPtr ticket_grant, GListPtr ticket_revoke,
98  GListPtr ticket_standby, GListPtr ticket_activate);
99 
100 int run_simulation(pe_working_set_t * data_set, cib_t *cib, GListPtr op_fail_list, bool quiet);
101 
102 #endif
GList * pcmk__copy_node_list(const GList *list, bool reset)
pe_action_t * pe_cancel_op(pe_resource_t *rsc, const char *name, guint interval_ms, pe_node_t *node, pe_working_set_t *data_set)
rsc_colocation_t * invert_constraint(rsc_colocation_t *constraint)
gboolean rsc_colocation_new(const char *id, const char *node_attr, int score, pe_resource_t *rsc_lh, pe_resource_t *rsc_rh, const char *state_lh, const char *state_rh, pe_working_set_t *data_set)
A dumping ground.
GList * sort_nodes_by_weight(GList *nodes, pe_node_t *active_node, pe_working_set_t *data_set)
enum pe_action_flags summary_action_flags(pe_action_t *action, GListPtr children, pe_node_t *node)
int run_simulation(pe_working_set_t *data_set, cib_t *cib, GListPtr op_fail_list, bool quiet)
pe__location_t * copy_constraint(pe__location_t *constraint)
pe_action_t * sched_shutdown_op(pe_node_t *node, pe_working_set_t *data_set)
Resource agent executor.
gboolean is_child_compatible(pe_resource_t *child_rsc, pe_node_t *local_node, enum rsc_role_e filter, gboolean current)
gboolean can_run_resources(const pe_node_t *node)
gboolean native_assign_node(pe_resource_t *rsc, GListPtr candidates, pe_node_t *chosen, gboolean force)
const char * action
Definition: pcmk_fence.c:30
void calculate_utilization(GHashTable *current_utilization, GHashTable *utilization, gboolean plus)
pe__location_t * rsc2node_new(const char *id, pe_resource_t *rsc, int weight, const char *discovery_mode, pe_node_t *node, pe_working_set_t *data_set)
pe_action_flags
Definition: pe_types.h:279
pe_action_t * create_pseudo_resource_op(pe_resource_t *rsc, const char *task, bool optional, bool runnable, pe_working_set_t *data_set)
enum filter_colocation_res filter_colocation_constraint(pe_resource_t *rsc_lh, pe_resource_t *rsc_rh, rsc_colocation_t *constraint, gboolean preview)
xmlNode * pcmk__create_history_xml(xmlNode *parent, lrmd_event_data_t *event, const char *caller_version, int target_rc, const char *node, const char *origin, int level)
void process_utilization(pe_resource_t *rsc, pe_node_t **prefer, pe_working_set_t *data_set)
filter_colocation_res
enum action_tasks clone_child_action(pe_action_t *action)
bool assign_node(pe_resource_t *rsc, pe_node_t *node, gboolean force)
gboolean can_run_any(GHashTable *nodes)
GHashTable * pcmk__copy_node_table(GHashTable *nodes)
pe_resource_t * find_compatible_child(pe_resource_t *local_child, pe_resource_t *rsc, enum rsc_role_e filter, gboolean current, pe_working_set_t *data_set)
void log_action(unsigned int log_level, const char *pre_text, pe_action_t *action, gboolean details)
Cluster Configuration.
rsc_role_e
Definition: common.h:91
void native_deallocate(pe_resource_t *rsc)
pe_resource_t * find_compatible_child_by_node(pe_resource_t *local_child, pe_node_t *local_node, pe_resource_t *rsc, enum rsc_role_e filter, gboolean current)
Data types for cluster status.
int compare_capacity(const pe_node_t *node1, const pe_node_t *node2)
char * name
Definition: pcmk_fence.c:31
GList * GListPtr
Definition: crm.h:214
gboolean rsc_ticket_new(const char *id, pe_resource_t *rsc_lh, pe_ticket_t *ticket, const char *state_lh, const char *loss_policy, pe_working_set_t *data_set)
void modify_configuration(pe_working_set_t *data_set, cib_t *cib, const char *quorum, const char *watchdog, GListPtr node_up, GListPtr node_down, GListPtr node_fail, GListPtr op_inject, GListPtr ticket_grant, GListPtr ticket_revoke, GListPtr ticket_standby, GListPtr ticket_activate)
action_tasks
Definition: common.h:62
int copies_per_node(pe_resource_t *rsc)