pacemaker
2.0.3-4b1f869f0f
Scalable High-Availability cluster resource manager
include
crm
pengine
common.h
Go to the documentation of this file.
1
/*
2
* Copyright 2004-2018 the Pacemaker project contributors
3
*
4
* The version control history for this file may have further details.
5
*
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU Lesser General Public
8
* License as published by the Free Software Foundation; either
9
* version 2 of the License, or (at your option) any later version.
10
*
11
* This software is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* General Public License for more details.
15
*
16
* You should have received a copy of the GNU Lesser General Public
17
* License along with this library; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
*/
20
#ifndef PE_COMMON__H
21
# define PE_COMMON__H
22
23
#ifdef __cplusplus
24
extern
"C"
{
25
#endif
26
27
# include <glib.h>
28
29
extern
gboolean
was_processing_error
;
30
extern
gboolean
was_processing_warning
;
31
32
/* order is significant here
33
* items listed in order of accending severeness
34
* more severe actions take precedent over lower ones
35
*/
36
enum
action_fail_response
{
37
action_fail_ignore
,
38
action_fail_recover
,
39
action_fail_migrate
,
/* recover by moving it somewhere else */
40
action_fail_block
,
41
action_fail_stop
,
42
action_fail_standby
,
43
action_fail_fence
,
44
action_fail_restart_container
,
45
46
/* This is reserved for internal use for remote node connection resources.
47
* Fence the remote node if stonith is enabled, otherwise attempt to recover
48
* the connection resource. This allows us to specify types of connection
49
* resource failures that should result in fencing the remote node
50
* (for example, recurring monitor failures).
51
*/
52
action_fail_reset_remote
,
53
54
};
55
56
/* the "done" action must be the "pre" action +1 */
57
enum
action_tasks
{
58
no_action
,
59
monitor_rsc
,
60
stop_rsc
,
61
stopped_rsc
,
62
start_rsc
,
63
started_rsc
,
64
action_notify
,
65
action_notified
,
66
action_promote
,
67
action_promoted
,
68
action_demote
,
69
action_demoted
,
70
shutdown_crm
,
71
stonith_node
72
};
73
74
enum
rsc_recovery_type
{
75
recovery_stop_start
,
76
recovery_stop_only
,
77
recovery_block
78
};
79
80
enum
rsc_start_requirement
{
81
rsc_req_nothing
,
/* Allowed by custom_action() */
82
rsc_req_quorum
,
/* Enforced by custom_action() */
83
rsc_req_stonith
/* Enforced by native_start_constraints() */
84
};
85
86
enum
rsc_role_e
{
87
RSC_ROLE_UNKNOWN
,
88
RSC_ROLE_STOPPED
,
89
RSC_ROLE_STARTED
,
90
RSC_ROLE_SLAVE
,
91
RSC_ROLE_MASTER
,
92
};
93
94
# define RSC_ROLE_MAX RSC_ROLE_MASTER+1
95
96
# define RSC_ROLE_UNKNOWN_S "Unknown"
97
# define RSC_ROLE_STOPPED_S "Stopped"
98
# define RSC_ROLE_STARTED_S "Started"
99
# define RSC_ROLE_SLAVE_S "Slave"
100
# define RSC_ROLE_MASTER_S "Master"
101
102
enum
pe_print_options
{
103
pe_print_log
= 0x0001,
104
pe_print_html
= 0x0002,
105
pe_print_ncurses
= 0x0004,
106
pe_print_printf
= 0x0008,
107
pe_print_dev
= 0x0010,
108
pe_print_details
= 0x0020,
109
pe_print_max_details
= 0x0040,
110
pe_print_rsconly
= 0x0080,
111
pe_print_ops
= 0x0100,
112
pe_print_suppres_nl
= 0x0200,
113
pe_print_xml
= 0x0400,
114
pe_print_brief
= 0x0800,
115
pe_print_pending
= 0x1000,
116
pe_print_clone_details
= 0x2000,
117
pe_print_clone_active
= 0x4000,
// Print clone instances only if active
118
pe_print_implicit
= 0x8000,
// Print implicitly created resources
119
};
120
121
const
char
*
task2text
(
enum
action_tasks
task);
122
enum
action_tasks
text2task
(
const
char
*task);
123
enum
rsc_role_e
text2role
(
const
char
*role);
124
const
char
*
role2text
(
enum
rsc_role_e
role);
125
const
char
*
fail2text
(
enum
action_fail_response
fail);
126
127
const
char
*
pe_pref
(GHashTable * options,
const
char
*name);
128
void
calculate_active_ops
(GList * sorted_op_list,
int
*start_index,
int
*stop_index);
129
130
static
inline
const
char
*
131
recovery2text(
enum
rsc_recovery_type
type
)
132
{
133
switch
(
type
) {
134
case
recovery_stop_only
:
135
return
"shutting it down"
;
136
case
recovery_stop_start
:
137
return
"attempting recovery"
;
138
case
recovery_block
:
139
return
"waiting for an administrator"
;
140
}
141
return
"Unknown"
;
142
}
143
144
#ifdef __cplusplus
145
}
146
#endif
147
148
#endif
action_fail_response
action_fail_response
Definition:
common.h:36
pe_print_log
Definition:
common.h:103
pe_print_suppres_nl
Definition:
common.h:112
action_fail_standby
Definition:
common.h:42
pe_print_xml
Definition:
common.h:113
pe_print_dev
Definition:
common.h:107
RSC_ROLE_STOPPED
Definition:
common.h:88
action_demote
Definition:
common.h:68
action_fail_stop
Definition:
common.h:41
pe_print_max_details
Definition:
common.h:109
RSC_ROLE_MASTER
Definition:
common.h:91
started_rsc
Definition:
common.h:63
rsc_req_quorum
Definition:
common.h:82
pe_print_clone_active
Definition:
common.h:117
rsc_role_e
rsc_role_e
Definition:
common.h:86
stop_rsc
Definition:
common.h:60
was_processing_warning
gboolean was_processing_warning
Definition:
common.c:19
pe_print_brief
Definition:
common.h:114
pe_pref
const char * pe_pref(GHashTable *options, const char *name)
Definition:
common.c:187
stopped_rsc
Definition:
common.h:61
action_fail_recover
Definition:
common.h:38
type
enum crm_ais_msg_types type
Definition:
internal.h:83
pe_print_ncurses
Definition:
common.h:105
text2task
enum action_tasks text2task(const char *task)
Definition:
common.c:230
action_notify
Definition:
common.h:64
rsc_start_requirement
rsc_start_requirement
Definition:
common.h:80
rsc_recovery_type
rsc_recovery_type
Definition:
common.h:74
pe_print_clone_details
Definition:
common.h:116
pe_print_ops
Definition:
common.h:111
pe_print_details
Definition:
common.h:108
action_fail_block
Definition:
common.h:40
RSC_ROLE_SLAVE
Definition:
common.h:90
action_notified
Definition:
common.h:65
action_fail_fence
Definition:
common.h:43
pe_print_html
Definition:
common.h:104
pe_print_options
pe_print_options
Definition:
common.h:102
pe_print_rsconly
Definition:
common.h:110
action_fail_migrate
Definition:
common.h:39
action_fail_reset_remote
Definition:
common.h:52
role2text
const char * role2text(enum rsc_role_e role)
Definition:
common.c:335
RSC_ROLE_UNKNOWN
Definition:
common.h:87
action_demoted
Definition:
common.h:69
rsc_req_stonith
Definition:
common.h:83
shutdown_crm
Definition:
common.h:70
action_fail_restart_container
Definition:
common.h:44
action_promoted
Definition:
common.h:67
text2role
enum rsc_role_e text2role(const char *role)
Definition:
common.c:356
rsc_req_nothing
Definition:
common.h:81
recovery_stop_only
Definition:
common.h:76
action_promote
Definition:
common.h:66
pe_print_printf
Definition:
common.h:106
recovery_stop_start
Definition:
common.h:75
start_rsc
Definition:
common.h:62
pe_print_implicit
Definition:
common.h:118
action_fail_ignore
Definition:
common.h:37
calculate_active_ops
void calculate_active_ops(GList *sorted_op_list, int *start_index, int *stop_index)
Definition:
unpack.c:2143
pe_print_pending
Definition:
common.h:115
was_processing_error
gboolean was_processing_error
Definition:
common.c:18
RSC_ROLE_STARTED
Definition:
common.h:89
stonith_node
Definition:
common.h:71
action_tasks
action_tasks
Definition:
common.h:57
recovery_block
Definition:
common.h:77
monitor_rsc
Definition:
common.h:59
fail2text
const char * fail2text(enum action_fail_response fail)
Definition:
common.c:193
no_action
Definition:
common.h:58
task2text
const char * task2text(enum action_tasks task)
Definition:
common.c:282
Generated on Sun Dec 22 2019 20:08:01 for pacemaker by
1.8.16