pacemaker  2.1.8-3980678f03
Scalable High-Availability cluster resource manager
scheduler.c
Go to the documentation of this file.
1 /*
2  * Copyright 2004-2024 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 #include <crm_internal.h>
11 
12 #include <stdint.h> // uint32_t
13 #include <errno.h> // EINVAL
14 #include <glib.h> // gboolean, FALSE
15 #include <libxml/tree.h> // xmlNode
16 
17 #include <crm/common/scheduler.h>
18 
19 uint32_t pcmk__warnings = 0;
20 
21 gboolean was_processing_error = FALSE;
22 gboolean was_processing_warning = FALSE;
23 
34 {
35  return (scheduler == NULL)? NULL : scheduler->dc_node;
36 }
37 
48 {
49  if (scheduler == NULL) {
50  return pcmk_no_quorum_stop; // The default
51  }
53 }
54 
66 int
68 {
69  if (scheduler == NULL) {
70  return EINVAL;
71  }
72  scheduler->input = cib;
73  return pcmk_rc_ok;
74 }
75 
84 bool
86 {
87  if (scheduler == NULL) {
88  return false;
89  }
91 }
92 
102 pcmk_node_t *
103 pcmk_find_node(const pcmk_scheduler_t *scheduler, const char *node_name)
104 {
105  if ((scheduler == NULL) || (node_name == NULL)) {
106  return NULL;
107  }
108  return pcmk__find_node_in_list(scheduler->nodes, node_name);
109 }
enum pe_quorum_policy no_quorum_policy
Definition: scheduler.h:217
pcmk_node_t * pcmk_get_dc(const pcmk_scheduler_t *scheduler)
Definition: scheduler.c:33
pcmk__warnings
pe_quorum_policy
Possible responses to loss of quorum.
Definition: scheduler.h:40
Scheduler API.
gboolean was_processing_error
Definition: scheduler.c:21
pcmk_node_t * pcmk_find_node(const pcmk_scheduler_t *scheduler, const char *node_name)
Find a node by name in scheduler data.
Definition: scheduler.c:103
pcmk_node_t * pcmk__find_node_in_list(const GList *nodes, const char *node_name)
Definition: nodes.c:150
bool pcmk_has_quorum(const pcmk_scheduler_t *scheduler)
Definition: scheduler.c:85
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
Definition: util.h:98
xmlNode * input
Definition: scheduler.h:196
int pcmk_set_scheduler_cib(pcmk_scheduler_t *scheduler, xmlNode *cib)
Definition: scheduler.c:67
pcmk_scheduler_t * scheduler
enum pe_quorum_policy pcmk_get_no_quorum_policy(const pcmk_scheduler_t *scheduler)
Definition: scheduler.c:47
unsigned long long flags
Definition: scheduler.h:211
pcmk_node_t * dc_node
Definition: scheduler.h:203
gboolean was_processing_warning
Definition: scheduler.c:22