root/daemons/controld/controld_alerts.c

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

DEFINITIONS

This source file includes following definitions.
  1. crmd_unpack_alerts
  2. crmd_alert_node_event
  3. crmd_alert_fencing_op
  4. crmd_alert_resource_op

   1 /*
   2  * Copyright 2012-2021 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 General Public License version 2
   7  * or later (GPLv2+) WITHOUT ANY WARRANTY.
   8  */
   9 
  10 #include <crm_internal.h>
  11 
  12 #include <glib.h>
  13 #include <libxml/tree.h>
  14 
  15 #include <crm/fencing/internal.h>
  16 #include <crm/lrmd.h>
  17 #include <crm/lrmd_internal.h>
  18 #include <crm/pengine/rules_internal.h>
  19 #include <crm/pengine/status.h>
  20 #include <crm/stonith-ng.h>
  21 
  22 #include <pacemaker-controld.h>
  23 
  24 static GList *crmd_alert_list = NULL;
  25 
  26 void
  27 crmd_unpack_alerts(xmlNode *alerts)
     /* [previous][next][first][last][top][bottom][index][help] */
  28 {
  29     pe_free_alert_list(crmd_alert_list);
  30     crmd_alert_list = pe_unpack_alerts(alerts);
  31 }
  32 
  33 void
  34 crmd_alert_node_event(crm_node_t *node)
     /* [previous][next][first][last][top][bottom][index][help] */
  35 {
  36     lrm_state_t *lrm_state;
  37 
  38     if (crmd_alert_list == NULL) {
  39         return;
  40     }
  41 
  42     lrm_state = lrm_state_find(fsa_our_uname);
  43     if (lrm_state == NULL) {
  44         return;
  45     }
  46 
  47     lrmd_send_node_alert((lrmd_t *) lrm_state->conn, crmd_alert_list,
  48                          node->uname, node->id, node->state);
  49 }
  50 
  51 void
  52 crmd_alert_fencing_op(stonith_event_t * e)
     /* [previous][next][first][last][top][bottom][index][help] */
  53 {
  54     char *desc;
  55     lrm_state_t *lrm_state;
  56 
  57     if (crmd_alert_list == NULL) {
  58         return;
  59     }
  60 
  61     lrm_state = lrm_state_find(fsa_our_uname);
  62     if (lrm_state == NULL) {
  63         return;
  64     }
  65 
  66     desc = stonith__event_description(e);
  67     lrmd_send_fencing_alert((lrmd_t *) lrm_state->conn, crmd_alert_list,
  68                             e->target, e->operation, desc, e->result);
  69     free(desc);
  70 }
  71 
  72 void
  73 crmd_alert_resource_op(const char *node, lrmd_event_data_t * op)
     /* [previous][next][first][last][top][bottom][index][help] */
  74 {
  75     lrm_state_t *lrm_state;
  76 
  77     if (crmd_alert_list == NULL) {
  78         return;
  79     }
  80 
  81     lrm_state = lrm_state_find(fsa_our_uname);
  82     if (lrm_state == NULL) {
  83         return;
  84     }
  85 
  86     lrmd_send_resource_alert((lrmd_t *) lrm_state->conn, crmd_alert_list, node,
  87                              op);
  88 }

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