root/include/crm/pengine/internal.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. pe__rsc_bool_str
  2. pe__current_node
  3. pe_hash_table_lookup
  4. pe_base_name_eq

   1 /*
   2  * Copyright 2004-2020 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_INTERNAL__H
  11 #  define PE_INTERNAL__H
  12 #  include <string.h>
  13 #  include <crm/pengine/status.h>
  14 #  include <crm/pengine/remote_internal.h>
  15 #  include <crm/common/internal.h>
  16 #  include <crm/common/output_internal.h>
  17 
  18 #  define pe_rsc_info(rsc, fmt, args...)  crm_log_tag(LOG_INFO,  rsc ? rsc->id : "<NULL>", fmt, ##args)
  19 #  define pe_rsc_debug(rsc, fmt, args...) crm_log_tag(LOG_DEBUG, rsc ? rsc->id : "<NULL>", fmt, ##args)
  20 #  define pe_rsc_trace(rsc, fmt, args...) crm_log_tag(LOG_TRACE, rsc ? rsc->id : "<NULL>", fmt, ##args)
  21 
  22 #  define pe_err(fmt...) do {           \
  23         was_processing_error = TRUE;    \
  24         pcmk__config_err(fmt);          \
  25     } while (0)
  26 
  27 #  define pe_warn(fmt...) do {          \
  28         was_processing_warning = TRUE;  \
  29         pcmk__config_warn(fmt);         \
  30     } while (0)
  31 
  32 #  define pe_proc_err(fmt...) { was_processing_error = TRUE; crm_err(fmt); }
  33 #  define pe_proc_warn(fmt...) { was_processing_warning = TRUE; crm_warn(fmt); }
  34 
  35 #define pe__set_working_set_flags(working_set, flags_to_set) do {           \
  36         (working_set)->flags = pcmk__set_flags_as(__func__, __LINE__,       \
  37             LOG_TRACE, "Working set", crm_system_name,                      \
  38             (working_set)->flags, (flags_to_set), #flags_to_set);           \
  39     } while (0)
  40 
  41 #define pe__clear_working_set_flags(working_set, flags_to_clear) do {       \
  42         (working_set)->flags = pcmk__clear_flags_as(__func__, __LINE__,     \
  43             LOG_TRACE, "Working set", crm_system_name,                      \
  44             (working_set)->flags, (flags_to_clear), #flags_to_clear);       \
  45     } while (0)
  46 
  47 #define pe__set_resource_flags(resource, flags_to_set) do {                 \
  48         (resource)->flags = pcmk__set_flags_as(__func__, __LINE__,          \
  49             LOG_TRACE, "Resource", (resource)->id, (resource)->flags,       \
  50             (flags_to_set), #flags_to_set);                                 \
  51     } while (0)
  52 
  53 #define pe__clear_resource_flags(resource, flags_to_clear) do {             \
  54         (resource)->flags = pcmk__clear_flags_as(__func__, __LINE__,        \
  55             LOG_TRACE, "Resource", (resource)->id, (resource)->flags,       \
  56             (flags_to_clear), #flags_to_clear);                             \
  57     } while (0)
  58 
  59 #define pe__set_action_flags(action, flags_to_set) do {                     \
  60         (action)->flags = pcmk__set_flags_as(__func__, __LINE__,            \
  61                                              LOG_TRACE,                     \
  62                                              "Action", (action)->uuid,      \
  63                                              (action)->flags,               \
  64                                              (flags_to_set),                \
  65                                              #flags_to_set);                \
  66     } while (0)
  67 
  68 #define pe__clear_action_flags(action, flags_to_clear) do {                 \
  69         (action)->flags = pcmk__clear_flags_as(__func__, __LINE__,          \
  70                                                LOG_TRACE,                   \
  71                                                "Action", (action)->uuid,    \
  72                                                (action)->flags,             \
  73                                                (flags_to_clear),            \
  74                                                #flags_to_clear);            \
  75     } while (0)
  76 
  77 #define pe__set_raw_action_flags(action_flags, action_name, flags_to_set) do { \
  78         action_flags = pcmk__set_flags_as(__func__, __LINE__,               \
  79                                           LOG_TRACE, "Action", action_name, \
  80                                           (action_flags),                   \
  81                                           (flags_to_set), #flags_to_set);   \
  82     } while (0)
  83 
  84 #define pe__clear_raw_action_flags(action_flags, action_name, flags_to_clear) do { \
  85         action_flags = pcmk__clear_flags_as(__func__, __LINE__,             \
  86                                             LOG_TRACE,                      \
  87                                             "Action", action_name,          \
  88                                             (action_flags),                 \
  89                                             (flags_to_clear),               \
  90                                             #flags_to_clear);               \
  91     } while (0)
  92 
  93 #define pe__set_action_flags_as(function, line, action, flags_to_set) do {  \
  94         (action)->flags = pcmk__set_flags_as((function), (line),            \
  95                                              LOG_TRACE,                     \
  96                                              "Action", (action)->uuid,      \
  97                                              (action)->flags,               \
  98                                              (flags_to_set),                \
  99                                              #flags_to_set);                \
 100     } while (0)
 101 
 102 #define pe__clear_action_flags_as(function, line, action, flags_to_clear) do { \
 103         (action)->flags = pcmk__clear_flags_as((function), (line),          \
 104                                                LOG_TRACE,                   \
 105                                                "Action", (action)->uuid,    \
 106                                                (action)->flags,             \
 107                                                (flags_to_clear),            \
 108                                                #flags_to_clear);            \
 109     } while (0)
 110 
 111 #define pe__set_order_flags(order_flags, flags_to_set) do {                 \
 112         order_flags = pcmk__set_flags_as(__func__, __LINE__, LOG_TRACE,     \
 113                                          "Ordering", "constraint",          \
 114                                          order_flags, (flags_to_set),       \
 115                                          #flags_to_set);                    \
 116     } while (0)
 117 
 118 #define pe__clear_order_flags(order_flags, flags_to_clear) do {               \
 119         order_flags = pcmk__clear_flags_as(__func__, __LINE__, LOG_TRACE,     \
 120                                            "Ordering", "constraint",          \
 121                                            order_flags, (flags_to_clear),     \
 122                                            #flags_to_clear);                  \
 123     } while (0)
 124 
 125 #define pe__set_graph_flags(graph_flags, gr_action, flags_to_set) do {      \
 126         graph_flags = pcmk__set_flags_as(__func__, __LINE__,                \
 127                                          LOG_TRACE, "Graph",                \
 128                                          (gr_action)->uuid, graph_flags,    \
 129                                          (flags_to_set), #flags_to_set);    \
 130     } while (0)
 131 
 132 #define pe__clear_graph_flags(graph_flags, gr_action, flags_to_clear) do {     \
 133         graph_flags = pcmk__clear_flags_as(__func__, __LINE__,                 \
 134                                            LOG_TRACE, "Graph",                 \
 135                                            (gr_action)->uuid, graph_flags,     \
 136                                            (flags_to_clear), #flags_to_clear); \
 137     } while (0)
 138 
 139 // Some warnings we don't want to print every transition
 140 
 141 enum pe_warn_once_e {
 142     pe_wo_blind         = 0x0001,
 143     pe_wo_restart_type  = 0x0002,
 144     pe_wo_role_after    = 0x0004,
 145     pe_wo_poweroff      = 0x0008,
 146     pe_wo_require_all   = 0x0010,
 147     pe_wo_order_score   = 0x0020,
 148     pe_wo_neg_threshold = 0x0040,
 149 };
 150 
 151 extern uint32_t pe_wo;
 152 
 153 #define pe_warn_once(pe_wo_bit, fmt...) do {    \
 154         if (!pcmk_is_set(pe_wo, pe_wo_bit)) {  \
 155             if (pe_wo_bit == pe_wo_blind) {     \
 156                 crm_warn(fmt);                  \
 157             } else {                            \
 158                 pe_warn(fmt);                   \
 159             }                                   \
 160             pe_wo = pcmk__set_flags_as(__func__, __LINE__, LOG_TRACE,       \
 161                                       "Warn-once", "logging", pe_wo,        \
 162                                       (pe_wo_bit), #pe_wo_bit);             \
 163         }                                       \
 164     } while (0);
 165 
 166 
 167 typedef struct pe__location_constraint_s {
 168     char *id;                           // Constraint XML ID
 169     pe_resource_t *rsc_lh;              // Resource being located
 170     enum rsc_role_e role_filter;        // Role to locate
 171     enum pe_discover_e discover_mode;   // Resource discovery
 172     GListPtr node_list_rh;              // List of pe_node_t*
 173 } pe__location_t;
 174 
 175 typedef struct pe__order_constraint_s {
 176     int id;
 177     enum pe_ordering type;
 178 
 179     void *lh_opaque;
 180     pe_resource_t *lh_rsc;
 181     pe_action_t *lh_action;
 182     char *lh_action_task;
 183 
 184     void *rh_opaque;
 185     pe_resource_t *rh_rsc;
 186     pe_action_t *rh_action;
 187     char *rh_action_task;
 188 } pe__ordering_t;
 189 
 190 typedef struct notify_data_s {
 191     GSList *keys;               // Environment variable name/value pairs
 192 
 193     const char *action;
 194 
 195     pe_action_t *pre;
 196     pe_action_t *post;
 197     pe_action_t *pre_done;
 198     pe_action_t *post_done;
 199 
 200     GListPtr active;            /* notify_entry_t*  */
 201     GListPtr inactive;          /* notify_entry_t*  */
 202     GListPtr start;             /* notify_entry_t*  */
 203     GListPtr stop;              /* notify_entry_t*  */
 204     GListPtr demote;            /* notify_entry_t*  */
 205     GListPtr promote;           /* notify_entry_t*  */
 206     GListPtr master;            /* notify_entry_t*  */
 207     GListPtr slave;             /* notify_entry_t*  */
 208     GHashTable *allowed_nodes;
 209 
 210 } notify_data_t;
 211 
 212 bool pe_can_fence(pe_working_set_t *data_set, pe_node_t *node);
 213 
 214 int pe__add_scores(int score1, int score2);
 215 void add_hash_param(GHashTable * hash, const char *name, const char *value);
 216 
 217 char *native_parameter(pe_resource_t * rsc, pe_node_t * node, gboolean create, const char *name,
 218                        pe_working_set_t * data_set);
 219 pe_node_t *native_location(const pe_resource_t *rsc, GList **list, int current);
 220 
 221 void pe_metadata(void);
 222 void verify_pe_options(GHashTable * options);
 223 
 224 void common_update_score(pe_resource_t * rsc, const char *id, int score);
 225 void native_add_running(pe_resource_t * rsc, pe_node_t * node, pe_working_set_t * data_set);
 226 
 227 gboolean native_unpack(pe_resource_t * rsc, pe_working_set_t * data_set);
 228 gboolean group_unpack(pe_resource_t * rsc, pe_working_set_t * data_set);
 229 gboolean clone_unpack(pe_resource_t * rsc, pe_working_set_t * data_set);
 230 gboolean pe__unpack_bundle(pe_resource_t *rsc, pe_working_set_t *data_set);
 231 
 232 pe_resource_t *native_find_rsc(pe_resource_t *rsc, const char *id, const pe_node_t *node,
 233                                int flags);
 234 
 235 gboolean native_active(pe_resource_t * rsc, gboolean all);
 236 gboolean group_active(pe_resource_t * rsc, gboolean all);
 237 gboolean clone_active(pe_resource_t * rsc, gboolean all);
 238 gboolean pe__bundle_active(pe_resource_t *rsc, gboolean all);
 239 
 240 void native_print(pe_resource_t * rsc, const char *pre_text, long options, void *print_data);
 241 void group_print(pe_resource_t * rsc, const char *pre_text, long options, void *print_data);
 242 void clone_print(pe_resource_t * rsc, const char *pre_text, long options, void *print_data);
 243 void pe__print_bundle(pe_resource_t *rsc, const char *pre_text, long options,
 244                       void *print_data);
 245 
 246 int pe__name_and_nvpairs_xml(pcmk__output_t *out, bool is_list, const char *tag_name
 247                          , size_t pairs_count, ...);
 248 char *pe__node_display_name(pe_node_t *node, bool print_detail);
 249 
 250 static inline const char *
 251 pe__rsc_bool_str(pe_resource_t *rsc, uint64_t rsc_flag)
     /* [previous][next][first][last][top][bottom][index][help] */
 252 {
 253     return pcmk__btoa(pcmk_is_set(rsc->flags, rsc_flag));
 254 }
 255 
 256 int pe__ban_html(pcmk__output_t *out, va_list args);
 257 int pe__ban_text(pcmk__output_t *out, va_list args);
 258 int pe__ban_xml(pcmk__output_t *out, va_list args);
 259 int pe__clone_xml(pcmk__output_t *out, va_list args);
 260 int pe__clone_html(pcmk__output_t *out, va_list args);
 261 int pe__clone_text(pcmk__output_t *out, va_list args);
 262 int pe__cluster_counts_html(pcmk__output_t *out, va_list args);
 263 int pe__cluster_counts_text(pcmk__output_t *out, va_list args);
 264 int pe__cluster_counts_xml(pcmk__output_t *out, va_list args);
 265 int pe__cluster_dc_html(pcmk__output_t *out, va_list args);
 266 int pe__cluster_dc_text(pcmk__output_t *out, va_list args);
 267 int pe__cluster_dc_xml(pcmk__output_t *out, va_list args);
 268 int pe__cluster_maint_mode_html(pcmk__output_t *out, va_list args);
 269 int pe__cluster_maint_mode_text(pcmk__output_t *out, va_list args);
 270 int pe__cluster_options_html(pcmk__output_t *out, va_list args);
 271 int pe__cluster_options_log(pcmk__output_t *out, va_list args);
 272 int pe__cluster_options_text(pcmk__output_t *out, va_list args);
 273 int pe__cluster_options_xml(pcmk__output_t *out, va_list args);
 274 int pe__cluster_stack_html(pcmk__output_t *out, va_list args);
 275 int pe__cluster_stack_text(pcmk__output_t *out, va_list args);
 276 int pe__cluster_stack_xml(pcmk__output_t *out, va_list args);
 277 int pe__cluster_summary(pcmk__output_t *out, va_list args);
 278 int pe__cluster_summary_html(pcmk__output_t *out, va_list args);
 279 int pe__cluster_times_html(pcmk__output_t *out, va_list args);
 280 int pe__cluster_times_xml(pcmk__output_t *out, va_list args);
 281 int pe__cluster_times_text(pcmk__output_t *out, va_list args);
 282 int pe__failed_action_text(pcmk__output_t *out, va_list args);
 283 int pe__failed_action_xml(pcmk__output_t *out, va_list args);
 284 int pe__group_xml(pcmk__output_t *out, va_list args);
 285 int pe__group_html(pcmk__output_t *out, va_list args);
 286 int pe__group_text(pcmk__output_t *out, va_list args);
 287 int pe__bundle_xml(pcmk__output_t *out, va_list args);
 288 int pe__bundle_html(pcmk__output_t *out, va_list args);
 289 int pe__bundle_text(pcmk__output_t *out, va_list args);
 290 int pe__node_html(pcmk__output_t *out, va_list args);
 291 int pe__node_text(pcmk__output_t *out, va_list args);
 292 int pe__node_xml(pcmk__output_t *out, va_list args);
 293 int pe__node_attribute_html(pcmk__output_t *out, va_list args);
 294 int pe__node_attribute_text(pcmk__output_t *out, va_list args);
 295 int pe__node_attribute_xml(pcmk__output_t *out, va_list args);
 296 int pe__node_list_html(pcmk__output_t *out, va_list args);
 297 int pe__node_list_text(pcmk__output_t *out, va_list args);
 298 int pe__node_list_xml(pcmk__output_t *out, va_list args);
 299 int pe__op_history_text(pcmk__output_t *out, va_list args);
 300 int pe__op_history_xml(pcmk__output_t *out, va_list args);
 301 int pe__resource_history_text(pcmk__output_t *out, va_list args);
 302 int pe__resource_history_xml(pcmk__output_t *out, va_list args);
 303 int pe__resource_xml(pcmk__output_t *out, va_list args);
 304 int pe__resource_html(pcmk__output_t *out, va_list args);
 305 int pe__resource_text(pcmk__output_t *out, va_list args);
 306 int pe__resource_list(pcmk__output_t *out, va_list args);
 307 int pe__ticket_html(pcmk__output_t *out, va_list args);
 308 int pe__ticket_text(pcmk__output_t *out, va_list args);
 309 int pe__ticket_xml(pcmk__output_t *out, va_list args);
 310 
 311 void native_free(pe_resource_t * rsc);
 312 void group_free(pe_resource_t * rsc);
 313 void clone_free(pe_resource_t * rsc);
 314 void pe__free_bundle(pe_resource_t *rsc);
 315 
 316 enum rsc_role_e native_resource_state(const pe_resource_t * rsc, gboolean current);
 317 enum rsc_role_e group_resource_state(const pe_resource_t * rsc, gboolean current);
 318 enum rsc_role_e clone_resource_state(const pe_resource_t * rsc, gboolean current);
 319 enum rsc_role_e pe__bundle_resource_state(const pe_resource_t *rsc,
 320                                           gboolean current);
 321 
 322 void pe__count_common(pe_resource_t *rsc);
 323 void pe__count_bundle(pe_resource_t *rsc);
 324 
 325 gboolean common_unpack(xmlNode * xml_obj, pe_resource_t ** rsc, pe_resource_t * parent,
 326                        pe_working_set_t * data_set);
 327 void common_free(pe_resource_t * rsc);
 328 
 329 pe_node_t *pe__copy_node(const pe_node_t *this_node);
 330 extern time_t get_effective_time(pe_working_set_t * data_set);
 331 
 332 /* Failure handling utilities (from failcounts.c) */
 333 
 334 // bit flags for fail count handling options
 335 enum pe_fc_flags_e {
 336     pe_fc_default   = 0x00,
 337     pe_fc_effective = 0x01, // don't count expired failures
 338     pe_fc_fillers   = 0x02, // if container, include filler failures in count
 339 };
 340 
 341 int pe_get_failcount(pe_node_t *node, pe_resource_t *rsc, time_t *last_failure,
 342                      uint32_t flags, xmlNode *xml_op,
 343                      pe_working_set_t *data_set);
 344 
 345 pe_action_t *pe__clear_failcount(pe_resource_t *rsc, pe_node_t *node,
 346                                  const char *reason,
 347                                  pe_working_set_t *data_set);
 348 
 349 /* Functions for finding/counting a resource's active nodes */
 350 
 351 pe_node_t *pe__find_active_on(const pe_resource_t *rsc,
 352                               unsigned int *count_all,
 353                               unsigned int *count_clean);
 354 pe_node_t *pe__find_active_requires(const pe_resource_t *rsc,
 355                                     unsigned int *count);
 356 
 357 static inline pe_node_t *
 358 pe__current_node(const pe_resource_t *rsc)
     /* [previous][next][first][last][top][bottom][index][help] */
 359 {
 360     return pe__find_active_on(rsc, NULL, NULL);
 361 }
 362 
 363 
 364 /* Binary like operators for lists of nodes */
 365 extern void node_list_exclude(GHashTable * list, GListPtr list2, gboolean merge_scores);
 366 
 367 GHashTable *pe__node_list2table(GList *list);
 368 
 369 static inline gpointer
 370 pe_hash_table_lookup(GHashTable * hash, gconstpointer key)
     /* [previous][next][first][last][top][bottom][index][help] */
 371 {
 372     if (hash) {
 373         return g_hash_table_lookup(hash, key);
 374     }
 375     return NULL;
 376 }
 377 
 378 extern pe_action_t *get_pseudo_op(const char *name, pe_working_set_t * data_set);
 379 extern gboolean order_actions(pe_action_t * lh_action, pe_action_t * rh_action, enum pe_ordering order);
 380 
 381 /* Printing functions for debug */
 382 extern void print_node(const char *pre_text, pe_node_t * node, gboolean details);
 383 extern void print_str_str(gpointer key, gpointer value, gpointer user_data);
 384 extern void pe__output_node(pe_node_t * node, gboolean details, pcmk__output_t *out);
 385 
 386 extern void dump_node_capacity(int level, const char *comment, pe_node_t * node);
 387 extern void dump_rsc_utilization(int level, const char *comment, pe_resource_t * rsc, pe_node_t * node);
 388 
 389 void pe__show_node_weights_as(const char *file, const char *function,
 390                               int line, bool to_log, pe_resource_t *rsc,
 391                               const char *comment, GHashTable *nodes);
 392 
 393 #define pe__show_node_weights(level, rsc, text, nodes)              \
 394         pe__show_node_weights_as(__FILE__, __func__, __LINE__,      \
 395                                  (level), (rsc), (text), (nodes))
 396 
 397 /* Sorting functions */
 398 extern gint sort_rsc_priority(gconstpointer a, gconstpointer b);
 399 extern gint sort_rsc_index(gconstpointer a, gconstpointer b);
 400 
 401 extern xmlNode *find_rsc_op_entry(pe_resource_t * rsc, const char *key);
 402 
 403 extern pe_action_t *custom_action(pe_resource_t * rsc, char *key, const char *task, pe_node_t * on_node,
 404                                   gboolean optional, gboolean foo, pe_working_set_t * data_set);
 405 
 406 #  define delete_key(rsc) pcmk__op_key(rsc->id, CRMD_ACTION_DELETE, 0)
 407 #  define delete_action(rsc, node, optional) custom_action(             \
 408                 rsc, delete_key(rsc), CRMD_ACTION_DELETE, node,         \
 409                 optional, TRUE, data_set);
 410 
 411 #  define stopped_key(rsc) pcmk__op_key(rsc->id, CRMD_ACTION_STOPPED, 0)
 412 #  define stopped_action(rsc, node, optional) custom_action(            \
 413                 rsc, stopped_key(rsc), CRMD_ACTION_STOPPED, node,       \
 414                 optional, TRUE, data_set);
 415 
 416 #  define stop_key(rsc) pcmk__op_key(rsc->id, CRMD_ACTION_STOP, 0)
 417 #  define stop_action(rsc, node, optional) custom_action(                       \
 418                 rsc, stop_key(rsc), CRMD_ACTION_STOP, node,             \
 419                 optional, TRUE, data_set);
 420 
 421 #  define reload_key(rsc) pcmk__op_key(rsc->id, CRMD_ACTION_RELOAD, 0)
 422 #  define start_key(rsc) pcmk__op_key(rsc->id, CRMD_ACTION_START, 0)
 423 #  define start_action(rsc, node, optional) custom_action(              \
 424                 rsc, start_key(rsc), CRMD_ACTION_START, node,           \
 425                 optional, TRUE, data_set)
 426 
 427 #  define started_key(rsc) pcmk__op_key(rsc->id, CRMD_ACTION_STARTED, 0)
 428 #  define started_action(rsc, node, optional) custom_action(            \
 429                 rsc, started_key(rsc), CRMD_ACTION_STARTED, node,       \
 430                 optional, TRUE, data_set)
 431 
 432 #  define promote_key(rsc) pcmk__op_key(rsc->id, CRMD_ACTION_PROMOTE, 0)
 433 #  define promote_action(rsc, node, optional) custom_action(            \
 434                 rsc, promote_key(rsc), CRMD_ACTION_PROMOTE, node,       \
 435                 optional, TRUE, data_set)
 436 
 437 #  define promoted_key(rsc) pcmk__op_key(rsc->id, CRMD_ACTION_PROMOTED, 0)
 438 #  define promoted_action(rsc, node, optional) custom_action(           \
 439                 rsc, promoted_key(rsc), CRMD_ACTION_PROMOTED, node,     \
 440                 optional, TRUE, data_set)
 441 
 442 #  define demote_key(rsc) pcmk__op_key(rsc->id, CRMD_ACTION_DEMOTE, 0)
 443 #  define demote_action(rsc, node, optional) custom_action(             \
 444                 rsc, demote_key(rsc), CRMD_ACTION_DEMOTE, node,         \
 445                 optional, TRUE, data_set)
 446 
 447 #  define demoted_key(rsc) pcmk__op_key(rsc->id, CRMD_ACTION_DEMOTED, 0)
 448 #  define demoted_action(rsc, node, optional) custom_action(            \
 449                 rsc, demoted_key(rsc), CRMD_ACTION_DEMOTED, node,       \
 450                 optional, TRUE, data_set)
 451 
 452 extern int pe_get_configured_timeout(pe_resource_t *rsc, const char *action,
 453                                      pe_working_set_t *data_set);
 454 
 455 extern pe_action_t *find_first_action(GListPtr input, const char *uuid, const char *task,
 456                                       pe_node_t * on_node);
 457 extern enum action_tasks get_complex_task(pe_resource_t * rsc, const char *name,
 458                                           gboolean allow_non_atomic);
 459 
 460 extern GListPtr find_actions(GListPtr input, const char *key, const pe_node_t *on_node);
 461 GList *find_actions_exact(GList *input, const char *key,
 462                           const pe_node_t *on_node);
 463 extern GListPtr find_recurring_actions(GListPtr input, pe_node_t * not_on_node);
 464 GList *pe__resource_actions(const pe_resource_t *rsc, const pe_node_t *node,
 465                             const char *task, bool require_node);
 466 
 467 extern void pe_free_action(pe_action_t * action);
 468 
 469 extern void resource_location(pe_resource_t * rsc, pe_node_t * node, int score, const char *tag,
 470                               pe_working_set_t * data_set);
 471 
 472 extern gint sort_op_by_callid(gconstpointer a, gconstpointer b);
 473 extern gboolean get_target_role(pe_resource_t * rsc, enum rsc_role_e *role);
 474 
 475 extern pe_resource_t *find_clone_instance(pe_resource_t * rsc, const char *sub_id,
 476                                           pe_working_set_t * data_set);
 477 
 478 extern void destroy_ticket(gpointer data);
 479 extern pe_ticket_t *ticket_new(const char *ticket_id, pe_working_set_t * data_set);
 480 
 481 // Resources for manipulating resource names
 482 const char *pe_base_name_end(const char *id);
 483 char *clone_strip(const char *last_rsc_id);
 484 char *clone_zero(const char *last_rsc_id);
 485 
 486 static inline bool
 487 pe_base_name_eq(pe_resource_t *rsc, const char *id)
     /* [previous][next][first][last][top][bottom][index][help] */
 488 {
 489     if (id && rsc && rsc->id) {
 490         // Number of characters in rsc->id before any clone suffix
 491         size_t base_len = pe_base_name_end(rsc->id) - rsc->id + 1;
 492 
 493         return (strlen(id) == base_len) && !strncmp(id, rsc->id, base_len);
 494     }
 495     return FALSE;
 496 }
 497 
 498 int pe__target_rc_from_xml(xmlNode *xml_op);
 499 
 500 gint sort_node_uname(gconstpointer a, gconstpointer b);
 501 bool is_set_recursive(pe_resource_t * rsc, long long flag, bool any);
 502 
 503 enum rsc_digest_cmp_val {
 504     /*! Digests are the same */
 505     RSC_DIGEST_MATCH = 0,
 506     /*! Params that require a restart changed */
 507     RSC_DIGEST_RESTART,
 508     /*! Some parameter changed.  */
 509     RSC_DIGEST_ALL,
 510     /*! rsc op didn't have a digest associated with it, so
 511      *  it is unknown if parameters changed or not. */
 512     RSC_DIGEST_UNKNOWN,
 513 };
 514 
 515 typedef struct op_digest_cache_s {
 516     enum rsc_digest_cmp_val rc;
 517     xmlNode *params_all;
 518     xmlNode *params_secure;
 519     xmlNode *params_restart;
 520     char *digest_all_calc;
 521     char *digest_secure_calc;
 522     char *digest_restart_calc;
 523 } op_digest_cache_t;
 524 
 525 op_digest_cache_t *rsc_action_digest_cmp(pe_resource_t * rsc, xmlNode * xml_op, pe_node_t * node,
 526                                          pe_working_set_t * data_set);
 527 
 528 pe_action_t *pe_fence_op(pe_node_t * node, const char *op, bool optional, const char *reason, bool priority_delay, pe_working_set_t * data_set);
 529 void trigger_unfencing(
 530     pe_resource_t * rsc, pe_node_t *node, const char *reason, pe_action_t *dependency, pe_working_set_t * data_set);
 531 
 532 void pe_action_set_reason(pe_action_t *action, const char *reason, bool overwrite);
 533 void pe_action_set_flag_reason(const char *function, long line, pe_action_t *action, pe_action_t *reason, const char *text, enum pe_action_flags flags, bool overwrite);
 534 
 535 #define pe_action_required(action, reason, text)    \
 536     pe_action_set_flag_reason(__func__, __LINE__, action, reason, text, \
 537                               pe_action_optional, FALSE)
 538 #define pe_action_implies(action, reason, flag)     \
 539     pe_action_set_flag_reason(__func__, __LINE__, action, reason, NULL, \
 540                               flag, FALSE)
 541 
 542 void pe__set_resource_flags_recursive(pe_resource_t *rsc, uint64_t flags);
 543 void pe__clear_resource_flags_recursive(pe_resource_t *rsc, uint64_t flags);
 544 
 545 gboolean add_tag_ref(GHashTable * tags, const char * tag_name,  const char * obj_ref);
 546 
 547 void print_rscs_brief(GListPtr rsc_list, const char * pre_text, long options,
 548                       void * print_data, gboolean print_all);
 549 int pe__rscs_brief_output(pcmk__output_t *out, GListPtr rsc_list, long options, gboolean print_all);
 550 void pe_fence_node(pe_working_set_t * data_set, pe_node_t * node, const char *reason, bool priority_delay);
 551 
 552 pe_node_t *pe_create_node(const char *id, const char *uname, const char *type,
 553                           const char *score, pe_working_set_t * data_set);
 554 void common_print(pe_resource_t * rsc, const char *pre_text, const char *name, pe_node_t *node, long options, void *print_data);
 555 int pe__common_output_text(pcmk__output_t *out, pe_resource_t * rsc, const char *name, pe_node_t *node, long options);
 556 int pe__common_output_html(pcmk__output_t *out, pe_resource_t * rsc, const char *name, pe_node_t *node, long options);
 557 pe_resource_t *pe__find_bundle_replica(const pe_resource_t *bundle,
 558                                        const pe_node_t *node);
 559 bool pe__bundle_needs_remote_name(pe_resource_t *rsc);
 560 const char *pe__add_bundle_remote_name(pe_resource_t *rsc, xmlNode *xml,
 561                                        const char *field);
 562 const char *pe_node_attribute_calculated(const pe_node_t *node,
 563                                          const char *name,
 564                                          const pe_resource_t *rsc);
 565 const char *pe_node_attribute_raw(pe_node_t *node, const char *name);
 566 bool pe__is_universal_clone(pe_resource_t *rsc,
 567                             pe_working_set_t *data_set);
 568 void pe__add_param_check(xmlNode *rsc_op, pe_resource_t *rsc, pe_node_t *node,
 569                          enum pe_check_parameters, pe_working_set_t *data_set);
 570 void pe__foreach_param_check(pe_working_set_t *data_set,
 571                              void (*cb)(pe_resource_t*, pe_node_t*, xmlNode*,
 572                                         enum pe_check_parameters,
 573                                         pe_working_set_t*));
 574 void pe__free_param_checks(pe_working_set_t *data_set);
 575 
 576 bool pe__shutdown_requested(pe_node_t *node);
 577 void pe__update_recheck_time(time_t recheck, pe_working_set_t *data_set);
 578 
 579 /*!
 580  * \internal
 581  * \brief Register xml formatting message functions.
 582  */
 583 void pe__register_messages(pcmk__output_t *out);
 584 
 585 void pe__unpack_dataset_nvpairs(xmlNode *xml_obj, const char *set_name,
 586                                 pe_rule_eval_data_t *rule_data, GHashTable *hash,
 587                                 const char *always_first, gboolean overwrite,
 588                                 pe_working_set_t *data_set);
 589 
 590 bool pe__resource_is_disabled(pe_resource_t *rsc);
 591 pe_action_t *pe__clear_resource_history(pe_resource_t *rsc, pe_node_t *node,
 592                                         pe_working_set_t *data_set);
 593 
 594 GListPtr pe__rscs_with_tag(pe_working_set_t *data_set, const char *tag_name);
 595 GListPtr pe__unames_with_tag(pe_working_set_t *data_set, const char *tag_name);
 596 bool pe__rsc_has_tag(pe_working_set_t *data_set, const char *rsc, const char *tag);
 597 bool pe__uname_has_tag(pe_working_set_t *data_set, const char *node, const char *tag);
 598 
 599 bool pe__rsc_running_on_any_node_in_list(pe_resource_t *rsc, GListPtr node_list);
 600 GListPtr pe__filter_rsc_list(GListPtr rscs, GListPtr filter);
 601 
 602 bool pcmk__rsc_filtered_by_node(pe_resource_t *rsc, GListPtr only_node);
 603 
 604 gboolean pe__bundle_is_filtered(pe_resource_t *rsc, GListPtr only_rsc, gboolean check_parent);
 605 gboolean pe__clone_is_filtered(pe_resource_t *rsc, GListPtr only_rsc, gboolean check_parent);
 606 gboolean pe__group_is_filtered(pe_resource_t *rsc, GListPtr only_rsc, gboolean check_parent);
 607 gboolean pe__native_is_filtered(pe_resource_t *rsc, GListPtr only_rsc, gboolean check_parent);
 608 
 609 #endif

/* [previous][next][first][last][top][bottom][index][help] */