1SAM_INITIALIZE(3) Corosync Cluster Engine Programmer's ManualSAM_INITIALIZE(3)
2
3
4

NAME

6       sam_initialize - Initialize health checking
7
8

SYNOPSIS

10       #include <corosync/sam.h>
11
12
13       cs_error_t  sam_initialize  (int  time_interval,  sam_recovery_policy_t
14       recovery_policy);
15
16

DESCRIPTION

18       The sam_initialize function is used to initialize health checking of  a
19       process.
20
21
22       Application  can  have  only one instance of SAM. This function must be
23       called before any other of SAM functions.  It is  recommended  to  ini‐
24       tialize before the process begins any process initialization.
25
26
27       The  time_interval parameter is a timeout in milliseconds before taking
28       recovery action after having not received a healthcheck.
29
30       If time_interval parameter is zero, there  is  no  time  limit  and  no
31       healthcheck  must  be sent by the process.  In this operational mode, a
32       process failure will continue to execute the recovery policy.
33
34
35       The recovery_policy is defined as type:
36
37         typedef enum {
38            SAM_RECOVERY_POLICY_QUIT = 1,
39            SAM_RECOVERY_POLICY_RESTART = 2,
40               SAM_RECOVERY_POLICY_QUORUM = 0x08,
41               SAM_RECOVERY_POLICY_QUORUM_QUIT = SAM_RECOVERY_POLICY_QUORUM | SAM_RECOVERY_POLICY_QUIT,
42               SAM_RECOVERY_POLICY_QUORUM_RESTART = SAM_RECOVERY_POLICY_QUORUM | SAM_RECOVERY_POLICY_RESTART,
43               SAM_RECOVERY_POLICY_CMAP = 0x10,
44               SAM_RECOVERY_POLICY_CONFDB = 0x10,
45         } sam_recovery_policy_t;
46
47
48       where
49
50
51       SAM_RECOVERY_POLICY_QUIT
52              on failure, the process will terminate.
53
54       SAM_RECOVERY_POLICY_RESTART
55              on failure, the process will restart.
56
57       SAM_RECOVERY_POLICY_QUORUM
58              is not policy. Used only as flag meaning quorum integration
59
60       SAM_RECOVERY_POLICY_QUORUM_QUIT
61              same as SAM_RECOVERY_POLICY_QUIT but sam_start  (3)  will  block
62              until corosync becomes quorate and process will be terminated if
63              quorum is lost.
64
65       SAM_RECOVERY_POLICY_QUORUM_RESTART
66              same as SAM_RECOVERY_POLICY_RESTART but sam_start (3) will block
67              until  corosync becomes quorate and process will be restarted if
68              quorum is lost.
69
70       SAM_RECOVERY_POLICY_CMAP
71              is not policy. Used only as flag meaning  cmap  integration.  It
72              can  be  used with all previous policies.  For backward compati‐
73              bility,  SAM_RECOVERY_POLICY_CONFDB   with   same   meaning   as
74              SAM_RECOVERY_POLICY_CMAP is also provided.
75
76
77       To   perform   event   driven   healthchecking,   sam_register(3)   and
78       sam_start(3) functions must called.  Event driven healthchecking causes
79       the  duplicate  standby  process running the SAM serve rto periodically
80       request healthchecks from the active process.
81
82

RETURN VALUE

84       This call return CS_OK value if  successful,  otherwise  and  error  is
85       returned.
86
87

ERRORS

89       CS_ERR_BAD_HANDLE
90              can happened in case of double initialization.
91
92       CS_ERR_INVALID_PARAM
93              recovery_policy has invalid value.
94
95

SEE ALSO

97       sam_register(3), sam_start(3), sam_hc_callback_register(3)
98
99       CS_ERR_TRY_AGAIN Resource temporarily unavailable
100
101       CS_ERR_INVALID_PARAM Invalid argument
102
103       CS_ERR_ACCESS Permission denied
104
105       CS_ERR_LIBRARY The connection failed
106
107       CS_ERR_INTERRUPT System call interrupted by a signal
108
109       CS_ERR_NOT_SUPPORTED The requested protocol/functionality not supported
110
111       CS_ERR_MESSAGE_ERROR Incorrect auth message received
112
113       CS_ERR_NO_MEMORY Not enough memory to complete the requested task
114
115
116
117corosync Man Page                 21/05/2010                 SAM_INITIALIZE(3)
Impressum