pacemaker  2.1.7-0f7f88312f
Scalable High-Availability cluster resource manager
common.h
Go to the documentation of this file.
1 /*
2  * Copyright 2004-2023 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__H
11 # define PCMK__CRM_PENGINE_COMMON__H
12 
13 # include <glib.h>
14 # include <regex.h>
15 # include <crm/common/iso8601.h>
16 # include <crm/common/scheduler.h>
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 extern gboolean was_processing_error;
23 extern gboolean was_processing_warning;
24 
25 const char *task2text(enum action_tasks task);
26 enum action_tasks text2task(const char *task);
27 enum rsc_role_e text2role(const char *role);
28 const char *role2text(enum rsc_role_e role);
29 const char *fail2text(enum action_fail_response fail);
30 
31 const char *pe_pref(GHashTable * options, const char *name);
32 
40 static inline const char *
41 recovery2text(enum rsc_recovery_type type)
42 {
43  switch (type) {
45  return "shutting it down";
47  return "attempting recovery";
49  return "waiting for an administrator";
51  return "stopping unexpected instances";
52  }
53  return "Unknown";
54 }
55 
56 typedef struct pe_re_match_data {
57  char *string;
58  int nregs;
59  regmatch_t *pmatch;
61 
62 typedef struct pe_match_data {
64  GHashTable *params;
65  GHashTable *meta;
67 
68 typedef struct pe_rsc_eval_data {
69  const char *standard;
70  const char *provider;
71  const char *agent;
73 
74 typedef struct pe_op_eval_data {
75  const char *op_name;
76  guint interval;
78 
79 typedef struct pe_rule_eval_data {
80  GHashTable *node_hash; // Only used with g_hash_table_lookup()
82  crm_time_t *now; // @COMPAT could be const
83  pe_match_data_t *match_data; // @COMPAT could be const
84  pe_rsc_eval_data_t *rsc_data; // @COMPAT could be const
85  pe_op_eval_data_t *op_data; // @COMPAT could be const
87 
88 #if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1)
90 #endif
91 
92 #ifdef __cplusplus
93 }
94 #endif
95 
96 #endif
const char * task2text(enum action_tasks task)
Definition: common.c:405
const char * provider
Definition: common.h:70
const char * name
Definition: cib.c:26
struct crm_time_s crm_time_t
Definition: iso8601.h:32
Do nothing to resource.
Definition: resources.h:79
struct pe_rule_eval_data pe_rule_eval_data_t
pe_re_match_data_t * re
Definition: common.h:63
Deprecated Pacemaker scheduler utilities.
action_tasks
Possible actions (including some pseudo-actions)
Definition: actions.h:79
enum action_tasks text2task(const char *task)
Definition: common.c:360
action_fail_response
Possible responses to a resource action failure.
Definition: actions.h:149
const char * pe_pref(GHashTable *options, const char *name)
Definition: common.c:314
enum crm_ais_msg_types type
Definition: cpg.c:48
struct pe_re_match_data pe_re_match_data_t
Scheduler API.
const char * role2text(enum rsc_role_e role)
Definition: common.c:458
Stop on all and leave stopped.
Definition: resources.h:78
guint interval
Definition: common.h:76
pe_match_data_t * match_data
Definition: common.h:83
pe_op_eval_data_t * op_data
Definition: common.h:85
struct pe_rsc_eval_data pe_rsc_eval_data_t
const char * op_name
Definition: common.h:75
rsc_role_e
Definition: roles.h:27
ISO_8601 Date handling.
struct pe_match_data pe_match_data_t
rsc_recovery_type
How to recover a resource that is incorrectly active on multiple nodes.
Definition: resources.h:76
GHashTable * meta
Definition: common.h:65
enum rsc_role_e text2role(const char *role)
Definition: common.c:487
pe_rsc_eval_data_t * rsc_data
Definition: common.h:84
Stop unexpected instances.
Definition: resources.h:80
const char * agent
Definition: common.h:71
GHashTable * params
Definition: common.h:64
const char * fail2text(enum action_fail_response fail)
Definition: common.c:320
const char * standard
Definition: common.h:69
crm_time_t * now
Definition: common.h:82
GHashTable * node_hash
Definition: common.h:80
regmatch_t * pmatch
Definition: common.h:59
Stop on all, start on desired.
Definition: resources.h:77
struct pe_op_eval_data pe_op_eval_data_t
gboolean was_processing_error
Definition: common.c:21
gboolean was_processing_warning
Definition: common.c:22
enum rsc_role_e role
Definition: common.h:81
char * string
Definition: common.h:57