pacemaker  2.1.8-3980678f03
Scalable High-Availability cluster resource manager
bundles_internal.h
Go to the documentation of this file.
1 /*
2  * Copyright 2017-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_BUNDLES_INTERNAL__H
11 #define PCMK__CRM_COMMON_BUNDLES_INTERNAL__H
12 
13 #include <stdbool.h> // bool, false
14 
15 #include <crm/common/remote_internal.h> // pcmk__is_guest_or_bundle_node()
16 #include <crm/common/resources.h> // pcmk_rsc_variant_bundle
17 #include <crm/common/scheduler_types.h> // pcmk_resource_t, pcmk_node_t
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
24 typedef struct {
25  int offset;
26  char *ipaddr;
33 
44 static inline bool
45 pcmk__is_bundle(const pcmk_resource_t *rsc)
46 {
47  return (rsc != NULL) && (rsc->variant == pcmk_rsc_variant_bundle);
48 }
49 
58 static inline bool
59 pcmk__is_bundled(const pcmk_resource_t *rsc)
60 {
61  if (rsc == NULL) {
62  return false;
63  }
64  while (rsc->parent != NULL) {
65  rsc = rsc->parent;
66  }
67  return rsc->variant == pcmk_rsc_variant_bundle;
68 }
69 
78 static inline bool
79 pcmk__is_bundle_node(const pcmk_node_t *node)
80 {
81  return pcmk__is_guest_or_bundle_node(node)
82  && pcmk__is_bundled(node->details->remote_rsc);
83 }
84 
85 #ifdef __cplusplus
86 }
87 #endif
88 
89 #endif // PCMK__CRM_COMMON_BUNDLES_INTERNAL__H
Scheduler API for resources.
pcmk_node_t * node
Node created for this instance.
Type aliases needed to define scheduler objects.
pcmk_resource_t * ip
IP address resource for ipaddr.
char * ipaddr
IP address associated with this instance.
pcmk_resource_t * parent
Definition: resources.h:409
struct pe_node_shared_s * details
Definition: nodes.h:167
enum pe_obj_types variant
Definition: resources.h:410
pcmk_resource_t * child
Instance of bundled resource.
A single instance of a bundle.
pcmk_resource_t * container
Container associated with this instance.
int offset
0-origin index of this instance in bundle
pcmk_resource_t * remote
Pacemaker Remote connection into container.
pcmk_resource_t * remote_rsc
Definition: nodes.h:135