root/include/pcmki/pcmki_transition.h

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

INCLUDED FROM


   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 CRM_TRANSITION__H
  11 #  define CRM_TRANSITION__H
  12 
  13 #ifdef __cplusplus
  14 extern "C" {
  15 #endif
  16 
  17 #include <glib.h>
  18 #include <crm/crm.h>
  19 #include <crm/msg_xml.h>
  20 #include <crm/common/xml.h>
  21 
  22 typedef enum {
  23     action_type_pseudo,
  24     action_type_rsc,
  25     action_type_crm
  26 } action_type_e;
  27 
  28 typedef struct te_timer_s crm_action_timer_t;
  29 typedef struct crm_graph_s crm_graph_t;
  30 
  31 typedef struct synapse_s {
  32     int id;
  33     int priority;
  34 
  35     gboolean ready;
  36     gboolean failed;
  37     gboolean executed;
  38     gboolean confirmed;
  39 
  40     GListPtr actions;           /* crm_action_t* */
  41     GListPtr inputs;            /* crm_action_t* */
  42 } synapse_t;
  43 
  44 typedef struct crm_action_s {
  45     int id;
  46     int timeout;
  47     guint interval_ms;
  48     GHashTable *params;
  49     action_type_e type;
  50 
  51     crm_action_timer_t *timer;
  52     synapse_t *synapse;
  53 
  54     gboolean sent_update;       /* sent to the CIB */
  55     gboolean executed;          /* sent to the CRM */
  56     gboolean confirmed;
  57 
  58     gboolean failed;
  59     gboolean can_fail;
  60 
  61     xmlNode *xml;
  62 
  63 } crm_action_t;
  64 
  65 struct te_timer_s {
  66     int source_id;
  67     int timeout;
  68     crm_action_t *action;
  69 };
  70 
  71 /* order matters here */
  72 enum transition_action {
  73     tg_done,
  74     tg_stop,
  75     tg_restart,
  76     tg_shutdown,
  77 };
  78 
  79 struct crm_graph_s {
  80     int id;
  81     char *source;
  82     int abort_priority;
  83 
  84     gboolean complete;
  85     const char *abort_reason;
  86     enum transition_action completion_action;
  87 
  88     int num_actions;
  89     int num_synapses;
  90 
  91     int batch_limit;
  92     guint network_delay;
  93     guint stonith_timeout;
  94 
  95     int fired;
  96     int pending;
  97     int skipped;
  98     int completed;
  99     int incomplete;
 100 
 101     GListPtr synapses;          /* synapse_t* */
 102 
 103     int migration_limit;
 104 };
 105 
 106 typedef struct crm_graph_functions_s {
 107     gboolean(*pseudo) (crm_graph_t * graph, crm_action_t * action);
 108     gboolean(*rsc) (crm_graph_t * graph, crm_action_t * action);
 109     gboolean(*crmd) (crm_graph_t * graph, crm_action_t * action);
 110     gboolean(*stonith) (crm_graph_t * graph, crm_action_t * action);
 111     gboolean(*allowed) (crm_graph_t * graph, crm_action_t * action);
 112 } crm_graph_functions_t;
 113 
 114 enum transition_status {
 115     transition_active,
 116     transition_pending,         /* active but no actions performed this time */
 117     transition_complete,
 118     transition_stopped,
 119     transition_terminated,
 120     transition_action_failed,
 121     transition_failed,
 122 };
 123 
 124 void set_default_graph_functions(void);
 125 void set_graph_functions(crm_graph_functions_t * fns);
 126 crm_graph_t *unpack_graph(xmlNode * xml_graph, const char *reference);
 127 int run_graph(crm_graph_t * graph);
 128 gboolean update_graph(crm_graph_t * graph, crm_action_t * action);
 129 void destroy_graph(crm_graph_t * graph);
 130 const char *transition_status(enum transition_status state);
 131 void print_graph(unsigned int log_level, crm_graph_t * graph);
 132 void print_action(int log_level, const char *prefix, crm_action_t * action);
 133 bool update_abort_priority(crm_graph_t * graph, int priority,
 134                            enum transition_action action, const char *abort_reason);
 135 const char *actiontype2text(action_type_e type);
 136 lrmd_event_data_t *convert_graph_action(xmlNode * resource, crm_action_t * action, int status,
 137                                         int rc);
 138 
 139 #ifdef __cplusplus
 140 }
 141 #endif
 142 
 143 #endif

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