pacemaker  2.0.1-57cc9c14bf
Scalable High-Availability cluster resource manager
common.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2004 Andrew Beekhof <andrew@beekhof.net>
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This software is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 #ifndef PE_COMMON__H
19 # define PE_COMMON__H
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 # include <glib.h>
26 
27 extern gboolean was_processing_error;
28 extern gboolean was_processing_warning;
29 
30 /* order is significant here
31  * items listed in order of accending severeness
32  * more severe actions take precedent over lower ones
33  */
37  action_fail_migrate, /* recover by moving it somewhere else */
43  /* This is reserved for internal use for baremetal remote node connection
44  * resources. This fail action means
45  * 1. If stonith is enabled, fence the baremetal remote node
46  * 2. stonith not enabled, attempt to recover the connection resources
47  *
48  * This response value gives us control of saying types of
49  * connection resource failures result in fencing the remote node.
50  * Example: recurring monitors failure should result in fencing.
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:34
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:2103
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:83