pacemaker  3.0.0-d8340737c4
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 <stdio.h> // NULL
14 #include <stdbool.h> // bool, false
15 
16 #include <crm/common/nodes_internal.h> // struct pcmk__node_private
17 #include <crm/common/remote_internal.h> // pcmk__is_guest_or_bundle_node()
18 #include <crm/common/resources_internal.h> // pcmk__rsc_variant_bundle etc.
19 #include <crm/common/scheduler_types.h> // pcmk_resource_t, pcmk_node_t
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
26 typedef struct {
27  int offset;
28  char *ipaddr;
35 
46 static inline bool
47 pcmk__is_bundle(const pcmk_resource_t *rsc)
48 {
49  return (rsc != NULL) && (rsc->priv->variant == pcmk__rsc_variant_bundle);
50 }
51 
60 static inline bool
61 pcmk__is_bundled(const pcmk_resource_t *rsc)
62 {
63  if (rsc == NULL) {
64  return false;
65  }
66  while (rsc->priv->parent != NULL) {
67  rsc = rsc->priv->parent;
68  }
69  return rsc->priv->variant == pcmk__rsc_variant_bundle;
70 }
71 
80 static inline bool
81 pcmk__is_bundle_node(const pcmk_node_t *node)
82 {
83  return pcmk__is_guest_or_bundle_node(node)
84  && pcmk__is_bundled(node->priv->remote);
85 }
86 
87 #ifdef __cplusplus
88 }
89 #endif
90 
91 #endif // PCMK__CRM_COMMON_BUNDLES_INTERNAL__H
pcmk_node_t * node
Copy of node created for this instance.
pcmk_resource_t * parent
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__node_private_t * priv
Definition: nodes.h:85
enum pcmk__rsc_variant variant
pcmk__resource_private_t * priv
Definition: resources.h:61
pcmk_resource_t * child
Instance of bundled resource.
A single instance of a bundle.
pcmk_resource_t * container
Container associated with this instance.
pcmk_resource_t * remote
int offset
0-origin index of this instance in bundle
pcmk_resource_t * remote
Pacemaker Remote connection into container.