root/lib/pengine/variant.h

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

INCLUDED FROM


   1 /*
   2  * Copyright 2004-2021 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     bool added_promotion_scores;
  27     bool added_promoted_constraints;
  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 enum pe__bundle_mount_flags {
  55     pe__bundle_mount_none       = 0x00,
  56 
  57     // mount instance-specific subdirectory rather than source directly
  58     pe__bundle_mount_subdir     = 0x01
  59 };
  60 
  61 typedef struct {
  62     char *source;
  63     char *target;
  64     char *options;
  65     uint32_t flags; // bitmask of pe__bundle_mount_flags
  66 } pe__bundle_mount_t;
  67 
  68 typedef struct {
  69     char *source;
  70     char *target;
  71 } pe__bundle_port_t;
  72 
  73 enum pe__container_agent {
  74     PE__CONTAINER_AGENT_UNKNOWN,
  75     PE__CONTAINER_AGENT_DOCKER,
  76     PE__CONTAINER_AGENT_RKT,
  77     PE__CONTAINER_AGENT_PODMAN,
  78 };
  79 
  80 #define PE__CONTAINER_AGENT_UNKNOWN_S "unknown"
  81 #define PE__CONTAINER_AGENT_DOCKER_S  "docker"
  82 #define PE__CONTAINER_AGENT_RKT_S     "rkt"
  83 #define PE__CONTAINER_AGENT_PODMAN_S  "podman"
  84 
  85 typedef struct pe__bundle_variant_data_s {
  86         int promoted_max;
  87         int nreplicas;
  88         int nreplicas_per_host;
  89         char *prefix;
  90         char *image;
  91         const char *ip_last;
  92         char *host_network;
  93         char *host_netmask;
  94         char *control_port;
  95         char *container_network;
  96         char *ip_range_start;
  97         gboolean add_host;
  98         char *container_host_options;
  99         char *container_command;
 100         char *launcher_options;
 101         const char *attribute_target;
 102 
 103         pe_resource_t *child;
 104 
 105         GList *replicas;    // pe__bundle_replica_t *
 106         GList *ports;       // pe__bundle_port_t *
 107         GList *mounts;      // pe__bundle_mount_t *
 108 
 109         enum pe__container_agent agent_type;
 110 } pe__bundle_variant_data_t;
 111 
 112 #    define get_bundle_variant_data(data, rsc)                       \
 113         CRM_ASSERT(rsc != NULL);                                        \
 114         CRM_ASSERT(rsc->variant == pe_container);                       \
 115         CRM_ASSERT(rsc->variant_opaque != NULL);                        \
 116         data = (pe__bundle_variant_data_t *)rsc->variant_opaque;                \
 117 
 118 #  elif VARIANT_GROUP
 119 
 120 typedef struct group_variant_data_s {
 121     int num_children;
 122     pe_resource_t *first_child;
 123     pe_resource_t *last_child;
 124 
 125     gboolean colocated;
 126     gboolean ordered;
 127 
 128     gboolean child_starting;
 129     gboolean child_stopping;
 130 
 131 } group_variant_data_t;
 132 
 133 #    define get_group_variant_data(data, rsc)                           \
 134         CRM_ASSERT(rsc != NULL);                                        \
 135         CRM_ASSERT(rsc->variant == pe_group);                           \
 136         CRM_ASSERT(rsc->variant_opaque != NULL);                        \
 137         data = (group_variant_data_t *)rsc->variant_opaque;             \
 138 
 139 #  elif VARIANT_NATIVE
 140 
 141 typedef struct native_variant_data_s {
 142     int dummy;
 143 } native_variant_data_t;
 144 
 145 #    define get_native_variant_data(data, rsc)                          \
 146         CRM_ASSERT(rsc != NULL);                                        \
 147         CRM_ASSERT(rsc->variant == pe_native);                          \
 148         CRM_ASSERT(rsc->variant_opaque != NULL);                        \
 149         data = (native_variant_data_t *)rsc->variant_opaque;
 150 
 151 #  endif
 152 
 153 #endif

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