pacemaker  2.0.4-2deceaa3ae
Scalable High-Availability cluster resource manager
common.h
Go to the documentation of this file.
1 /*
2  * Copyright 2004-2019 the Pacemaker project contributors
3  *
4  * The version control history for this file may have further details.
5  *
6  * This source code is licensed under the GNU Lesser General Public License
7  * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
8  */
9 
10 #ifndef PE_COMMON__H
11 # define PE_COMMON__H
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17 # include <glib.h>
18 
19 extern gboolean was_processing_error;
20 extern gboolean was_processing_warning;
21 
22 /* The order is (partially) significant here; the values from action_fail_ignore
23  * through action_fail_fence are in order of increasing severity.
24  *
25  * @COMPAT The values should be ordered and numbered per the "TODO" comments
26  * below, so all values are in order of severity and there is room for
27  * future additions, but that would break API compatibility.
28  * @TODO For now, we just use a function to compare the values specially, but
29  * at the next compatibility break, we should arrange things properly.
30  */
32  action_fail_ignore, // @TODO = 10
33  // @TODO action_fail_demote = 20,
34  action_fail_recover, // @TODO = 30
35  // @TODO action_fail_reset_remote = 40,
36  // @TODO action_fail_restart_container = 50,
37  action_fail_migrate, // @TODO = 60
38  action_fail_block, // @TODO = 70
39  action_fail_stop, // @TODO = 80
40  action_fail_standby, // @TODO = 90
41  action_fail_fence, // @TODO = 100
42 
43  // @COMPAT Values below here are out of order for API compatibility
44 
46 
47  /* This is reserved for internal use for remote node connection resources.
48  * Fence the remote node if stonith is enabled, otherwise attempt to recover
49  * the connection resource. This allows us to specify types of connection
50  * resource failures that should result in fencing the remote node
51  * (for example, recurring monitor failures).
52  */
54 
56 };
57 
58 /* the "done" action must be the "pre" action +1 */
74 };
75 
80 };
81 
83  rsc_req_nothing, /* Allowed by custom_action() */
84  rsc_req_quorum, /* Enforced by custom_action() */
85  rsc_req_stonith /* Enforced by native_start_constraints() */
86 };
87 
88 enum rsc_role_e {
94 };
95 
96 # define RSC_ROLE_MAX RSC_ROLE_MASTER+1
97 
98 # define RSC_ROLE_UNKNOWN_S "Unknown"
99 # define RSC_ROLE_STOPPED_S "Stopped"
100 # define RSC_ROLE_STARTED_S "Started"
101 # define RSC_ROLE_SLAVE_S "Slave"
102 # define RSC_ROLE_MASTER_S "Master"
103 
105  pe_print_log = 0x0001,
106  pe_print_html = 0x0002,
108  pe_print_printf = 0x0008,
109  pe_print_dev = 0x0010, // Debugging (@COMPAT probably not useful)
113  pe_print_ops = 0x0100,
115  pe_print_xml = 0x0400,
116  pe_print_brief = 0x0800,
119  pe_print_clone_active = 0x4000, // Print clone instances only if active
120  pe_print_implicit = 0x8000, // Print implicitly created resources
121 };
122 
123 const char *task2text(enum action_tasks task);
124 enum action_tasks text2task(const char *task);
125 enum rsc_role_e text2role(const char *role);
126 const char *role2text(enum rsc_role_e role);
127 const char *fail2text(enum action_fail_response fail);
128 
129 const char *pe_pref(GHashTable * options, const char *name);
130 void calculate_active_ops(GList * sorted_op_list, int *start_index, int *stop_index);
131 
132 static inline const char *
133 recovery2text(enum rsc_recovery_type type)
134 {
135  switch (type) {
136  case recovery_stop_only:
137  return "shutting it down";
138  case recovery_stop_start:
139  return "attempting recovery";
140  case recovery_block:
141  return "waiting for an administrator";
142  }
143  return "Unknown";
144 }
145 
146 #ifdef __cplusplus
147 }
148 #endif
149 
150 #endif
action_fail_response
action_fail_response
Definition: common.h:31
pe_print_log
@ pe_print_log
Definition: common.h:105
pe_print_suppres_nl
@ pe_print_suppres_nl
Definition: common.h:114
action_fail_standby
@ action_fail_standby
Definition: common.h:40
pe_print_xml
@ pe_print_xml
Definition: common.h:115
pe_print_dev
@ pe_print_dev
Definition: common.h:109
RSC_ROLE_STOPPED
@ RSC_ROLE_STOPPED
Definition: common.h:90
action_demote
@ action_demote
Definition: common.h:70
action_fail_stop
@ action_fail_stop
Definition: common.h:39
pe_print_max_details
@ pe_print_max_details
Definition: common.h:111
RSC_ROLE_MASTER
@ RSC_ROLE_MASTER
Definition: common.h:93
started_rsc
@ started_rsc
Definition: common.h:65
rsc_req_quorum
@ rsc_req_quorum
Definition: common.h:84
action_fail_demote
@ action_fail_demote
Definition: common.h:55
pe_print_clone_active
@ pe_print_clone_active
Definition: common.h:119
rsc_role_e
rsc_role_e
Definition: common.h:88
stop_rsc
@ stop_rsc
Definition: common.h:62
was_processing_warning
gboolean was_processing_warning
Definition: common.c:21
pe_print_brief
@ pe_print_brief
Definition: common.h:116
pe_pref
const char * pe_pref(GHashTable *options, const char *name)
Definition: common.c:315
stopped_rsc
@ stopped_rsc
Definition: common.h:63
action_fail_recover
@ action_fail_recover
Definition: common.h:34
type
enum crm_ais_msg_types type
Definition: internal.h:3
pe_print_ncurses
@ pe_print_ncurses
Definition: common.h:107
text2task
enum action_tasks text2task(const char *task)
Definition: common.c:361
action_notify
@ action_notify
Definition: common.h:66
rsc_start_requirement
rsc_start_requirement
Definition: common.h:82
rsc_recovery_type
rsc_recovery_type
Definition: common.h:76
pe_print_clone_details
@ pe_print_clone_details
Definition: common.h:118
pe_print_ops
@ pe_print_ops
Definition: common.h:113
pe_print_details
@ pe_print_details
Definition: common.h:110
action_fail_block
@ action_fail_block
Definition: common.h:38
RSC_ROLE_SLAVE
@ RSC_ROLE_SLAVE
Definition: common.h:92
action_notified
@ action_notified
Definition: common.h:67
action_fail_fence
@ action_fail_fence
Definition: common.h:41
pe_print_html
@ pe_print_html
Definition: common.h:106
pe_print_options
pe_print_options
Definition: common.h:104
pe_print_rsconly
@ pe_print_rsconly
Definition: common.h:112
action_fail_migrate
@ action_fail_migrate
Definition: common.h:37
action_fail_reset_remote
@ action_fail_reset_remote
Definition: common.h:53
role2text
const char * role2text(enum rsc_role_e role)
Definition: common.c:466
RSC_ROLE_UNKNOWN
@ RSC_ROLE_UNKNOWN
Definition: common.h:89
action_demoted
@ action_demoted
Definition: common.h:71
rsc_req_stonith
@ rsc_req_stonith
Definition: common.h:85
shutdown_crm
@ shutdown_crm
Definition: common.h:72
action_fail_restart_container
@ action_fail_restart_container
Definition: common.h:45
action_promoted
@ action_promoted
Definition: common.h:69
text2role
enum rsc_role_e text2role(const char *role)
Definition: common.c:487
rsc_req_nothing
@ rsc_req_nothing
Definition: common.h:83
recovery_stop_only
@ recovery_stop_only
Definition: common.h:78
action_promote
@ action_promote
Definition: common.h:68
pe_print_printf
@ pe_print_printf
Definition: common.h:108
recovery_stop_start
@ recovery_stop_start
Definition: common.h:77
start_rsc
@ start_rsc
Definition: common.h:64
pe_print_implicit
@ pe_print_implicit
Definition: common.h:120
action_fail_ignore
@ action_fail_ignore
Definition: common.h:32
calculate_active_ops
void calculate_active_ops(GList *sorted_op_list, int *start_index, int *stop_index)
Definition: unpack.c:2167
pe_print_pending
@ pe_print_pending
Definition: common.h:117
was_processing_error
gboolean was_processing_error
Definition: common.c:20
RSC_ROLE_STARTED
@ RSC_ROLE_STARTED
Definition: common.h:91
stonith_node
@ stonith_node
Definition: common.h:73
action_tasks
action_tasks
Definition: common.h:59
recovery_block
@ recovery_block
Definition: common.h:79
name
char * name
Definition: pcmk_fence.c:30
monitor_rsc
@ monitor_rsc
Definition: common.h:61
fail2text
const char * fail2text(enum action_fail_response fail)
Definition: common.c:321
no_action
@ no_action
Definition: common.h:60
task2text
const char * task2text(enum action_tasks task)
Definition: common.c:413