pacemaker  2.1.0-7c3f660
Scalable High-Availability cluster resource manager
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
status.h
Go to the documentation of this file.
1 /*
2  * Copyright 2004-2020 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 PENGINE_STATUS__H
11 # define PENGINE_STATUS__H
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
23 # include <glib.h> // gboolean
24 # include <stdbool.h> // bool
25 # include <crm/common/util.h> // pcmk_is_set()
26 # include <crm/common/iso8601.h>
27 # include <crm/pengine/common.h>
28 # include <crm/pengine/pe_types.h> // pe_node_t, pe_resource_t, etc.
29 # include <crm/pengine/complex.h>
30 
31 const char *rsc_printable_id(pe_resource_t *rsc);
32 gboolean cluster_status(pe_working_set_t * data_set);
36 void cleanup_calculations(pe_working_set_t * data_set);
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,
44  pe_working_set_t * data_set);
45 int pe_bundle_replicas(const pe_resource_t *rsc);
46 #if ENABLE_VERSIONED_ATTRS
47 pe_rsc_action_details_t *pe_rsc_action_details(pe_action_t *action);
48 #endif
49 
57 static inline bool
58 pe_rsc_is_clone(pe_resource_t *rsc)
59 {
60  return rsc && (rsc->variant == pe_clone);
61 }
62 
70 static inline bool
71 pe_rsc_is_unique_clone(pe_resource_t *rsc)
72 {
73  return pe_rsc_is_clone(rsc) && pcmk_is_set(rsc->flags, pe_rsc_unique);
74 }
75 
83 static inline bool
84 pe_rsc_is_anon_clone(pe_resource_t *rsc)
85 {
86  return pe_rsc_is_clone(rsc) && !pcmk_is_set(rsc->flags, pe_rsc_unique);
87 }
88 
96 static inline bool
97 pe_rsc_is_bundled(pe_resource_t *rsc)
98 {
99  return uber_parent(rsc)->parent != NULL;
100 }
101 
102 #ifdef __cplusplus
103 }
104 #endif
105 
106 #endif
pe_node_t * pe_find_node(GList *node_list, const char *uname)
Definition: status.c:434
pe_node_t * pe_find_node_any(GList *node_list, const char *id, const char *uname)
Definition: status.c:406
pe_resource_t * pe_find_resource_with_flags(GList *rsc_list, const char *id, enum pe_find flags)
Definition: status.c:388
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:254
pe_resource_t * pe_find_resource(GList *rsc_list, const char *id_rh)
Definition: status.c:382
const char * action
Definition: pcmk_fence.c:30
void pe_reset_working_set(pe_working_set_t *data_set)
Reset a working set to default state without freeing it.
Definition: status.c:329
void cleanup_calculations(pe_working_set_t *data_set)
Reset working set to default state without freeing it or constraints.
Definition: status.c:270
pe_find
Determine behavior of pe_find_resource_with_flags()
Definition: pe_types.h:83
pe_resource_t * uber_parent(pe_resource_t *rsc)
Definition: complex.c:903
Utility functions.
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
Definition: util.h:114
void set_working_set_defaults(pe_working_set_t *data_set)
Definition: status.c:359
unsigned long long flags
Definition: pe_types.h:347
ISO_8601 Date handling.
enum pe_obj_types variant
Definition: pe_types.h:329
pe_node_t * pe_find_node_id(GList *node_list, const char *id)
Definition: status.c:418
const char * rsc_printable_id(pe_resource_t *rsc)
Definition: utils.c:1911
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:4042
Data types for cluster status.
uint64_t flags
Definition: remote.c:149
int pe_bundle_replicas(const pe_resource_t *rsc)
Get the number of configured replicas in a bundle.
Definition: bundle.c:2021
pe_resource_t * parent
Definition: pe_types.h:327