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 /* order is significant here
23  * items listed in order of accending severeness
24  * more severe actions take precedent over lower ones
25  */
29  action_fail_migrate, /* recover by moving it somewhere else */
35 
36  /* This is reserved for internal use for remote node connection resources.
37  * Fence the remote node if stonith is enabled, otherwise attempt to recover
38  * the connection resource. This allows us to specify types of connection
39  * resource failures that should result in fencing the remote node
40  * (for example, recurring monitor failures).
41  */
43 
44 };
45 
46 /* the "done" action must be the "pre" action +1 */
62 };
63 
68 };
69 
71  rsc_req_nothing, /* Allowed by custom_action() */
72  rsc_req_quorum, /* Enforced by custom_action() */
73  rsc_req_stonith /* Enforced by native_start_constraints() */
74 };
75 
76 enum rsc_role_e {
82 };
83 
84 # define RSC_ROLE_MAX RSC_ROLE_MASTER+1
85 
86 # define RSC_ROLE_UNKNOWN_S "Unknown"
87 # define RSC_ROLE_STOPPED_S "Stopped"
88 # define RSC_ROLE_STARTED_S "Started"
89 # define RSC_ROLE_SLAVE_S "Slave"
90 # define RSC_ROLE_MASTER_S "Master"
91 
93  pe_print_log = 0x0001,
94  pe_print_html = 0x0002,
95  pe_print_ncurses = 0x0004,
96  pe_print_printf = 0x0008,
97  pe_print_dev = 0x0010, // Debugging (@COMPAT probably not useful)
98  pe_print_details = 0x0020,
101  pe_print_ops = 0x0100,
103  pe_print_xml = 0x0400,
104  pe_print_brief = 0x0800,
107  pe_print_clone_active = 0x4000, // Print clone instances only if active
108  pe_print_implicit = 0x8000, // Print implicitly created resources
109 };
110 
111 const char *task2text(enum action_tasks task);
112 enum action_tasks text2task(const char *task);
113 enum rsc_role_e text2role(const char *role);
114 const char *role2text(enum rsc_role_e role);
115 const char *fail2text(enum action_fail_response fail);
116 
117 const char *pe_pref(GHashTable * options, const char *name);
118 void calculate_active_ops(GList * sorted_op_list, int *start_index, int *stop_index);
119 
120 static inline const char *
121 recovery2text(enum rsc_recovery_type type)
122 {
123  switch (type) {
124  case recovery_stop_only:
125  return "shutting it down";
126  case recovery_stop_start:
127  return "attempting recovery";
128  case recovery_block:
129  return "waiting for an administrator";
130  }
131  return "Unknown";
132 }
133 
134 #ifdef __cplusplus
135 }
136 #endif
137 
138 #endif
action_fail_response
action_fail_response
Definition: common.h:26
pe_print_log
@ pe_print_log
Definition: common.h:93
pe_print_suppres_nl
@ pe_print_suppres_nl
Definition: common.h:102
action_fail_standby
@ action_fail_standby
Definition: common.h:32
pe_print_xml
@ pe_print_xml
Definition: common.h:103
pe_print_dev
@ pe_print_dev
Definition: common.h:97
RSC_ROLE_STOPPED
@ RSC_ROLE_STOPPED
Definition: common.h:78
action_demote
@ action_demote
Definition: common.h:58
action_fail_stop
@ action_fail_stop
Definition: common.h:31
pe_print_max_details
@ pe_print_max_details
Definition: common.h:99
RSC_ROLE_MASTER
@ RSC_ROLE_MASTER
Definition: common.h:81
started_rsc
@ started_rsc
Definition: common.h:53
rsc_req_quorum
@ rsc_req_quorum
Definition: common.h:72
pe_print_clone_active
@ pe_print_clone_active
Definition: common.h:107
rsc_role_e
rsc_role_e
Definition: common.h:76
stop_rsc
@ stop_rsc
Definition: common.h:50
was_processing_warning
gboolean was_processing_warning
Definition: common.c:21
pe_print_brief
@ pe_print_brief
Definition: common.h:104
pe_pref
const char * pe_pref(GHashTable *options, const char *name)
Definition: common.c:315
stopped_rsc
@ stopped_rsc
Definition: common.h:51
action_fail_recover
@ action_fail_recover
Definition: common.h:28
type
enum crm_ais_msg_types type
Definition: internal.h:5
pe_print_ncurses
@ pe_print_ncurses
Definition: common.h:95
text2task
enum action_tasks text2task(const char *task)
Definition: common.c:358
action_notify
@ action_notify
Definition: common.h:54
rsc_start_requirement
rsc_start_requirement
Definition: common.h:70
rsc_recovery_type
rsc_recovery_type
Definition: common.h:64
pe_print_clone_details
@ pe_print_clone_details
Definition: common.h:106
pe_print_ops
@ pe_print_ops
Definition: common.h:101
pe_print_details
@ pe_print_details
Definition: common.h:98
action_fail_block
@ action_fail_block
Definition: common.h:30
RSC_ROLE_SLAVE
@ RSC_ROLE_SLAVE
Definition: common.h:80
action_notified
@ action_notified
Definition: common.h:55
action_fail_fence
@ action_fail_fence
Definition: common.h:33
pe_print_html
@ pe_print_html
Definition: common.h:94
pe_print_options
pe_print_options
Definition: common.h:92
pe_print_rsconly
@ pe_print_rsconly
Definition: common.h:100
action_fail_migrate
@ action_fail_migrate
Definition: common.h:29
action_fail_reset_remote
@ action_fail_reset_remote
Definition: common.h:42
role2text
const char * role2text(enum rsc_role_e role)
Definition: common.c:463
RSC_ROLE_UNKNOWN
@ RSC_ROLE_UNKNOWN
Definition: common.h:77
action_demoted
@ action_demoted
Definition: common.h:59
rsc_req_stonith
@ rsc_req_stonith
Definition: common.h:73
shutdown_crm
@ shutdown_crm
Definition: common.h:60
action_fail_restart_container
@ action_fail_restart_container
Definition: common.h:34
action_promoted
@ action_promoted
Definition: common.h:57
text2role
enum rsc_role_e text2role(const char *role)
Definition: common.c:484
rsc_req_nothing
@ rsc_req_nothing
Definition: common.h:71
recovery_stop_only
@ recovery_stop_only
Definition: common.h:66
action_promote
@ action_promote
Definition: common.h:56
pe_print_printf
@ pe_print_printf
Definition: common.h:96
recovery_stop_start
@ recovery_stop_start
Definition: common.h:65
start_rsc
@ start_rsc
Definition: common.h:52
pe_print_implicit
@ pe_print_implicit
Definition: common.h:108
action_fail_ignore
@ action_fail_ignore
Definition: common.h:27
calculate_active_ops
void calculate_active_ops(GList *sorted_op_list, int *start_index, int *stop_index)
Definition: unpack.c:2140
pe_print_pending
@ pe_print_pending
Definition: common.h:105
was_processing_error
gboolean was_processing_error
Definition: common.c:20
RSC_ROLE_STARTED
@ RSC_ROLE_STARTED
Definition: common.h:79
stonith_node
@ stonith_node
Definition: common.h:61
action_tasks
action_tasks
Definition: common.h:47
recovery_block
@ recovery_block
Definition: common.h:67
name
char * name
Definition: pcmk_fence.c:30
monitor_rsc
@ monitor_rsc
Definition: common.h:49
fail2text
const char * fail2text(enum action_fail_response fail)
Definition: common.c:321
no_action
@ no_action
Definition: common.h:48
task2text
const char * task2text(enum action_tasks task)
Definition: common.c:410