root/lib/pengine/variant.h

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

INCLUDED FROM


   1 /*
   2  * Copyright 2004-2022 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     uint32_t flags; // Group of enum pe__clone_flags
  25 
  26     notify_data_t *stop_notify;
  27     notify_data_t *start_notify;
  28     notify_data_t *demote_notify;
  29     notify_data_t *promote_notify;
  30 
  31     xmlNode *xml_obj_child;
  32 } clone_variant_data_t;
  33 
  34 #    define get_clone_variant_data(data, rsc)                           \
  35         CRM_ASSERT(rsc != NULL);                                        \
  36         CRM_ASSERT(rsc->variant == pe_clone); \
  37         data = (clone_variant_data_t *)rsc->variant_opaque;
  38 
  39 #  elif PE__VARIANT_BUNDLE
  40 
  41 typedef struct {
  42     int offset;
  43     char *ipaddr;
  44     pe_node_t *node;
  45     pe_resource_t *ip;
  46     pe_resource_t *child;
  47     pe_resource_t *container;
  48     pe_resource_t *remote;
  49 } pe__bundle_replica_t;
  50 
  51 enum pe__bundle_mount_flags {
  52     pe__bundle_mount_none       = 0x00,
  53 
  54     // mount instance-specific subdirectory rather than source directly
  55     pe__bundle_mount_subdir     = 0x01
  56 };
  57 
  58 typedef struct {
  59     char *source;
  60     char *target;
  61     char *options;
  62     uint32_t flags; // bitmask of pe__bundle_mount_flags
  63 } pe__bundle_mount_t;
  64 
  65 typedef struct {
  66     char *source;
  67     char *target;
  68 } pe__bundle_port_t;
  69 
  70 enum pe__container_agent {
  71     PE__CONTAINER_AGENT_UNKNOWN,
  72     PE__CONTAINER_AGENT_DOCKER,
  73     PE__CONTAINER_AGENT_RKT,
  74     PE__CONTAINER_AGENT_PODMAN,
  75 };
  76 
  77 #define PE__CONTAINER_AGENT_UNKNOWN_S "unknown"
  78 #define PE__CONTAINER_AGENT_DOCKER_S  "docker"
  79 #define PE__CONTAINER_AGENT_RKT_S     "rkt"
  80 #define PE__CONTAINER_AGENT_PODMAN_S  "podman"
  81 
  82 typedef struct pe__bundle_variant_data_s {
  83         int promoted_max;
  84         int nreplicas;
  85         int nreplicas_per_host;
  86         char *prefix;
  87         char *image;
  88         const char *ip_last;
  89         char *host_network;
  90         char *host_netmask;
  91         char *control_port;
  92         char *container_network;
  93         char *ip_range_start;
  94         gboolean add_host;
  95         gchar *container_host_options;
  96         char *container_command;
  97         char *launcher_options;
  98         const char *attribute_target;
  99 
 100         pe_resource_t *child;
 101 
 102         GList *replicas;    // pe__bundle_replica_t *
 103         GList *ports;       // pe__bundle_port_t *
 104         GList *mounts;      // pe__bundle_mount_t *
 105 
 106         enum pe__container_agent agent_type;
 107 } pe__bundle_variant_data_t;
 108 
 109 #    define get_bundle_variant_data(data, rsc)                       \
 110         CRM_ASSERT(rsc != NULL);                                        \
 111         CRM_ASSERT(rsc->variant == pe_container);                       \
 112         CRM_ASSERT(rsc->variant_opaque != NULL);                        \
 113         data = (pe__bundle_variant_data_t *)rsc->variant_opaque;                \
 114 
 115 #  endif
 116 
 117 #endif

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