root/crmd/crmd_fsa.h

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

INCLUDED FROM


   1 /*
   2  * Copyright (C) 2004 Andrew Beekhof <andrew@beekhof.net>
   3  *
   4  * This program 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 of the License, or (at your option) any later version.
   8  *
   9  * This software 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  * 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 CRMD_FSA__H
  19 #  define CRMD_FSA__H
  20 
  21 #  include <fsa_defines.h>
  22 
  23 #  include <crm/crm.h>
  24 #  include <crm/cib.h>
  25 #  include <crm/common/xml.h>
  26 #  include <crm/common/mainloop.h>
  27 #  include <crm/cluster.h>
  28 #  include <crm/cluster/election.h>
  29 #  include <crm/common/ipcs.h>
  30 
  31 #  if SUPPORT_HEARTBEAT
  32 extern ll_cluster_t *fsa_cluster_conn;
  33 #  endif
  34 
  35 /* copy from struct client_child in heartbeat.h
  36  *
  37  * Plus a couple of other things
  38  */
  39 struct crm_subsystem_s {
  40     pid_t pid;                  /* Process id of child process */
  41     const char *name;           /* executable name */
  42     const char *path;           /* Command location */
  43     const char *command;        /* Command with path */
  44     const char *args;           /* Command arguments */
  45     crm_client_t *client;       /* Client connection object */
  46 
  47     gboolean sent_kill;
  48     mainloop_io_t *source;      /* How can we communicate with it */
  49     long long flag_connected;   /*  */
  50     long long flag_required;    /*  */
  51 };
  52 
  53 typedef struct fsa_timer_s fsa_timer_t;
  54 struct fsa_timer_s {
  55     guint source_id;            /* timer source id */
  56     int period_ms;              /* timer period */
  57     enum crmd_fsa_input fsa_input;
  58      gboolean(*callback) (gpointer data);
  59     gboolean repeat;
  60     int counter;
  61 };
  62 
  63 enum fsa_data_type {
  64     fsa_dt_none,
  65     fsa_dt_ha_msg,
  66     fsa_dt_xml,
  67     fsa_dt_lrm,
  68 };
  69 
  70 typedef struct fsa_data_s fsa_data_t;
  71 struct fsa_data_s {
  72     int id;
  73     enum crmd_fsa_input fsa_input;
  74     enum crmd_fsa_cause fsa_cause;
  75     long long actions;
  76     const char *origin;
  77     void *data;
  78     enum fsa_data_type data_type;
  79 };
  80 
  81 extern enum crmd_fsa_state s_crmd_fsa(enum crmd_fsa_cause cause);
  82 
  83 /* Global FSA stuff */
  84 extern volatile gboolean do_fsa_stall;
  85 extern volatile enum crmd_fsa_state fsa_state;
  86 extern volatile long long fsa_input_register;
  87 extern volatile long long fsa_actions;
  88 
  89 extern cib_t *fsa_cib_conn;
  90 
  91 extern char *fsa_our_uname;
  92 extern char *fsa_our_uuid;
  93 extern char *fsa_pe_ref;        /* the last invocation of the PE */
  94 extern char *fsa_our_dc;
  95 extern char *fsa_our_dc_version;
  96 extern GListPtr fsa_message_queue;
  97 
  98 extern char *fsa_cluster_name;
  99 
 100 extern election_t *fsa_election;   /*  */
 101 extern fsa_timer_t *election_trigger;   /*  */
 102 extern fsa_timer_t *election_timeout;   /*  */
 103 extern fsa_timer_t *shutdown_escalation_timer;  /*  */
 104 extern fsa_timer_t *transition_timer;
 105 extern fsa_timer_t *integration_timer;
 106 extern fsa_timer_t *finalization_timer;
 107 extern fsa_timer_t *wait_timer;
 108 extern fsa_timer_t *recheck_timer;
 109 
 110 extern crm_trigger_t *fsa_source;
 111 extern crm_trigger_t *config_read;
 112 
 113 extern struct crm_subsystem_s *cib_subsystem;
 114 extern struct crm_subsystem_s *te_subsystem;
 115 extern struct crm_subsystem_s *pe_subsystem;
 116 
 117 /* these two should be moved elsewhere... */
 118 extern void do_update_cib_nodes(gboolean overwrite, const char *caller);
 119 int crmd_cib_smart_opt(void);
 120 
 121 #  define AM_I_DC is_set(fsa_input_register, R_THE_DC)
 122 #  define AM_I_OPERATIONAL (is_set(fsa_input_register, R_STARTING)==FALSE)
 123 extern unsigned long long saved_ccm_membership_id;
 124 extern gboolean ever_had_quorum;
 125 
 126 #  include <fsa_proto.h>
 127 #  include <crmd_utils.h>
 128 
 129 #  define trigger_fsa(source) crm_trace("Triggering FSA: %s", __FUNCTION__); \
 130         mainloop_set_trigger(source);
 131 
 132 #endif

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