root/daemons/controld/controld_utils.h

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

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. fsa_cib_anon_update
  2. fsa_cib_anon_update_discard_reply

   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 CRMD_UTILS__H
  11 #  define CRMD_UTILS__H
  12 
  13 #  include <crm/crm.h>
  14 #  include <crm/common/xml.h>
  15 #  include <crm/cib/internal.h>     // CIB_OP_MODIFY
  16 #  include <controld_fsa.h>         // fsa_cib_conn
  17 #  include <controld_alerts.h>
  18 
  19 #  define FAKE_TE_ID    "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
  20 
  21 
  22 #  define fsa_cib_update(section, data, options, call_id, user_name)    \
  23         if(fsa_cib_conn != NULL) {                                      \
  24             call_id = cib_internal_op(                                  \
  25                 fsa_cib_conn, CIB_OP_MODIFY, NULL, section, data,       \
  26                 NULL, options, user_name);                              \
  27                                                                         \
  28         } else {                                                        \
  29                 crm_err("No CIB manager connection available");                 \
  30         }
  31 
  32 static inline void
  33 fsa_cib_anon_update(const char *section, xmlNode *data) {
     /* [previous][next][first][last][top][bottom][index][help] */
  34     if (fsa_cib_conn == NULL) {
  35         crm_err("No CIB connection available");
  36     } else {
  37         int opts = cib_scope_local | cib_quorum_override | cib_can_create;
  38 
  39         fsa_cib_conn->cmds->modify(fsa_cib_conn, section, data, opts);
  40     }
  41 }
  42 
  43 static inline void
  44 fsa_cib_anon_update_discard_reply(const char *section, xmlNode *data) {
     /* [previous][next][first][last][top][bottom][index][help] */
  45     if (fsa_cib_conn == NULL) {
  46         crm_err("No CIB connection available");
  47     } else {
  48         int opts = cib_scope_local | cib_quorum_override | cib_can_create | cib_discard_reply;
  49 
  50         fsa_cib_conn->cmds->modify(fsa_cib_conn, section, data, opts);
  51     }
  52 }
  53 
  54 extern gboolean fsa_has_quorum;
  55 extern bool controld_shutdown_lock_enabled;
  56 extern int last_peer_update;
  57 extern int last_resource_update;
  58 
  59 enum node_update_flags {
  60     node_update_none = 0x0000,
  61     node_update_quick = 0x0001,
  62     node_update_cluster = 0x0010,
  63     node_update_peer = 0x0020,
  64     node_update_join = 0x0040,
  65     node_update_expected = 0x0100,
  66     node_update_all = node_update_cluster|node_update_peer|node_update_join|node_update_expected,
  67 };
  68 
  69 crm_exit_t crmd_exit(crm_exit_t exit_code);
  70 _Noreturn void crmd_fast_exit(crm_exit_t exit_code);
  71 void pe_subsystem_free(void);
  72 void controld_stop_sched_timer(void);
  73 void controld_free_sched_timer(void);
  74 void controld_expect_sched_reply(xmlNode *msg);
  75 
  76 void fsa_dump_actions(uint64_t action, const char *text);
  77 void fsa_dump_inputs(int log_level, const char *text, long long input_register);
  78 
  79 gboolean update_dc(xmlNode * msg);
  80 void crm_update_peer_join(const char *source, crm_node_t * node, enum crm_join_phase phase);
  81 xmlNode *create_node_state_update(crm_node_t *node, int flags,
  82                                   xmlNode *parent, const char *source);
  83 void populate_cib_nodes(enum node_update_flags flags, const char *source);
  84 void crm_update_quorum(gboolean quorum, gboolean force_update);
  85 void controld_close_attrd_ipc(void);
  86 void update_attrd(const char *host, const char *name, const char *value, const char *user_name, gboolean is_remote_node);
  87 void update_attrd_remote_node_removed(const char *host, const char *user_name);
  88 void update_attrd_clear_failures(const char *host, const char *rsc,
  89                                  const char *op, const char *interval_spec,
  90                                  gboolean is_remote_node);
  91 
  92 int crmd_join_phase_count(enum crm_join_phase phase);
  93 void crmd_join_phase_log(int level);
  94 
  95 void crmd_peer_down(crm_node_t *peer, bool full);
  96 unsigned int cib_op_timeout(void);
  97 
  98 bool feature_set_compatible(const char *dc_version, const char *join_version);
  99 bool controld_action_is_recordable(const char *action);
 100 
 101 // Subsections of node_state
 102 enum controld_section_e {
 103     controld_section_lrm,
 104     controld_section_lrm_unlocked,
 105     controld_section_attrs,
 106     controld_section_all,
 107     controld_section_all_unlocked
 108 };
 109 
 110 void controld_delete_node_state(const char *uname,
 111                                 enum controld_section_e section, int options);
 112 int controld_delete_resource_history(const char *rsc_id, const char *node,
 113                                      const char *user_name, int call_options);
 114 
 115 const char *get_node_id(xmlNode *lrm_rsc_op);
 116 
 117 /* Convenience macro for registering a CIB callback
 118  * (assumes that data can be freed with free())
 119  */
 120 #  define fsa_register_cib_callback(id, flag, data, fn) do {            \
 121     CRM_ASSERT(fsa_cib_conn);                                           \
 122     fsa_cib_conn->cmds->register_callback_full(                         \
 123         fsa_cib_conn, id, cib_op_timeout(),                             \
 124             flag, data, #fn, fn, free);                                 \
 125     } while(0)
 126 
 127 #endif

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