pacemaker  2.1.5-b7adf64e51
Scalable High-Availability cluster resource manager
status.h
Go to the documentation of this file.
1 /*
2  * Copyright 2004-2022 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> // pe_node_t, pe_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(pe_resource_t *rsc);
38 pe_resource_t *pe_find_resource(GList *rsc_list, const char *id_rh);
39 pe_resource_t *pe_find_resource_with_flags(GList *rsc_list, const char *id, enum pe_find flags);
40 pe_node_t *pe_find_node(GList *node_list, const char *uname);
41 pe_node_t *pe_find_node_id(GList *node_list, const char *id);
42 pe_node_t *pe_find_node_any(GList *node_list, const char *id, const char *uname);
43 GList *find_operations(const char *rsc, const char *node, gboolean active_filter,
45 int pe_bundle_replicas(const pe_resource_t *rsc);
46 
54 static inline bool
55 pe_rsc_is_clone(const pe_resource_t *rsc)
56 {
57  return rsc && (rsc->variant == pe_clone);
58 }
59 
67 static inline bool
68 pe_rsc_is_unique_clone(const pe_resource_t *rsc)
69 {
70  return pe_rsc_is_clone(rsc) && pcmk_is_set(rsc->flags, pe_rsc_unique);
71 }
72 
80 static inline bool
81 pe_rsc_is_anon_clone(const pe_resource_t *rsc)
82 {
83  return pe_rsc_is_clone(rsc) && !pcmk_is_set(rsc->flags, pe_rsc_unique);
84 }
85 
93 static inline bool
94 pe_rsc_is_bundled(pe_resource_t *rsc)
95 {
96  return uber_parent(rsc)->parent != NULL;
97 }
98 
99 #ifdef __cplusplus
100 }
101 #endif
102 
103 #endif
pe_node_t * pe_find_node(GList *node_list, const char *uname)
Definition: status.c:443
pe_node_t * pe_find_node_any(GList *node_list, const char *id, const char *uname)
Definition: status.c:415
pe_resource_t * pe_find_resource_with_flags(GList *rsc_list, const char *id, enum pe_find flags)
Definition: status.c:397
void pe_free_working_set(pe_working_set_t *data_set)
Free a working set.
Definition: status.c:50
pe_working_set_t * pe_new_working_set(void)
Create a new working set.
Definition: status.c:34
#define pe_rsc_unique
Definition: pe_types.h:262
pe_resource_t * pe_find_resource(GList *rsc_list, const char *id_rh)
Definition: status.c:391
void pe_reset_working_set(pe_working_set_t *data_set)
Reset a working set to default state without freeing it.
Definition: status.c:338
void cleanup_calculations(pe_working_set_t *data_set)
Reset working set to default state without freeing it or constraints.
Definition: status.c:279
pe_find
Determine behavior of pe_find_resource_with_flags()
Definition: pe_types.h:84
pe_resource_t * uber_parent(pe_resource_t *rsc)
Definition: complex.c:912
Utility functions.
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
Definition: util.h:121
void set_working_set_defaults(pe_working_set_t *data_set)
Definition: status.c:368
unsigned long long flags
Definition: pe_types.h:355
pe_working_set_t * data_set
ISO_8601 Date handling.
enum pe_obj_types variant
Definition: pe_types.h:338
pe_node_t * pe_find_node_id(GList *node_list, const char *id)
Definition: status.c:427
const char * rsc_printable_id(pe_resource_t *rsc)
Definition: utils.c:568
gboolean cluster_status(pe_working_set_t *data_set)
Definition: status.c:71
char uname[MAX_NAME]
Definition: cpg.c:50
GList * find_operations(const char *rsc, const char *node, gboolean active_filter, pe_working_set_t *data_set)
Definition: unpack.c:4310
Data types for cluster status.
uint64_t flags
Definition: remote.c:215
int pe_bundle_replicas(const pe_resource_t *rsc)
Get the number of configured replicas in a bundle.
Definition: bundle.c:1762
pe_resource_t * parent
Definition: pe_types.h:336