pacemaker  2.0.2-debe490
Scalable High-Availability cluster resource manager
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
variant.h
Go to the documentation of this file.
1 /*
2  * Copyright 2004-2019 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 PE_VARIANT__H
11 # define PE_VARIANT__H
12 
13 # if VARIANT_CLONE
14 
15 typedef struct clone_variant_data_s {
16  int clone_max;
17  int clone_node_max;
18 
19  int promoted_max;
20  int promoted_node_max;
21 
22  int total_clones;
23 
24  // @TODO make these a bitmask
25  gboolean ordered;
26  gboolean applied_master_prefs;
27  gboolean merged_master_weights;
28 
29  notify_data_t *stop_notify;
30  notify_data_t *start_notify;
31  notify_data_t *demote_notify;
32  notify_data_t *promote_notify;
33 
34  xmlNode *xml_obj_child;
35 } clone_variant_data_t;
36 
37 # define get_clone_variant_data(data, rsc) \
38  CRM_ASSERT(rsc != NULL); \
39  CRM_ASSERT(rsc->variant == pe_clone); \
40  data = (clone_variant_data_t *)rsc->variant_opaque;
41 
42 # elif PE__VARIANT_BUNDLE
43 
44 typedef struct {
45  int offset;
46  char *ipaddr;
47  pe_node_t *node;
48  pe_resource_t *ip;
49  pe_resource_t *child;
50  pe_resource_t *container;
51  pe_resource_t *remote;
52 } pe__bundle_replica_t;
53 
54 typedef struct {
55  char *source;
56  char *target;
57  char *options;
58  int flags;
59 } pe__bundle_mount_t;
60 
61 typedef struct {
62  char *source;
63  char *target;
64 } pe__bundle_port_t;
65 
66 enum pe__container_agent {
67  PE__CONTAINER_AGENT_UNKNOWN,
68  PE__CONTAINER_AGENT_DOCKER,
69  PE__CONTAINER_AGENT_RKT,
70  PE__CONTAINER_AGENT_PODMAN,
71 };
72 
73 #define PE__CONTAINER_AGENT_UNKNOWN_S "unknown"
74 #define PE__CONTAINER_AGENT_DOCKER_S "docker"
75 #define PE__CONTAINER_AGENT_RKT_S "rkt"
76 #define PE__CONTAINER_AGENT_PODMAN_S "podman"
77 
78 typedef struct pe__bundle_variant_data_s {
79  int promoted_max;
80  int nreplicas;
81  int nreplicas_per_host;
82  char *prefix;
83  char *image;
84  const char *ip_last;
85  char *host_network;
86  char *host_netmask;
87  char *control_port;
88  char *container_network;
89  char *ip_range_start;
90  gboolean add_host;
91  char *container_host_options;
92  char *container_command;
93  char *launcher_options;
94  const char *attribute_target;
95 
96  resource_t *child;
97 
98  GList *replicas; // pe__bundle_replica_t *
99  GList *ports; // pe__bundle_port_t *
100  GList *mounts; // pe__bundle_mount_t *
101 
102  enum pe__container_agent agent_type;
103 } pe__bundle_variant_data_t;
104 
105 # define get_bundle_variant_data(data, rsc) \
106  CRM_ASSERT(rsc != NULL); \
107  CRM_ASSERT(rsc->variant == pe_container); \
108  CRM_ASSERT(rsc->variant_opaque != NULL); \
109  data = (pe__bundle_variant_data_t *)rsc->variant_opaque; \
110 
111 # elif VARIANT_GROUP
112 
113 typedef struct group_variant_data_s {
114  int num_children;
115  resource_t *first_child;
116  resource_t *last_child;
117 
118  gboolean colocated;
119  gboolean ordered;
120 
121  gboolean child_starting;
122  gboolean child_stopping;
123 
124 } group_variant_data_t;
125 
126 # define get_group_variant_data(data, rsc) \
127  CRM_ASSERT(rsc != NULL); \
128  CRM_ASSERT(rsc->variant == pe_group); \
129  CRM_ASSERT(rsc->variant_opaque != NULL); \
130  data = (group_variant_data_t *)rsc->variant_opaque; \
131 
132 # elif VARIANT_NATIVE
133 
134 typedef struct native_variant_data_s {
135  int dummy;
136 } native_variant_data_t;
137 
138 # define get_native_variant_data(data, rsc) \
139  CRM_ASSERT(rsc != NULL); \
140  CRM_ASSERT(rsc->variant == pe_native); \
141  CRM_ASSERT(rsc->variant_opaque != NULL); \
142  data = (native_variant_data_t *)rsc->variant_opaque;
143 
144 # endif
145 
146 #endif
uint64_t flags
Definition: remote.c:148