pacemaker  2.0.3-4b1f869f0f
Scalable High-Availability cluster resource manager
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 /* The order is (partially) significant here; the values from action_fail_ignore
33  * through action_fail_fence are in order of increasing severity.
34  *
35  * @COMPAT The values should be ordered and numbered per the "TODO" comments
36  * below, so all values are in order of severity and there is room for
37  * future additions, but that would break API compatibility.
38  * @TODO For now, we just use a function to compare the values specially, but
39  * at the next compatibility break, we should arrange things properly.
40  */
42  action_fail_ignore, // @TODO = 10
43  // @TODO action_fail_demote = 20,
44  action_fail_recover, // @TODO = 30
45  // @TODO action_fail_reset_remote = 40,
46  // @TODO action_fail_restart_container = 50,
47  action_fail_migrate, // @TODO = 60
48  action_fail_block, // @TODO = 70
49  action_fail_stop, // @TODO = 80
50  action_fail_standby, // @TODO = 90
51  action_fail_fence, // @TODO = 100
52 
53  // @COMPAT Values below here are out of order for API compatibility
54 
56 
57  /* This is reserved for internal use for remote node connection resources.
58  * Fence the remote node if stonith is enabled, otherwise attempt to recover
59  * the connection resource. This allows us to specify types of connection
60  * resource failures that should result in fencing the remote node
61  * (for example, recurring monitor failures).
62  */
64 
66 };
67 
68 /* the "done" action must be the "pre" action +1 */
84 };
85 
90 };
91 
93  rsc_req_nothing, /* Allowed by custom_action() */
94  rsc_req_quorum, /* Enforced by custom_action() */
95  rsc_req_stonith /* Enforced by native_start_constraints() */
96 };
97 
98 enum rsc_role_e {
104 };
105 
106 # define RSC_ROLE_MAX RSC_ROLE_MASTER+1
107 
108 # define RSC_ROLE_UNKNOWN_S "Unknown"
109 # define RSC_ROLE_STOPPED_S "Stopped"
110 # define RSC_ROLE_STARTED_S "Started"
111 # define RSC_ROLE_SLAVE_S "Slave"
112 # define RSC_ROLE_MASTER_S "Master"
113 
115  pe_print_log = 0x0001,
116  pe_print_html = 0x0002,
118  pe_print_printf = 0x0008,
119  pe_print_dev = 0x0010,
123  pe_print_ops = 0x0100,
125  pe_print_xml = 0x0400,
126  pe_print_brief = 0x0800,
129  pe_print_clone_active = 0x4000, // Print clone instances only if active
130  pe_print_implicit = 0x8000, // Print implicitly created resources
131 };
132 
133 const char *task2text(enum action_tasks task);
134 enum action_tasks text2task(const char *task);
135 enum rsc_role_e text2role(const char *role);
136 const char *role2text(enum rsc_role_e role);
137 const char *fail2text(enum action_fail_response fail);
138 
139 const char *pe_pref(GHashTable * options, const char *name);
140 void calculate_active_ops(GList * sorted_op_list, int *start_index, int *stop_index);
141 
142 static inline const char *
143 recovery2text(enum rsc_recovery_type type)
144 {
145  switch (type) {
146  case recovery_stop_only:
147  return "shutting it down";
148  case recovery_stop_start:
149  return "attempting recovery";
150  case recovery_block:
151  return "waiting for an administrator";
152  }
153  return "Unknown";
154 }
155 
156 #ifdef __cplusplus
157 }
158 #endif
159 
160 #endif
action_fail_response
action_fail_response
Definition: common.h:41
pe_print_log
@ pe_print_log
Definition: common.h:115
pe_print_suppres_nl
@ pe_print_suppres_nl
Definition: common.h:124
action_fail_standby
@ action_fail_standby
Definition: common.h:50
pe_print_xml
@ pe_print_xml
Definition: common.h:125
pe_print_dev
@ pe_print_dev
Definition: common.h:119
RSC_ROLE_STOPPED
@ RSC_ROLE_STOPPED
Definition: common.h:100
action_demote
@ action_demote
Definition: common.h:80
action_fail_stop
@ action_fail_stop
Definition: common.h:49
pe_print_max_details
@ pe_print_max_details
Definition: common.h:121
RSC_ROLE_MASTER
@ RSC_ROLE_MASTER
Definition: common.h:103
started_rsc
@ started_rsc
Definition: common.h:75
rsc_req_quorum
@ rsc_req_quorum
Definition: common.h:94
action_fail_demote
@ action_fail_demote
Definition: common.h:65
pe_print_clone_active
@ pe_print_clone_active
Definition: common.h:129
rsc_role_e
rsc_role_e
Definition: common.h:98
stop_rsc
@ stop_rsc
Definition: common.h:72
was_processing_warning
gboolean was_processing_warning
Definition: common.c:19
pe_print_brief
@ pe_print_brief
Definition: common.h:126
pe_pref
const char * pe_pref(GHashTable *options, const char *name)
Definition: common.c:187
stopped_rsc
@ stopped_rsc
Definition: common.h:73
action_fail_recover
@ action_fail_recover
Definition: common.h:44
type
enum crm_ais_msg_types type
Definition: internal.h:5
pe_print_ncurses
@ pe_print_ncurses
Definition: common.h:117
text2task
enum action_tasks text2task(const char *task)
Definition: common.c:233
action_notify
@ action_notify
Definition: common.h:76
rsc_start_requirement
rsc_start_requirement
Definition: common.h:92
rsc_recovery_type
rsc_recovery_type
Definition: common.h:86
pe_print_clone_details
@ pe_print_clone_details
Definition: common.h:128
pe_print_ops
@ pe_print_ops
Definition: common.h:123
pe_print_details
@ pe_print_details
Definition: common.h:120
action_fail_block
@ action_fail_block
Definition: common.h:48
RSC_ROLE_SLAVE
@ RSC_ROLE_SLAVE
Definition: common.h:102
action_notified
@ action_notified
Definition: common.h:77
action_fail_fence
@ action_fail_fence
Definition: common.h:51
pe_print_html
@ pe_print_html
Definition: common.h:116
pe_print_options
pe_print_options
Definition: common.h:114
pe_print_rsconly
@ pe_print_rsconly
Definition: common.h:122
action_fail_migrate
@ action_fail_migrate
Definition: common.h:47
action_fail_reset_remote
@ action_fail_reset_remote
Definition: common.h:63
role2text
const char * role2text(enum rsc_role_e role)
Definition: common.c:338
RSC_ROLE_UNKNOWN
@ RSC_ROLE_UNKNOWN
Definition: common.h:99
action_demoted
@ action_demoted
Definition: common.h:81
rsc_req_stonith
@ rsc_req_stonith
Definition: common.h:95
shutdown_crm
@ shutdown_crm
Definition: common.h:82
action_fail_restart_container
@ action_fail_restart_container
Definition: common.h:55
action_promoted
@ action_promoted
Definition: common.h:79
text2role
enum rsc_role_e text2role(const char *role)
Definition: common.c:359
rsc_req_nothing
@ rsc_req_nothing
Definition: common.h:93
recovery_stop_only
@ recovery_stop_only
Definition: common.h:88
action_promote
@ action_promote
Definition: common.h:78
pe_print_printf
@ pe_print_printf
Definition: common.h:118
recovery_stop_start
@ recovery_stop_start
Definition: common.h:87
start_rsc
@ start_rsc
Definition: common.h:74
pe_print_implicit
@ pe_print_implicit
Definition: common.h:130
action_fail_ignore
@ action_fail_ignore
Definition: common.h:42
calculate_active_ops
void calculate_active_ops(GList *sorted_op_list, int *start_index, int *stop_index)
Definition: unpack.c:2170
pe_print_pending
@ pe_print_pending
Definition: common.h:127
was_processing_error
gboolean was_processing_error
Definition: common.c:18
RSC_ROLE_STARTED
@ RSC_ROLE_STARTED
Definition: common.h:101
stonith_node
@ stonith_node
Definition: common.h:83
action_tasks
action_tasks
Definition: common.h:69
recovery_block
@ recovery_block
Definition: common.h:89
monitor_rsc
@ monitor_rsc
Definition: common.h:71
fail2text
const char * fail2text(enum action_fail_response fail)
Definition: common.c:193
no_action
@ no_action
Definition: common.h:70
task2text
const char * task2text(enum action_tasks task)
Definition: common.c:285