pacemaker  2.1.2-ada5c3b36
Scalable High-Availability cluster resource manager
pcmki_sched_utils.h
Go to the documentation of this file.
1 /*
2  * Copyright 2004-2021 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/lrmd.h> // lrmd_event_data_t
16 #include <crm/cib.h> // cib_t
17 #include <crm/pengine/pe_types.h>
18 #include <crm/pengine/internal.h>
19 #include <pcmki/pcmki_scheduler.h>
20 #include <pcmki/pcmki_transition.h>
21 #include <pacemaker.h>
22 
23 /* Constraint helper functions */
25 
27 
28 GHashTable *pcmk__copy_node_table(GHashTable *nodes);
29 GList *pcmk__copy_node_list(const GList *list, bool reset);
30 GList *sort_nodes_by_weight(GList *nodes, pe_node_t *active_node,
31  pe_working_set_t *data_set);
32 
33 extern gboolean can_run_resources(const pe_node_t * node);
34 extern gboolean native_assign_node(pe_resource_t *rsc, pe_node_t *chosen,
35  gboolean force);
37 
38 extern void log_action(unsigned int log_level, const char *pre_text,
39  pe_action_t * action, gboolean details);
40 
41 gboolean can_run_any(GHashTable * nodes);
43  pe_resource_t *rsc, enum rsc_role_e filter,
44  gboolean current,
45  pe_working_set_t *data_set);
47  enum rsc_role_e filter, gboolean current);
48 gboolean is_child_compatible(pe_resource_t *child_rsc, pe_node_t * local_node, enum rsc_role_e filter, gboolean current);
49 bool assign_node(pe_resource_t * rsc, pe_node_t * node, gboolean force);
50 enum pe_action_flags summary_action_flags(pe_action_t * action, GList *children, pe_node_t * node);
53 
54 extern int compare_capacity(const pe_node_t * node1, const pe_node_t * node2);
55 extern void calculate_utilization(GHashTable * current_utilization,
56  GHashTable * utilization, gboolean plus);
57 
58 extern void process_utilization(pe_resource_t * rsc, pe_node_t ** prefer, pe_working_set_t * data_set);
59 pe_action_t *create_pseudo_resource_op(pe_resource_t * rsc, const char *task, bool optional, bool runnable, pe_working_set_t *data_set);
60 pe_action_t *pe_cancel_op(pe_resource_t *rsc, const char *name,
61  guint interval_ms, pe_node_t *node,
62  pe_working_set_t *data_set);
64 
65 xmlNode *pcmk__create_history_xml(xmlNode *parent, lrmd_event_data_t *event,
66  const char *caller_version, int target_rc,
67  const char *node, const char *origin,
68  int level);
69 
70 # define LOAD_STOPPED "load_stopped"
71 
72 void modify_configuration(pe_working_set_t *data_set, cib_t *cib,
73  pcmk_injections_t *injections);
74 
75 enum transition_status run_simulation(pe_working_set_t * data_set, cib_t *cib, GList *op_fail_list);
76 
78 
80  pe_working_set_t *data_set,
81  pe_resource_t **failed);
82 
83 #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)
GList * sort_nodes_by_weight(GList *nodes, pe_node_t *active_node, pe_working_set_t *data_set)
transition_status
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)
gboolean native_assign_node(pe_resource_t *rsc, pe_node_t *chosen, gboolean force)
enum pe_action_flags summary_action_flags(pe_action_t *action, GList *children, pe_node_t *node)
Resource agent executor.
High Level API.
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)
const char * action
Definition: pcmk_fence.c:30
void calculate_utilization(GHashTable *current_utilization, GHashTable *utilization, gboolean plus)
pe_action_flags
Definition: pe_types.h:291
pe_action_t * create_pseudo_resource_op(pe_resource_t *rsc, const char *task, bool optional, bool runnable, pe_working_set_t *data_set)
pcmk__output_t * pcmk__new_logger(void)
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)
pcmk__colocation_t * invert_constraint(pcmk__colocation_t *constraint)
void process_utilization(pe_resource_t *rsc, pe_node_t **prefer, pe_working_set_t *data_set)
enum action_tasks clone_child_action(pe_action_t *action)
bool assign_node(pe_resource_t *rsc, pe_node_t *node, gboolean force)
void modify_configuration(pe_working_set_t *data_set, cib_t *cib, pcmk_injections_t *injections)
enum transition_status run_simulation(pe_working_set_t *data_set, cib_t *cib, GList *op_fail_list)
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)
bool pcmk__threshold_reached(pe_resource_t *rsc, pe_node_t *node, pe_working_set_t *data_set, pe_resource_t **failed)
Cluster Configuration.
Synthetic cluster events that can be injected into the cluster for running simulations.
Definition: pacemaker.h:48
This structure contains everything that makes up a single output formatter.
rsc_role_e
Possible roles that a resource can be in.
Definition: common.h:92
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
action_tasks
Definition: common.h:62
int copies_per_node(pe_resource_t *rsc)