pacemaker  2.0.2-debe490
Scalable High-Availability cluster resource manager
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
unpack.h
Go to the documentation of this file.
1 /*
2  * Copyright 2004-2018 Andrew Beekhof <andrew@beekhof.net>
3  *
4  * This source code is licensed under the GNU Lesser General Public License
5  * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
6  */
7 
8 #ifndef PENGINE_UNPACK__H
9 # define PENGINE_UNPACK__H
10 
11 extern gboolean unpack_remote_nodes(xmlNode * xml_resources, pe_working_set_t * data_set);
12 
13 extern gboolean unpack_resources(xmlNode * xml_resources, pe_working_set_t * data_set);
14 
15 extern gboolean unpack_config(xmlNode * config, pe_working_set_t * data_set);
16 
17 extern gboolean unpack_nodes(xmlNode * xml_nodes, pe_working_set_t * data_set);
18 
19 extern gboolean unpack_tags(xmlNode * xml_tags, pe_working_set_t * data_set);
20 
21 extern gboolean unpack_status(xmlNode * status, pe_working_set_t * data_set);
22 
23 extern gint sort_op_by_callid(gconstpointer a, gconstpointer b);
24 
25 extern gboolean unpack_lrm_resources(node_t * node, xmlNode * lrm_state,
26  pe_working_set_t * data_set);
27 
28 extern gboolean add_node_attrs(xmlNode * attrs, node_t * node, gboolean overwrite,
29  pe_working_set_t * data_set);
30 
31 extern gboolean determine_online_status(xmlNode * node_state, node_t * this_node,
32  pe_working_set_t * data_set);
33 
34 /*
35  * The man pages for both curses and ncurses suggest inclusion of "curses.h".
36  * We believe the following to be acceptable and portable.
37  */
38 
39 # if defined(HAVE_LIBNCURSES) || defined(HAVE_LIBCURSES)
40 # if defined(HAVE_NCURSES_H) && !defined(HAVE_INCOMPATIBLE_PRINTW)
41 # include <ncurses.h>
42 # define CURSES_ENABLED 1
43 # elif defined(HAVE_NCURSES_NCURSES_H) && !defined(HAVE_INCOMPATIBLE_PRINTW)
44 # include <ncurses/ncurses.h>
45 # define CURSES_ENABLED 1
46 # elif defined(HAVE_CURSES_H) && !defined(HAVE_INCOMPATIBLE_PRINTW)
47 # include <curses.h>
48 # define CURSES_ENABLED 1
49 # elif defined(HAVE_CURSES_CURSES_H) && !defined(HAVE_INCOMPATIBLE_PRINTW)
50 # include <curses/curses.h>
51 # define CURSES_ENABLED 1
52 # else
53 # define CURSES_ENABLED 0
54 # endif
55 # else
56 # define CURSES_ENABLED 0
57 # endif
58 
59 # if CURSES_ENABLED
60 # define status_printw(fmt, args...) printw(fmt, ##args)
61 # else
62 # define status_printw(fmt, args...) \
63  crm_err("printw support requires ncurses to be available during configure"); \
64  do_crm_log(LOG_WARNING, fmt, ##args);
65 # endif
66 
67 # define status_print(fmt, args...) \
68  if(options & pe_print_html) { \
69  FILE *stream = print_data; \
70  fprintf(stream, fmt, ##args); \
71  } else if(options & pe_print_ncurses) { \
72  status_printw(fmt, ##args); \
73  } else if(options & pe_print_printf) { \
74  FILE *stream = print_data; \
75  fprintf(stream, fmt, ##args); \
76  } else if(options & pe_print_xml) { \
77  FILE *stream = print_data; \
78  fprintf(stream, fmt, ##args); \
79  } else if(options & pe_print_log) { \
80  int log_level = *(int*)print_data; \
81  do_crm_log(log_level, fmt, ##args); \
82  }
83 
84 // Some warnings we don't want to print every transition
85 
87  pe_wo_blind = 0x0001,
89  pe_wo_role_after = 0x0004,
90  pe_wo_poweroff = 0x0008,
93 };
94 
95 extern uint32_t pe_wo;
96 
97 #define pe_warn_once(pe_wo_bit, fmt...) do { \
98  if (is_not_set(pe_wo, pe_wo_bit)) { \
99  if (pe_wo_bit == pe_wo_blind) { \
100  crm_warn(fmt); \
101  } else { \
102  pe_warn(fmt); \
103  } \
104  set_bit(pe_wo, pe_wo_bit); \
105  } \
106  } while (0);
107 
108 #endif
gboolean unpack_resources(xmlNode *xml_resources, pe_working_set_t *data_set)
Definition: unpack.c:721
gboolean unpack_tags(xmlNode *xml_tags, pe_working_set_t *data_set)
Definition: unpack.c:781
gint sort_op_by_callid(gconstpointer a, gconstpointer b)
Definition: utils.c:1609
gboolean determine_online_status(xmlNode *node_state, node_t *this_node, pe_working_set_t *data_set)
Definition: unpack.c:1392
gboolean unpack_remote_nodes(xmlNode *xml_resources, pe_working_set_t *data_set)
Definition: unpack.c:587
gboolean unpack_config(xmlNode *config, pe_working_set_t *data_set)
Definition: unpack.c:169
gboolean unpack_status(xmlNode *status, pe_working_set_t *data_set)
Definition: unpack.c:1063
gboolean unpack_lrm_resources(node_t *node, xmlNode *lrm_rsc_list, pe_working_set_t *data_set)
Definition: unpack.c:2300
gboolean add_node_attrs(xmlNode *xml_obj, node_t *node, gboolean overwrite, pe_working_set_t *data_set)
Definition: unpack.c:3353
gboolean unpack_nodes(xmlNode *xml_nodes, pe_working_set_t *data_set)
Definition: unpack.c:501
uint32_t pe_wo
Definition: unpack.c:43
pe_warn_once_e
Definition: unpack.h:86