pacemaker  3.0.0-d8340737c4
Scalable High-Availability cluster resource manager
nodes.h
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 #ifndef PCMK__CRM_COMMON_NODES__H
11 #define PCMK__CRM_COMMON_NODES__H
12 
13 #include <stdbool.h> // bool
14 #include <glib.h> // gboolean, GList, GHashTable
15 #include <libxml/tree.h> // xmlNode
16 
17 #include <crm/common/scheduler_types.h> // pcmk_resource_t, pcmk_scheduler_t
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
29 // Special node attributes
30 
31 #define PCMK_NODE_ATTR_MAINTENANCE "maintenance"
32 #define PCMK_NODE_ATTR_STANDBY "standby"
33 #define PCMK_NODE_ATTR_TERMINATE "terminate"
34 
35 
38 
39 // Basic node information (all node objects for the same node share this)
40 // @COMPAT Drop this struct once all members are moved to pcmk__node_private_t
44  /* @COMPAT Convert these gbooleans into new enum pcmk__node_flags values
45  * when we no longer support versions of sbd that use them
46  */
47 
48  // NOTE: sbd (as of at least 1.5.2) uses this
50  gboolean online; // Whether online
51 
52  // NOTE: sbd (as of at least 1.5.2) uses this
54  gboolean pending; // Whether controller membership is pending
55 
56  // NOTE: sbd (as of at least 1.5.2) uses this
58  gboolean unclean; // Whether node requires fencing
59 
60  // NOTE: sbd (as of at least 1.5.2) uses this
62  gboolean shutdown; // Whether shutting down
63 
64  // NOTE: sbd (as of at least 1.5.2) uses this
66  gboolean maintenance; // Whether in maintenance mode
67 
68  // NOTE: sbd (as of at least 1.5.2) uses this
69  // \deprecated Call pcmk_foreach_active_resource() instead
70  GList *running_rsc; // List of resources active on node
71 };
73 
74 // Implementation of pcmk_node_t
75 // @COMPAT Make contents internal when we can break API backward compatibility
80 
81  // NOTE: sbd (as of at least 1.5.2) uses this
82  struct pcmk__node_details *details; // Basic node information
83 
86 };
88 
89 bool pcmk_node_is_online(const pcmk_node_t *node);
90 bool pcmk_node_is_pending(const pcmk_node_t *node);
91 bool pcmk_node_is_clean(const pcmk_node_t *node);
92 bool pcmk_node_is_shutting_down(const pcmk_node_t *node);
94 
96  bool (*fn)(pcmk_resource_t *, void *),
97  void *user_data);
98 
99 const char *pcmk_cib_node_shutdown(xmlNode *cib, const char *node);
100 
101 #ifdef __cplusplus
102 }
103 #endif
104 
105 #endif // PCMK__CRM_COMMON_NODES__H
bool pcmk_node_is_online(const pcmk_node_t *node)
Definition: nodes.c:44
Type aliases needed to define scheduler objects.
bool pcmk_node_is_shutting_down(const pcmk_node_t *node)
Definition: nodes.c:95
gboolean shutdown
Definition: nodes.h:62
gboolean unclean
Definition: nodes.h:58
gboolean pending
Definition: nodes.h:54
pcmk__node_private_t * priv
Definition: nodes.h:85
bool pcmk_node_is_in_maintenance(const pcmk_node_t *node)
Definition: nodes.c:109
bool pcmk_node_is_clean(const pcmk_node_t *node)
Definition: nodes.c:81
gboolean maintenance
Definition: nodes.h:66
const char * pcmk_cib_node_shutdown(xmlNode *cib, const char *node)
Get value of a node&#39;s shutdown attribute from CIB, if present.
Definition: nodes.c:200
GList * running_rsc
Definition: nodes.h:70
bool pcmk_foreach_active_resource(pcmk_node_t *node, bool(*fn)(pcmk_resource_t *, void *), void *user_data)
Definition: nodes.c:127
gboolean online
Definition: nodes.h:50
struct pcmk__node_details * details
Definition: nodes.h:82
bool pcmk_node_is_pending(const pcmk_node_t *node)
Definition: nodes.c:62
struct pcmk__node_assignment * assign
Definition: nodes.h:79