root/lib/pengine/unpack.h

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

INCLUDED FROM


   1 /* 
   2  * Copyright (C) 2004 Andrew Beekhof <andrew@beekhof.net>
   3  * 
   4  * This library is free software; you can redistribute it and/or
   5  * modify it under the terms of the GNU Lesser General Public
   6  * License as published by the Free Software Foundation; either
   7  * version 2.1 of the License, or (at your option) any later version.
   8  * 
   9  * This library is distributed in the hope that it will be useful,
  10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12  * Lesser General Public License for more details.
  13  * 
  14  * You should have received a copy of the GNU Lesser General Public
  15  * License along with this library; if not, write to the Free Software
  16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  17  */
  18 #ifndef PENGINE_UNPACK__H
  19 #  define PENGINE_UNPACK__H
  20 
  21 extern gboolean unpack_remote_nodes(xmlNode * xml_resources, pe_working_set_t * data_set);
  22 
  23 extern gboolean unpack_resources(xmlNode * xml_resources, pe_working_set_t * data_set);
  24 
  25 extern gboolean unpack_config(xmlNode * config, pe_working_set_t * data_set);
  26 
  27 extern gboolean unpack_nodes(xmlNode * xml_nodes, pe_working_set_t * data_set);
  28 
  29 extern gboolean unpack_tags(xmlNode * xml_tags, pe_working_set_t * data_set);
  30 
  31 extern gboolean unpack_status(xmlNode * status, pe_working_set_t * data_set);
  32 
  33 extern gboolean unpack_remote_status(xmlNode * status, pe_working_set_t * data_set);
  34 
  35 extern gint sort_op_by_callid(gconstpointer a, gconstpointer b);
  36 
  37 extern gboolean unpack_lrm_resources(node_t * node, xmlNode * lrm_state,
  38                                      pe_working_set_t * data_set);
  39 
  40 extern gboolean add_node_attrs(xmlNode * attrs, node_t * node, gboolean overwrite,
  41                                pe_working_set_t * data_set);
  42 
  43 extern gboolean determine_online_status(xmlNode * node_state, node_t * this_node,
  44                                         pe_working_set_t * data_set);
  45 
  46 /*
  47  * The man pages for both curses and ncurses suggest inclusion of "curses.h".
  48  * We believe the following to be acceptable and portable.
  49  */
  50 
  51 #  if defined(HAVE_LIBNCURSES) || defined(HAVE_LIBCURSES)
  52 #    if defined(HAVE_NCURSES_H) && !defined(HAVE_INCOMPATIBLE_PRINTW)
  53 #      include <ncurses.h>
  54 #      define CURSES_ENABLED 1
  55 #    elif defined(HAVE_NCURSES_NCURSES_H) && !defined(HAVE_INCOMPATIBLE_PRINTW)
  56 #      include <ncurses/ncurses.h>
  57 #      define CURSES_ENABLED 1
  58 #    elif defined(HAVE_CURSES_H) && !defined(HAVE_INCOMPATIBLE_PRINTW)
  59 #      include <curses.h>
  60 #      define CURSES_ENABLED 1
  61 #    elif defined(HAVE_CURSES_CURSES_H) && !defined(HAVE_INCOMPATIBLE_PRINTW)
  62 #      include <curses/curses.h>
  63 #      define CURSES_ENABLED 1
  64 #    else
  65 #      define CURSES_ENABLED 0
  66 #    endif
  67 #  else
  68 #    define CURSES_ENABLED 0
  69 #  endif
  70 
  71 #  if CURSES_ENABLED
  72 #    define status_printw(fmt, args...) printw(fmt, ##args)
  73 #  else
  74 #    define status_printw(fmt, args...) \
  75         crm_err("printw support requires ncurses to be available during configure"); \
  76         do_crm_log(LOG_WARNING, fmt, ##args);
  77 #  endif
  78 
  79 #  define status_print(fmt, args...)                    \
  80         if(options & pe_print_html) {                   \
  81                 FILE *stream = print_data;              \
  82                 fprintf(stream, fmt, ##args);           \
  83         } else if(options & pe_print_ncurses) {         \
  84                 status_printw(fmt, ##args);             \
  85         } else if(options & pe_print_printf) {          \
  86                 FILE *stream = print_data;              \
  87                 fprintf(stream, fmt, ##args);           \
  88         } else if(options & pe_print_xml) {             \
  89                 FILE *stream = print_data;              \
  90                 fprintf(stream, fmt, ##args);           \
  91         } else if(options & pe_print_log) {             \
  92                 int log_level = *(int*)print_data;      \
  93                 do_crm_log(log_level, fmt, ##args);     \
  94         }
  95 
  96 // Some warnings we don't want to print every transition
  97 
  98 enum pe_warn_once_e {
  99     pe_wo_blind         = 0x0001,
 100     pe_wo_poweroff      = 0x0002,
 101     pe_wo_arg_map       = 0x0004,
 102     pe_wo_stonith_cmd   = 0x0008,
 103     pe_wo_requires      = 0x0010,
 104     pe_wo_isolation     = 0x0020,
 105     pe_wo_default_stick = 0x0040,
 106     pe_wo_default_isman = 0x0080,
 107     pe_wo_default_timeo = 0x0100,
 108     pe_wo_rsc_failstick = 0x0200,
 109     pe_wo_default_rscfs = 0x0400,
 110     pe_wo_legacy_notifs = 0x0800,
 111 };
 112 
 113 extern uint32_t pe_wo;
 114 
 115 #define pe_warn_once(pe_wo_bit, fmt...) do {    \
 116         if (is_not_set(pe_wo, pe_wo_bit)) {     \
 117             if (pe_wo_bit == pe_wo_blind) {     \
 118                 crm_warn(fmt);                  \
 119             } else {                            \
 120                 pe_warn(fmt);                   \
 121             }                                   \
 122             set_bit(pe_wo, pe_wo_bit);          \
 123         }                                       \
 124     } while (0);
 125 
 126 #endif

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