root/lib/pengine/variant.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 /* 
   2  * Copyright (C) 2004 Andrew Beekhof <andrew@beekhof.net>
   3  * 
   4  * This library is free software; you can redistribute it and/or
   5  * modify it under the terms of the GNU Lesser General Public
   6  * License as published by the Free Software Foundation; either
   7  * version 2.1 of the License, or (at your option) any later version.
   8  * 
   9  * This library is distributed in the hope that it will be useful,
  10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12  * Lesser General Public License for more details.
  13  * 
  14  * You should have received a copy of the GNU Lesser General Public
  15  * License along with this library; if not, write to the Free Software
  16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  17  */
  18 #ifndef PE_VARIANT__H
  19 #  define PE_VARIANT__H
  20 
  21 #  if VARIANT_CLONE
  22 
  23 typedef struct clone_variant_data_s {
  24     int clone_max;
  25     int clone_node_max;
  26 
  27     int master_max;
  28     int master_node_max;
  29 
  30     int total_clones;
  31     int active_clones;
  32     int max_nodes;
  33 
  34     int masters_active;
  35     int masters_allocated;
  36 
  37     gboolean interleave;
  38     gboolean ordered;
  39     gboolean applied_master_prefs;
  40     gboolean merged_master_weights;
  41 
  42     notify_data_t *stop_notify;
  43     notify_data_t *start_notify;
  44     notify_data_t *demote_notify;
  45     notify_data_t *promote_notify;
  46 
  47     xmlNode *xml_obj_child;
  48 
  49     gboolean notify_confirm;
  50 
  51 } clone_variant_data_t;
  52 
  53 #    define get_clone_variant_data(data, rsc)                           \
  54         CRM_ASSERT(rsc != NULL);                                        \
  55         CRM_ASSERT(rsc->variant == pe_clone || rsc->variant == pe_master); \
  56         data = (clone_variant_data_t *)rsc->variant_opaque;
  57 
  58 #  elif VARIANT_CONTAINER
  59 
  60 typedef struct
  61 {
  62         int offset;
  63         node_t *node;
  64         char *ipaddr;
  65         resource_t *ip;
  66         resource_t *child;
  67         resource_t *docker;
  68         resource_t *remote;
  69 
  70 } container_grouping_t;
  71 
  72 typedef struct
  73 {
  74         char *source;
  75         char *target;
  76         char *options;
  77         int flags;
  78 
  79 } container_mount_t;
  80 
  81 typedef struct
  82 {
  83         char *source;
  84         char *target;
  85 
  86 } container_port_t;
  87 
  88 enum container_type {
  89         PE_CONTAINER_TYPE_UNKNOWN,
  90         PE_CONTAINER_TYPE_DOCKER,
  91         PE_CONTAINER_TYPE_RKT
  92 };
  93 
  94 #define PE_CONTAINER_TYPE_UNKNOWN_S "unknown"
  95 #define PE_CONTAINER_TYPE_DOCKER_S  "Docker"
  96 #define PE_CONTAINER_TYPE_RKT_S     "rkt"
  97 
  98 typedef struct container_variant_data_s {
  99         int masters;
 100         int replicas;
 101         int replicas_per_host;
 102         char *prefix;
 103         char *image;
 104         const char *ip_last;
 105         char *host_network;
 106         char *host_netmask;
 107         char *control_port;
 108         char *docker_network;
 109         char *ip_range_start;
 110         char *docker_host_options;
 111         char *docker_run_options;
 112         char *docker_run_command;
 113         const char *attribute_target;
 114 
 115         resource_t *child;
 116 
 117         GListPtr tuples;     /* container_grouping_t *       */
 118         GListPtr ports;      /*        */
 119         GListPtr mounts;     /*        */
 120 
 121         enum container_type type;
 122 } container_variant_data_t;
 123 
 124 #    define get_container_variant_data(data, rsc)                       \
 125         CRM_ASSERT(rsc != NULL);                                        \
 126         CRM_ASSERT(rsc->variant == pe_container);                       \
 127         CRM_ASSERT(rsc->variant_opaque != NULL);                        \
 128         data = (container_variant_data_t *)rsc->variant_opaque;         \
 129 
 130 #  elif VARIANT_GROUP
 131 
 132 typedef struct group_variant_data_s {
 133     int num_children;
 134     resource_t *first_child;
 135     resource_t *last_child;
 136 
 137     gboolean colocated;
 138     gboolean ordered;
 139 
 140     gboolean child_starting;
 141     gboolean child_stopping;
 142 
 143 } group_variant_data_t;
 144 
 145 #    define get_group_variant_data(data, rsc)                           \
 146         CRM_ASSERT(rsc != NULL);                                        \
 147         CRM_ASSERT(rsc->variant == pe_group);                           \
 148         CRM_ASSERT(rsc->variant_opaque != NULL);                        \
 149         data = (group_variant_data_t *)rsc->variant_opaque;             \
 150 
 151 #  elif VARIANT_NATIVE
 152 
 153 typedef struct native_variant_data_s {
 154     int dummy;
 155 } native_variant_data_t;
 156 
 157 #    define get_native_variant_data(data, rsc)                          \
 158         CRM_ASSERT(rsc != NULL);                                        \
 159         CRM_ASSERT(rsc->variant == pe_native);                          \
 160         CRM_ASSERT(rsc->variant_opaque != NULL);                        \
 161         data = (native_variant_data_t *)rsc->variant_opaque;
 162 
 163 #  endif
 164 
 165 #endif

/* [previous][next][first][last][top][bottom][index][help] */