pacemaker  2.0.2-debe490
Scalable High-Availability cluster resource manager
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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  */
39  action_fail_migrate, /* recover by moving it somewhere else */
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  */
53 
54 };
55 
56 /* the "done" action must be the "pre" action +1 */
72 };
73 
78 };
79 
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 {
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 
103  pe_print_log = 0x0001,
104  pe_print_html = 0x0002,
106  pe_print_printf = 0x0008,
107  pe_print_dev = 0x0010,
111  pe_print_ops = 0x0100,
113  pe_print_xml = 0x0400,
114  pe_print_brief = 0x0800,
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
const char * task2text(enum action_tasks task)
Definition: common.c:276
enum action_tasks text2task(const char *task)
Definition: common.c:224
const char * pe_pref(GHashTable *options, const char *name)
Definition: common.c:181
action_fail_response
Definition: common.h:36
const char * role2text(enum rsc_role_e role)
Definition: common.c:329
rsc_recovery_type
Definition: common.h:74
void calculate_active_ops(GList *sorted_op_list, int *start_index, int *stop_index)
Definition: unpack.c:2117
rsc_start_requirement
Definition: common.h:80
pe_print_options
Definition: common.h:102
enum rsc_role_e text2role(const char *role)
Definition: common.c:350
const char * fail2text(enum action_fail_response fail)
Definition: common.c:187
rsc_role_e
Definition: common.h:86
gboolean was_processing_error
Definition: common.c:18
gboolean was_processing_warning
Definition: common.c:19
action_tasks
Definition: common.h:57
enum crm_ais_msg_types type
Definition: internal.h:85