pacemaker  2.1.7-0f7f88312f
Scalable High-Availability cluster resource manager
status.h
Go to the documentation of this file.
1 /*
2  * Copyright 2004-2023 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_PENGINE_STATUS__H
11 # define PCMK__CRM_PENGINE_STATUS__H
12 
13 # include <glib.h> // gboolean
14 # include <stdbool.h> // bool
15 # include <crm/common/util.h> // pcmk_is_set()
16 # include <crm/common/iso8601.h>
17 # include <crm/pengine/common.h>
18 # include <crm/pengine/pe_types.h> // pcmk_node_t, pcmk_resource_t, etc.
19 # include <crm/pengine/complex.h>
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
31 const char *rsc_printable_id(const pcmk_resource_t *rsc);
38 pcmk_resource_t *pe_find_resource(GList *rsc_list, const char *id_rh);
39 pcmk_resource_t *pe_find_resource_with_flags(GList *rsc_list, const char *id,
40  enum pe_find flags);
41 pcmk_node_t *pe_find_node(const GList *node_list, const char *node_name);
42 pcmk_node_t *pe_find_node_id(const GList *node_list, const char *id);
43 pcmk_node_t *pe_find_node_any(const GList *node_list, const char *id,
44  const char *node_name);
45 GList *find_operations(const char *rsc, const char *node, gboolean active_filter,
47 void calculate_active_ops(const GList *sorted_op_list, int *start_index,
48  int *stop_index);
49 int pe_bundle_replicas(const pcmk_resource_t *rsc);
50 
58 static inline bool
59 pe_rsc_is_clone(const pcmk_resource_t *rsc)
60 {
61  return (rsc != NULL) && (rsc->variant == pcmk_rsc_variant_clone);
62 }
63 
71 static inline bool
72 pe_rsc_is_unique_clone(const pcmk_resource_t *rsc)
73 {
74  return pe_rsc_is_clone(rsc) && pcmk_is_set(rsc->flags, pcmk_rsc_unique);
75 }
76 
84 static inline bool
85 pe_rsc_is_anon_clone(const pcmk_resource_t *rsc)
86 {
87  return pe_rsc_is_clone(rsc) && !pcmk_is_set(rsc->flags, pcmk_rsc_unique);
88 }
89 
97 static inline bool
98 pe_rsc_is_bundled(const pcmk_resource_t *rsc)
99 {
100  if (rsc == NULL) {
101  return false;
102  }
103  while (rsc->parent != NULL) {
104  rsc = rsc->parent;
105  }
106  return rsc->variant == pcmk_rsc_variant_bundle;
107 }
108 
109 #ifdef __cplusplus
110 }
111 #endif
112 
113 #endif
GList * find_operations(const char *rsc, const char *node, gboolean active_filter, pcmk_scheduler_t *scheduler)
Definition: unpack.c:5012
pcmk_resource_t * pe_find_resource_with_flags(GList *rsc_list, const char *id, enum pe_find flags)
Definition: status.c:397
pe_find
Search options for resources (exact resource ID always matches)
Definition: resources.h:197
void pe_reset_working_set(pcmk_scheduler_t *scheduler)
Reset scheduler data to default state without freeing it.
Definition: status.c:338
const char * rsc_printable_id(const pcmk_resource_t *rsc)
Definition: utils.c:546
int pe_bundle_replicas(const pcmk_resource_t *rsc)
Get the number of configured replicas in a bundle.
Definition: bundle.c:2032
Implementation of pcmk_scheduler_t.
Definition: scheduler.h:172
gboolean cluster_status(pcmk_scheduler_t *scheduler)
Definition: status.c:71
pcmk_resource_t * parent
Resource&#39;s parent resource, if any.
Definition: resources.h:413
pcmk_resource_t * pe_find_resource(GList *rsc_list, const char *id_rh)
Definition: status.c:391
Bundle resource.
Definition: resources.h:37
Implementation of pcmk_resource_t.
Definition: resources.h:399
Utility functions.
pcmk_node_t * pe_find_node_id(const GList *node_list, const char *id)
Find a node by ID in a list of nodes.
Definition: status.c:448
pcmk_node_t * pe_find_node(const GList *node_list, const char *node_name)
Find a node by name in a list of nodes.
Definition: status.c:473
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
Definition: util.h:99
void set_working_set_defaults(pcmk_scheduler_t *scheduler)
Definition: status.c:368
unsigned long long flags
Group of enum pcmk_rsc_flags.
Definition: resources.h:429
ISO_8601 Date handling.
Implementation of pcmk_node_t.
Definition: nodes.h:130
enum pe_obj_types variant
Resource variant.
Definition: resources.h:414
pcmk_scheduler_t * pe_new_working_set(void)
Create a new object to hold scheduler data.
Definition: status.c:34
pcmk_node_t * pe_find_node_any(const GList *node_list, const char *id, const char *node_name)
Find a node by name or ID in a list of nodes.
Definition: status.c:426
void cleanup_calculations(pcmk_scheduler_t *scheduler)
Reset scheduler data to defaults without freeing it or constraints.
Definition: status.c:279
void pe_free_working_set(pcmk_scheduler_t *scheduler)
Free scheduler data.
Definition: status.c:50
pcmk_scheduler_t * scheduler
void calculate_active_ops(const GList *sorted_op_list, int *start_index, int *stop_index)
Definition: unpack.c:2532
Data types for cluster status.
Clone resource.
Definition: resources.h:36
uint64_t flags
Definition: remote.c:215
Whether resource is not an anonymous clone instance.
Definition: resources.h:118