Heartbeat  3-0
About: Heartbeat (Linux-HA) provides a heartbeat and IP address takeover functions for a high-availability Linux cluster.
  Fossies Dox: Heartbeat-3-0-STABLE-3.0.6.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

config.c File Reference
#include <lha_internal.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <ctype.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <time.h>
#include <sys/time.h>
#include <unistd.h>
#include <dirent.h>
#include <dlfcn.h>
#include <fcntl.h>
#include <pwd.h>
#include <grp.h>
#include <netdb.h>
#include <sched.h>
#include <sys/wait.h>
#include <sys/utsname.h>
#include <sys/resource.h>
#include <heartbeat.h>
#include <heartbeat_private.h>
#include <ha_msg.h>
#include <pils/plugin.h>
#include <clplumbing/realtime.h>
#include <clplumbing/netstring.h>
#include <clplumbing/coredumps.h>
#include <stonith/stonith.h>
#include <HBcomm.h>
#include <compress.h>
#include <hb_module.h>
#include <hb_api.h>
#include <hb_config.h>
#include <hb_api_core.h>
#include <clplumbing/cl_syslog.h>
#include <clplumbing/cl_misc.h>
#include <ha_version.h>
Include dependency graph for config.c:

Go to the source code of this file.

Data Structures

struct  directive
 
struct  WholeLineDirective
 
struct  pcmk_child
 

Macros

#define DIRTYALIASKLUDGE
 

Enumerations

enum  pcmk_directive_value {
  OFF = 0, AUTO = 1, MINIMAL, RESPAWN,
  VALGRIND, CCM_ONLY
}
 

Functions

void dellist_destroy (void)
 
int dellist_add (const char *nodename)
 
const char * get_hg_version (void)
 
static int set_cluster_name (const char *value)
 
static int add_normal_node (const char *)
 
static int set_hopfudge (const char *)
 
static int set_keepalive_ms (const char *)
 
static int set_deadtime_ms (const char *)
 
static int set_deadping_ms (const char *)
 
static int set_initial_deadtime_ms (const char *)
 
static int set_watchdogdev (const char *)
 
static int set_baudrate (const char *)
 
static int set_udpport (const char *)
 
static int set_facility (const char *)
 
static int set_logfile (const char *)
 
static int set_dbgfile (const char *)
 
static int set_nice_failback (const char *)
 
static int set_auto_failback (const char *)
 
static int set_warntime_ms (const char *)
 
static int set_stonith_info (const char *)
 
static int set_stonith_host_info (const char *)
 
static int set_realtime_prio (const char *)
 
static int add_client_child (const char *)
 
static int add_failfast_child (const char *)
 
static int set_compression (const char *)
 
static int set_compression_threshold (const char *)
 
static int set_traditional_compression (const char *)
 
static int set_env (const char *)
 
static int set_max_rexmit_delay (const char *)
 
static int set_generation_method (const char *)
 
static int set_realtime (const char *)
 
static int set_debuglevel (const char *)
 
static int set_api_authorization (const char *)
 
static int set_msgfmt (const char *)
 
static int set_logdaemon (const char *)
 
static int set_logdconntime (const char *)
 
static int set_register_to_apphbd (const char *)
 
static int set_badpack_warn (const char *)
 
static int set_coredump (const char *)
 
static int set_corerootdir (const char *)
 
static int set_crm_daemon_dir (const char *)
 
static int set_pengine_by_crm (const char *)
 
static int set_release2mode (const char *)
 
static int set_pcmk_support (const char *)
 
static int set_autojoin (const char *)
 
static int set_uuidfrom (const char *)
 
static int ha_config_check_boolean (const char *)
 
static int set_memreserve (const char *)
 
static int set_quorum_server (const char *value)
 
static int set_syslog_logfilefmt (const char *value)
 
void hb_set_max_rexmit_delay (int)
 
static int islegaldirective (const char *directive)
 
static int parse_config (const char *cfgfile, char *nodename)
 
static int add_option (const char *option, const char *value)
 
static void check_logd_usage (int *errcount)
 
static gboolean r1_style_valid (void)
 
int init_config (const char *cfgfile)
 
static void init_node_link_info (struct node_info *node)
 
void dump_config (void)
 
void dump_default_config (int wikiout)
 
int parse_ha_resources (const char *cfgfile)
 
static void dellist_append (struct node_info *hip)
 
static gint dellist_match (gconstpointer data, gconstpointer nodename)
 
void remove_from_dellist (const char *nodename)
 
int add_node (const char *value, int nodetype)
 
int set_node_weight (const char *value, int weight)
 
int set_node_site (const char *value, const char *site)
 
int remove_node (const char *value, int deletion)
 
int StringToBaud (const char *baudstr)
 
static int add_client_child_base (const char *directive, gboolean failfast)
 
static int fail_if_after_pacemaker (const char *directive)
 
static char * path_command_ok (const char *path, const char *basename)
 
static int add_pcmk_client_child (struct pcmk_child *p, enum pcmk_directive_value onoff)
 

Variables

struct directive Directives []
 
static const struct WholeLineDirective WLdirectives []
 
const char * cmdname
 
int parse_only
 
struct hb_mediasysmedia [MAXMEDIA]
 
struct sys_configconfig
 
struct sys_config config_init_value
 
volatile struct pstat_shmprocinfo
 
volatile struct process_infocurproc
 
char * watchdogdev
 
int nummedia
 
int nice_failback
 
int auto_failback
 
int DoManageResources
 
int hb_realtime_prio
 
PILPluginUniv * PluginLoadingSystem
 
GHashTable * CommFunctions
 
GHashTable * CompressFuncs
 
GHashTable * APIAuthorization = NULL
 
struct node_infocurnode
 
int timebasedgenno
 
int enable_realtime = TRUE
 
int debug_level
 
int netstring_format = FALSE
 
int UseApphbd
 
GSList * del_node_list
 
int num_hb_media_types
 
static gboolean any_media_statements_yet = FALSE
 
struct hb_media_fns ** hbmedia_types
 

Macro Definition Documentation

◆ DIRTYALIASKLUDGE

#define DIRTYALIASKLUDGE

Definition at line 65 of file config.c.

Enumeration Type Documentation

◆ pcmk_directive_value

Enumerator
OFF 
AUTO 
MINIMAL 
RESPAWN 
VALGRIND 
CCM_ONLY 

Definition at line 2600 of file config.c.

Function Documentation

◆ add_client_child()

static int add_client_child ( const char *  directive)
static

Definition at line 2219 of file config.c.

References add_client_child_base(), and FALSE.

◆ add_client_child_base()

◆ add_failfast_child()

static int add_failfast_child ( const char *  directive)
static

Definition at line 2224 of file config.c.

References add_client_child_base(), and TRUE.

◆ add_node()

◆ add_normal_node()

static int add_normal_node ( const char *  value)
static

Definition at line 1518 of file config.c.

References add_node(), and NORMALNODE_I.

Referenced by init_config().

◆ add_option()

◆ add_pcmk_client_child()

◆ check_logd_usage()

static void check_logd_usage ( int *  errcount)
static

◆ dellist_add()

int dellist_add ( const char *  nodename)

◆ dellist_append()

static void dellist_append ( struct node_info hip)
static

Definition at line 1265 of file config.c.

References del_node_list, and NULL.

Referenced by dellist_add(), and remove_node().

◆ dellist_destroy()

void dellist_destroy ( void  )

Definition at line 1249 of file config.c.

References del_node_list, and NULL.

Referenced by HBDoMsg_T_REPNODES().

◆ dellist_match()

static gint dellist_match ( gconstpointer  data,
gconstpointer  nodename 
)
static

Definition at line 1302 of file config.c.

References HOSTLENG, node_info::nodename, and NULL.

Referenced by remove_from_dellist().

◆ dump_config()

void dump_config ( void  )

◆ dump_default_config()

void dump_default_config ( int  wikiout)

Definition at line 949 of file config.c.

References directive::defaultvalue, DIMOF, Directives, directive::explanation, directive::name, and NULL.

Referenced by main().

◆ fail_if_after_pacemaker()

static int fail_if_after_pacemaker ( const char *  directive)
static

Definition at line 2559 of file config.c.

References GetParameterValue(), and KEY_PACEMAKER.

Referenced by set_crm_daemon_dir(), and set_pengine_by_crm().

◆ get_hg_version()

const char * get_hg_version ( void  )

Definition at line 241 of file config.c.

Referenced by main(), and printversion().

◆ ha_config_check_boolean()

static int ha_config_check_boolean ( const char *  value)
static

Definition at line 2842 of file config.c.

References NULL, and result.

Referenced by set_pengine_by_crm().

◆ hb_set_max_rexmit_delay()

void hb_set_max_rexmit_delay ( int  value)

Definition at line 52 of file hb_rexmit.c.

References max_rexmit_delay.

Referenced by set_max_rexmit_delay().

◆ init_config()

◆ init_node_link_info()

static void init_node_link_info ( struct node_info node)
static

◆ islegaldirective()

static int islegaldirective ( const char *  directive)
static

Definition at line 1127 of file config.c.

References DIMOF, Directives, ha_log, HB_COMM_TYPE_S, PluginLoadingSystem, and WLdirectives.

Referenced by parse_config().

◆ parse_config()

◆ parse_ha_resources()

int parse_ha_resources ( const char *  cfgfile)

Definition at line 1063 of file config.c.

References COMMENTCHAR, config, EOS, ha_log, lookup_node(), NULL, sys_config::rsc_time, and WHITESPACE.

◆ path_command_ok()

static char* path_command_ok ( const char *  path,
const char *  basename 
)
static

Definition at line 2613 of file config.c.

References ha_log, and NULL.

Referenced by add_pcmk_client_child().

◆ r1_style_valid()

static gboolean r1_style_valid ( void  )
static

Definition at line 295 of file config.c.

References config, DoManageResources, FALSE, HB_JOIN_NONE, sys_config::rtjoinconfig, and TRUE.

Referenced by init_config().

◆ remove_from_dellist()

void remove_from_dellist ( const char *  nodename)

Definition at line 1314 of file config.c.

References del_node_list, dellist_match(), node_info::nodename, and NULL.

Referenced by add_node().

◆ remove_node()

◆ set_api_authorization()

static int set_api_authorization ( const char *  directive)
static

Definition at line 2390 of file config.c.

References APIAuthorization, client_process::client_id, EOS, KEY_APIPERM, NULL, and WHITESPACE.

Referenced by parse_config(), and set_pcmk_support().

◆ set_auto_failback()

static int set_auto_failback ( const char *  value)
static

Definition at line 1770 of file config.c.

References auto_failback, FALSE, nice_failback, and TRUE.

Referenced by set_nice_failback().

◆ set_autojoin()

static int set_autojoin ( const char *  value)
static

◆ set_badpack_warn()

static int set_badpack_warn ( const char *  value)
static

Definition at line 2106 of file config.c.

References TRUE.

◆ set_baudrate()

static int set_baudrate ( const char *  value)
static

Definition at line 1635 of file config.c.

References any_media_statements_yet, cmdname, serial_baud, and StringToBaud().

◆ set_cluster_name()

static int set_cluster_name ( const char *  value)
static

Definition at line 1502 of file config.c.

References sys_config::cluster, and config.

◆ set_compression()

static int set_compression ( const char *  directive)
static

Definition at line 2230 of file config.c.

◆ set_compression_threshold()

static int set_compression_threshold ( const char *  value)
static

Definition at line 2236 of file config.c.

◆ set_coredump()

static int set_coredump ( const char *  value)
static

Definition at line 2527 of file config.c.

◆ set_corerootdir()

static int set_corerootdir ( const char *  value)
static

Definition at line 2550 of file config.c.

◆ set_crm_daemon_dir()

static int set_crm_daemon_dir ( const char *  value)
static

Definition at line 2570 of file config.c.

References fail_if_after_pacemaker().

◆ set_dbgfile()

static int set_dbgfile ( const char *  value)
static

Definition at line 1714 of file config.c.

References config, sys_config::dbgfile, DEVNULL, and sys_config::use_dbgfile.

◆ set_deadping_ms()

static int set_deadping_ms ( const char *  value)
static

Definition at line 1563 of file config.c.

References config, and sys_config::deadping_ms.

◆ set_deadtime_ms()

static int set_deadtime_ms ( const char *  value)
static

Definition at line 1552 of file config.c.

References config, and sys_config::deadtime_ms.

◆ set_debuglevel()

static int set_debuglevel ( const char *  value)
static

Definition at line 2025 of file config.c.

References debug_level, HADEBUGVAL, setenv(), and TRUE.

◆ set_env()

static int set_env ( const char *  nvpair)
static

Definition at line 2276 of file config.c.

References NULL, and setenv().

◆ set_facility()

static int set_facility ( const char *  value)
static

Definition at line 1694 of file config.c.

References config, EOS, sys_config::facilityname, ha_log, and sys_config::log_facility.

◆ set_generation_method()

static int set_generation_method ( const char *  value)
static

Definition at line 1992 of file config.c.

References FALSE, ha_log, timebasedgenno, and TRUE.

◆ set_hopfudge()

static int set_hopfudge ( const char *  value)
static

Definition at line 1527 of file config.c.

References config, and sys_config::hopfudge.

◆ set_initial_deadtime_ms()

static int set_initial_deadtime_ms ( const char *  value)
static

Definition at line 1574 of file config.c.

References config, and sys_config::initial_deadtime_ms.

◆ set_keepalive_ms()

static int set_keepalive_ms ( const char *  value)
static

Definition at line 1539 of file config.c.

References config, and sys_config::heartbeat_ms.

◆ set_logdaemon()

static int set_logdaemon ( const char *  value)
static

Definition at line 2070 of file config.c.

◆ set_logdconntime()

static int set_logdconntime ( const char *  value)
static

Definition at line 2091 of file config.c.

◆ set_logfile()

static int set_logfile ( const char *  value)
static

Definition at line 1724 of file config.c.

References config, DEVNULL, sys_config::logfile, and sys_config::use_logfile.

◆ set_max_rexmit_delay()

static int set_max_rexmit_delay ( const char *  value)
static

Definition at line 2332 of file config.c.

References hb_set_max_rexmit_delay().

◆ set_memreserve()

static int set_memreserve ( const char *  value)
static

Definition at line 2831 of file config.c.

References config, and sys_config::memreserve.

◆ set_msgfmt()

static int set_msgfmt ( const char *  value)
static

Definition at line 2053 of file config.c.

References FALSE, netstring_format, and TRUE.

◆ set_nice_failback()

static int set_nice_failback ( const char *  value)
static

Definition at line 1734 of file config.c.

References KEY_AUTOFAIL, KEY_FAILBACK, nice_failback, and set_auto_failback().

◆ set_node_site()

int set_node_site ( const char *  value,
const char *  site 
)

◆ set_node_weight()

int set_node_weight ( const char *  value,
int  weight 
)

◆ set_pcmk_support()

◆ set_pengine_by_crm()

static int set_pengine_by_crm ( const char *  value)
static

Definition at line 2579 of file config.c.

References fail_if_after_pacemaker(), and ha_config_check_boolean().

◆ set_quorum_server()

static int set_quorum_server ( const char *  value)
static

Definition at line 1509 of file config.c.

References sys_config::cluster, config, and sys_config::quorum_server.

◆ set_realtime()

static int set_realtime ( const char *  value)
static

Definition at line 2006 of file config.c.

References enable_realtime, and ha_log.

◆ set_realtime_prio()

static int set_realtime_prio ( const char *  value)
static

Definition at line 1973 of file config.c.

References ha_log, and hb_realtime_prio.

◆ set_register_to_apphbd()

static int set_register_to_apphbd ( const char *  value)
static

Definition at line 1787 of file config.c.

References UseApphbd.

◆ set_release2mode()

static int set_release2mode ( const char *  value)
static

Definition at line 2682 of file config.c.

References add_option(), and KEY_PACEMAKER.

◆ set_stonith_host_info()

static int set_stonith_host_info ( const char *  value)
static

◆ set_stonith_info()

static int set_stonith_info ( const char *  value)
static

Definition at line 1816 of file config.c.

References config, EOS, ha_log, NULL, sys_config::stonith, and WHITESPACE.

◆ set_syslog_logfilefmt()

static int set_syslog_logfilefmt ( const char *  value)
static

Definition at line 2539 of file config.c.

◆ set_traditional_compression()

static int set_traditional_compression ( const char *  value)
static

Definition at line 2255 of file config.c.

References NULL, and result.

◆ set_udpport()

static int set_udpport ( const char *  value)
static

Definition at line 1666 of file config.c.

References cmdname, ha_log, HA_SERVICENAME, and NULL.

◆ set_uuidfrom()

static int set_uuidfrom ( const char *  value)
static

Definition at line 2816 of file config.c.

References config, FALSE, KEY_UUIDFROM, TRUE, and sys_config::uuidfromname.

◆ set_warntime_ms()

static int set_warntime_ms ( const char *  value)
static

Definition at line 1796 of file config.c.

References config, and sys_config::warntime_ms.

◆ set_watchdogdev()

static int set_watchdogdev ( const char *  value)
static

Definition at line 1585 of file config.c.

References cmdname, NULL, and watchdogdev.

◆ StringToBaud()

int StringToBaud ( const char *  baudstr)

Definition at line 1602 of file config.c.

Referenced by set_baudrate().

Variable Documentation

◆ any_media_statements_yet

gboolean any_media_statements_yet = FALSE
static

Definition at line 230 of file config.c.

Referenced by parse_config(), and set_baudrate().

◆ APIAuthorization

GHashTable* APIAuthorization = NULL

Definition at line 214 of file config.c.

Referenced by parse_config(), and set_api_authorization().

◆ auto_failback

int auto_failback

◆ cmdname

◆ CommFunctions

GHashTable* CommFunctions

Definition at line 62 of file module.c.

Referenced by add_option(), and parse_config().

◆ CompressFuncs

GHashTable* CompressFuncs

◆ config

◆ config_init_value

struct sys_config config_init_value

Definition at line 286 of file heartbeat.c.

Referenced by init_config().

◆ curnode

struct node_info* curnode

Definition at line 288 of file heartbeat.c.

Referenced by init_config(), and remove_node().

◆ curproc

volatile struct process_info* curproc

◆ debug_level

◆ del_node_list

GSList* del_node_list

◆ Directives

◆ DoManageResources

int DoManageResources

◆ enable_realtime

int enable_realtime = TRUE

Definition at line 217 of file config.c.

Referenced by set_realtime().

◆ hb_realtime_prio

int hb_realtime_prio

◆ hbmedia_types

struct hb_media_fns** hbmedia_types

Definition at line 232 of file config.c.

Referenced by main().

◆ netstring_format

int netstring_format = FALSE

Definition at line 219 of file config.c.

Referenced by set_msgfmt().

◆ nice_failback

int nice_failback

◆ num_hb_media_types

int num_hb_media_types

Definition at line 229 of file config.c.

Referenced by main().

◆ nummedia

int nummedia

Definition at line 285 of file heartbeat.c.

Referenced by add_option(), dump_config(), init_config(), init_node_link_info(), and parse_config().

◆ parse_only

int parse_only

Definition at line 297 of file heartbeat.c.

Referenced by init_config().

◆ PluginLoadingSystem

PILPluginUniv* PluginLoadingSystem

Definition at line 60 of file module.c.

Referenced by add_option(), islegaldirective(), and parse_config().

◆ procinfo

◆ sysmedia

struct hb_media* sysmedia[MAXMEDIA]

Definition at line 281 of file heartbeat.c.

Referenced by add_option(), dump_config(), init_node_link_info(), and parse_config().

◆ timebasedgenno

int timebasedgenno

Definition at line 296 of file heartbeat.c.

Referenced by initialize_heartbeat(), and set_generation_method().

◆ UseApphbd

◆ watchdogdev

char* watchdogdev

Definition at line 307 of file heartbeat.c.

Referenced by hb_close_watchdog(), hb_tickle_watchdog(), and set_watchdogdev().

◆ WLdirectives

set_stonith_host_info
static int set_stonith_host_info(const char *)
Definition: config.c:1882
set_stonith_info
static int set_stonith_info(const char *)
Definition: config.c:1816
set_api_authorization
static int set_api_authorization(const char *)
Definition: config.c:2390
KEY_CLIENT_CHILD
#define KEY_CLIENT_CHILD
Definition: hb_api.h:419
KEY_APIPERM
#define KEY_APIPERM
Definition: hb_api.h:429
add_failfast_child
static int add_failfast_child(const char *)
Definition: config.c:2224
KEY_STONITH
#define KEY_STONITH
Definition: hb_api.h:417
add_client_child
static int add_client_child(const char *)
Definition: config.c:2219
KEY_FAILFAST
#define KEY_FAILFAST
Definition: hb_api.h:420
KEY_STONITHHOST
#define KEY_STONITHHOST
Definition: hb_api.h:418