pacemaker  2.1.9-49aab99839
Scalable High-Availability cluster resource manager
common_compat.h
Go to the documentation of this file.
1 /*
2  * Copyright 2004-2024 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 PCMK__CRM_PENGINE_COMMON_COMPAT__H
11 # define PCMK__CRM_PENGINE_COMMON_COMPAT__H
12 
13 #include <crm/common/scheduler.h>
14 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
28 #define RSC_ROLE_MAX (pcmk_role_promoted + 1)
30 
32 #define RSC_ROLE_UNKNOWN_S pcmk_role_text(pcmk_role_unknown)
33 
35 #define RSC_ROLE_STOPPED_S pcmk_role_text(pcmk_role_stopped)
36 
38 #define RSC_ROLE_STARTED_S pcmk_role_text(pcmk_role_started)
39 
41 #define RSC_ROLE_UNPROMOTED_S pcmk_role_text(pcmk_role_unpromoted)
42 
44 #define RSC_ROLE_PROMOTED_S pcmk_role_text(pcmk_role_promoted)
45 
47 #define RSC_ROLE_UNPROMOTED_LEGACY_S "Slave"
48 
50 #define RSC_ROLE_SLAVE_S RSC_ROLE_UNPROMOTED_LEGACY_S
51 
53 #define RSC_ROLE_PROMOTED_LEGACY_S "Master"
54 
56 #define RSC_ROLE_MASTER_S RSC_ROLE_PROMOTED_LEGACY_S
57 
59 const char *role2text(enum rsc_role_e role);
60 
62 enum rsc_role_e text2role(const char *role);
63 
65 const char *task2text(enum action_tasks task);
66 
68 enum action_tasks text2task(const char *task);
69 
71 const char *fail2text(enum action_fail_response fail);
72 
74 static inline const char *
75 recovery2text(enum rsc_recovery_type type)
76 {
77  switch (type) {
79  return "shutting it down";
81  return "attempting recovery";
83  return "waiting for an administrator";
85  return "stopping unexpected instances";
86  }
87  return "Unknown";
88 }
89 
91 const char *pe_pref(GHashTable * options, const char *name);
92 
93 #ifdef __cplusplus
94 }
95 #endif
96 
97 #endif // PCMK__CRM_PENGINE_COMMON_COMPAT__H
enum rsc_role_e text2role(const char *role)
Definition: common.c:32
const char * pe_pref(GHashTable *options, const char *name)
Definition: common.c:50
const char * name
Definition: cib.c:26
const char * task2text(enum action_tasks task)
Definition: common.c:38
action_tasks
Definition: actions.h:83
action_fail_response
Definition: actions.h:130
enum crm_ais_msg_types type
Definition: cpg.c:51
Scheduler API.
const char * fail2text(enum action_fail_response fail)
Definition: common.c:56
const char * role2text(enum rsc_role_e role)
Definition: common.c:26
rsc_role_e
Definition: roles.h:34
enum action_tasks text2task(const char *task)
Definition: common.c:44
rsc_recovery_type
Definition: resources.h:65