pacemaker  3.0.0-d8340737c4
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 
31 {
32  return (scheduler == NULL)? NULL : scheduler->dc_node;
33 }
34 
45 {
46  if (scheduler == NULL) {
47  return pcmk_no_quorum_stop; // The default
48  }
50 }
51 
63 int
65 {
66  if (scheduler == NULL) {
67  return EINVAL;
68  }
69  scheduler->input = cib;
70  return pcmk_rc_ok;
71 }
72 
81 bool
83 {
84  if (scheduler == NULL) {
85  return false;
86  }
88 }
89 
100 pcmk_find_node(const pcmk_scheduler_t *scheduler, const char *node_name)
101 {
102  if ((scheduler == NULL) || (node_name == NULL)) {
103  return NULL;
104  }
105  return pcmk__find_node_in_list(scheduler->nodes, node_name);
106 }
pcmk_node_t * pcmk_get_dc(const pcmk_scheduler_t *scheduler)
Definition: scheduler.c:30
uint64_t flags
Definition: scheduler.h:89
Stop all resources in partition.
Definition: scheduler.h:40
pcmk_node_t * dc_node
Definition: scheduler.h:85
pcmk__warnings
enum pe_quorum_policy no_quorum_policy
Definition: scheduler.h:93
pe_quorum_policy
Possible responses to loss of quorum.
Definition: scheduler.h:38
Scheduler API.
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:100
pcmk_node_t * pcmk__find_node_in_list(const GList *nodes, const char *node_name)
Definition: nodes.c:170
bool pcmk_has_quorum(const pcmk_scheduler_t *scheduler)
Definition: scheduler.c:82
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
Definition: util.h:80
int pcmk_set_scheduler_cib(pcmk_scheduler_t *scheduler, xmlNode *cib)
Definition: scheduler.c:64
GList * nodes
Definition: scheduler.h:97
pcmk_scheduler_t * scheduler
xmlNode * input
Definition: scheduler.h:81
enum pe_quorum_policy pcmk_get_no_quorum_policy(const pcmk_scheduler_t *scheduler)
Definition: scheduler.c:44