pacemaker  1.1.17-b36b869ca8
Scalable High-Availability cluster resource manager
cib_attrs.c
Go to the documentation of this file.
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 
19 #include <crm_internal.h>
20 
21 #include <sys/param.h>
22 
23 #include <crm/crm.h>
24 
25 #include <stdio.h>
26 #include <sys/types.h>
27 #include <unistd.h>
28 
29 #include <stdlib.h>
30 #include <errno.h>
31 #include <fcntl.h>
32 #include <libgen.h>
33 
34 #include <crm/msg_xml.h>
35 #include <crm/common/xml.h>
36 #include <crm/cib/internal.h>
37 
38 #define attr_msg(level, fmt, args...) do { \
39  if(to_console) { \
40  printf(fmt"\n", ##args); \
41  } else { \
42  do_crm_log(level, fmt , ##args); \
43  } \
44  } while(0)
45 
46 /* could also check for possible truncation */
47 #define attr_snprintf(_str, _offset, _limit, ...) do { \
48  _offset += snprintf(_str + _offset, \
49  (_limit > _offset) ? _limit - _offset : 0, \
50  __VA_ARGS__); \
51  } while(0)
52 
53 extern int
54 find_nvpair_attr_delegate(cib_t * the_cib, const char *attr, const char *section,
55  const char *node_uuid, const char *attr_set_type, const char *set_name,
56  const char *attr_id, const char *attr_name, gboolean to_console,
57  char **value, const char *user_name)
58 {
59  int offset = 0;
60  static int xpath_max = 1024;
61  int rc = pcmk_ok;
62 
63  char *xpath_string = NULL;
64  xmlNode *xml_search = NULL;
65  const char *set_type = NULL;
66  const char *node_type = NULL;
67 
68  if (attr_set_type) {
69  set_type = attr_set_type;
70  } else {
71  set_type = XML_TAG_ATTR_SETS;
72  }
73 
74  CRM_ASSERT(value != NULL);
75  *value = NULL;
76 
77  if (safe_str_eq(section, XML_CIB_TAG_CRMCONFIG)) {
78  node_uuid = NULL;
79  set_type = XML_CIB_TAG_PROPSET;
80 
81  } else if (safe_str_eq(section, XML_CIB_TAG_OPCONFIG)
82  || safe_str_eq(section, XML_CIB_TAG_RSCCONFIG)) {
83  node_uuid = NULL;
84  set_type = XML_TAG_META_SETS;
85 
86  } else if (safe_str_eq(section, XML_CIB_TAG_TICKETS)) {
87  node_uuid = NULL;
88  section = XML_CIB_TAG_STATUS;
89  node_type = XML_CIB_TAG_TICKETS;
90 
91  } else if (node_uuid == NULL) {
92  return -EINVAL;
93  }
94 
95  xpath_string = calloc(1, xpath_max);
96  if (xpath_string == NULL) {
97  crm_perror(LOG_CRIT, "Could not create xpath");
98  return -ENOMEM;
99  }
100 
101  attr_snprintf(xpath_string, offset, xpath_max, "%.128s", get_object_path(section));
102 
103  if (safe_str_eq(node_type, XML_CIB_TAG_TICKETS)) {
104  attr_snprintf(xpath_string, offset, xpath_max, "//%s", node_type);
105 
106  } else if (node_uuid) {
107  const char *node_type = XML_CIB_TAG_NODE;
108 
109  if (safe_str_eq(section, XML_CIB_TAG_STATUS)) {
110  node_type = XML_CIB_TAG_STATE;
111  set_type = XML_TAG_TRANSIENT_NODEATTRS;
112  }
113  attr_snprintf(xpath_string, offset, xpath_max, "//%s[@id='%s']", node_type,
114  node_uuid);
115  }
116 
117  if (set_name) {
118  attr_snprintf(xpath_string, offset, xpath_max, "//%s[@id='%.128s']", set_type,
119  set_name);
120  } else {
121  attr_snprintf(xpath_string, offset, xpath_max, "//%s", set_type);
122  }
123 
124  attr_snprintf(xpath_string, offset, xpath_max, "//nvpair[");
125  if (attr_id) {
126  attr_snprintf(xpath_string, offset, xpath_max, "@id='%s'", attr_id);
127  }
128 
129  if (attr_name) {
130  if (attr_id) {
131  attr_snprintf(xpath_string, offset, xpath_max, " and ");
132  }
133  attr_snprintf(xpath_string, offset, xpath_max, "@name='%.128s'", attr_name);
134  }
135  attr_snprintf(xpath_string, offset, xpath_max, "]");
136  CRM_LOG_ASSERT(offset > 0);
137 
138  rc = cib_internal_op(the_cib, CIB_OP_QUERY, NULL, xpath_string, NULL, &xml_search,
139  cib_sync_call | cib_scope_local | cib_xpath, user_name);
140 
141  if (rc != pcmk_ok) {
142  crm_trace("Query failed for attribute %s (section=%s, node=%s, set=%s, xpath=%s): %s",
143  attr_name, section, crm_str(node_uuid), crm_str(set_name), xpath_string,
144  pcmk_strerror(rc));
145  goto done;
146  }
147 
148  crm_log_xml_debug(xml_search, "Match");
149  if (xml_has_children(xml_search)) {
150  xmlNode *child = NULL;
151 
152  rc = -ENOTUNIQ;
153  attr_msg(LOG_WARNING, "Multiple attributes match name=%s", attr_name);
154 
155  for (child = __xml_first_child(xml_search); child != NULL; child = __xml_next(child)) {
156  attr_msg(LOG_INFO, " Value: %s \t(id=%s)",
157  crm_element_value(child, XML_NVPAIR_ATTR_VALUE), ID(child));
158  }
159 
160  } else {
161  const char *tmp = crm_element_value(xml_search, attr);
162 
163  if (tmp) {
164  *value = strdup(tmp);
165  }
166  }
167 
168  done:
169  free(xpath_string);
170  free_xml(xml_search);
171  return rc;
172 }
173 
174 int
175 update_attr_delegate(cib_t * the_cib, int call_options,
176  const char *section, const char *node_uuid, const char *set_type,
177  const char *set_name, const char *attr_id, const char *attr_name,
178  const char *attr_value, gboolean to_console, const char *user_name,
179  const char *node_type)
180 {
181  const char *tag = NULL;
182  int rc = pcmk_ok;
183  xmlNode *xml_top = NULL;
184  xmlNode *xml_obj = NULL;
185 
186  char *local_attr_id = NULL;
187  char *local_set_name = NULL;
188 
189  CRM_CHECK(section != NULL, return -EINVAL);
190  CRM_CHECK(attr_value != NULL, return -EINVAL);
191  CRM_CHECK(attr_name != NULL || attr_id != NULL, return -EINVAL);
192 
193  rc = find_nvpair_attr_delegate(the_cib, XML_ATTR_ID, section, node_uuid, set_type, set_name,
194  attr_id, attr_name, to_console, &local_attr_id, user_name);
195  if (rc == pcmk_ok) {
196  attr_id = local_attr_id;
197  goto do_modify;
198 
199  } else if (rc != -ENXIO) {
200  return rc;
201 
202  /* } else if(attr_id == NULL) { */
203  /* return -EINVAL; */
204 
205  } else {
206  crm_trace("%s does not exist, create it", attr_name);
207  if (safe_str_eq(section, XML_CIB_TAG_TICKETS)) {
208  node_uuid = NULL;
209  section = XML_CIB_TAG_STATUS;
210  node_type = XML_CIB_TAG_TICKETS;
211 
212  xml_top = create_xml_node(xml_obj, XML_CIB_TAG_STATUS);
213  xml_obj = create_xml_node(xml_top, XML_CIB_TAG_TICKETS);
214 
215  } else if (safe_str_eq(section, XML_CIB_TAG_NODES)) {
216 
217  if (node_uuid == NULL) {
218  return -EINVAL;
219  }
220 
221  if (safe_str_eq(node_type, "remote")) {
222  xml_top = create_xml_node(xml_obj, XML_CIB_TAG_NODES);
223  xml_obj = create_xml_node(xml_top, XML_CIB_TAG_NODE);
224  crm_xml_add(xml_obj, XML_ATTR_TYPE, "remote");
225  crm_xml_add(xml_obj, XML_ATTR_ID, node_uuid);
226  crm_xml_add(xml_obj, XML_ATTR_UNAME, node_uuid);
227  } else {
228  tag = XML_CIB_TAG_NODE;
229  }
230 
231  } else if (safe_str_eq(section, XML_CIB_TAG_STATUS)) {
233  if (node_uuid == NULL) {
234  return -EINVAL;
235  }
236 
237  xml_top = create_xml_node(xml_obj, XML_CIB_TAG_STATE);
238  crm_xml_add(xml_top, XML_ATTR_ID, node_uuid);
239  xml_obj = xml_top;
240 
241  } else {
242  tag = section;
243  node_uuid = NULL;
244  }
245 
246  if (set_name == NULL) {
247  if (safe_str_eq(section, XML_CIB_TAG_CRMCONFIG)) {
248  local_set_name = strdup(CIB_OPTIONS_FIRST);
249 
250  } else if (safe_str_eq(node_type, XML_CIB_TAG_TICKETS)) {
251  local_set_name = crm_concat(section, XML_CIB_TAG_TICKETS, '-');
252 
253  } else if (node_uuid) {
254  local_set_name = crm_concat(section, node_uuid, '-');
255 
256  if (set_type) {
257  char *tmp_set_name = local_set_name;
258 
259  local_set_name = crm_concat(tmp_set_name, set_type, '-');
260  free(tmp_set_name);
261  }
262  } else {
263  local_set_name = crm_concat(section, "options", '-');
264  }
265  set_name = local_set_name;
266  }
267 
268  if (attr_id == NULL) {
269  local_attr_id = crm_concat(set_name, attr_name, '-');
270  crm_xml_sanitize_id(local_attr_id);
271  attr_id = local_attr_id;
272 
273  } else if (attr_name == NULL) {
274  attr_name = attr_id;
275  }
276 
277  crm_trace("Creating %s/%s", section, tag);
278  if (tag != NULL) {
279  xml_obj = create_xml_node(xml_obj, tag);
280  crm_xml_add(xml_obj, XML_ATTR_ID, node_uuid);
281  if (xml_top == NULL) {
282  xml_top = xml_obj;
283  }
284  }
285 
286  if (node_uuid == NULL && safe_str_neq(node_type, XML_CIB_TAG_TICKETS)) {
287  if (safe_str_eq(section, XML_CIB_TAG_CRMCONFIG)) {
288  xml_obj = create_xml_node(xml_obj, XML_CIB_TAG_PROPSET);
289  } else {
290  xml_obj = create_xml_node(xml_obj, XML_TAG_META_SETS);
291  }
292 
293  } else if (set_type) {
294  xml_obj = create_xml_node(xml_obj, set_type);
295 
296  } else {
297  xml_obj = create_xml_node(xml_obj, XML_TAG_ATTR_SETS);
298  }
299  crm_xml_add(xml_obj, XML_ATTR_ID, set_name);
300 
301  if (xml_top == NULL) {
302  xml_top = xml_obj;
303  }
304  }
305 
306  do_modify:
307  xml_obj = create_xml_node(xml_obj, XML_CIB_TAG_NVPAIR);
308  if (xml_top == NULL) {
309  xml_top = xml_obj;
310  }
311 
312  crm_xml_add(xml_obj, XML_ATTR_ID, attr_id);
313  crm_xml_add(xml_obj, XML_NVPAIR_ATTR_NAME, attr_name);
314  crm_xml_add(xml_obj, XML_NVPAIR_ATTR_VALUE, attr_value);
315 
316  crm_log_xml_trace(xml_top, "update_attr");
317  rc = cib_internal_op(the_cib, CIB_OP_MODIFY, NULL, section, xml_top, NULL,
318  call_options | cib_quorum_override, user_name);
319 
320  if (rc < pcmk_ok) {
321  attr_msg(LOG_ERR, "Error setting %s=%s (section=%s, set=%s): %s",
322  attr_name, attr_value, section, crm_str(set_name), pcmk_strerror(rc));
323  crm_log_xml_info(xml_top, "Update");
324  }
325 
326  free(local_set_name);
327  free(local_attr_id);
328  free_xml(xml_top);
329 
330  return rc;
331 }
332 
333 int
335  const char *section, const char *node_uuid, const char *set_type,
336  const char *set_name, const char *attr_id, const char *attr_name,
337  char **attr_value, gboolean to_console, const char *user_name)
338 {
339  int rc = pcmk_ok;
340 
341  CRM_ASSERT(attr_value != NULL);
342  CRM_CHECK(section != NULL, return -EINVAL);
343  CRM_CHECK(attr_name != NULL || attr_id != NULL, return -EINVAL);
344 
345  *attr_value = NULL;
346 
347  rc = find_nvpair_attr_delegate(the_cib, XML_NVPAIR_ATTR_VALUE, section, node_uuid, set_type,
348  set_name, attr_id, attr_name, to_console, attr_value, user_name);
349  if (rc != pcmk_ok) {
350  crm_trace("Query failed for attribute %s (section=%s, node=%s, set=%s): %s",
351  attr_name, section, crm_str(set_name), crm_str(node_uuid), pcmk_strerror(rc));
352  }
353  return rc;
354 }
355 
356 int
357 delete_attr_delegate(cib_t * the_cib, int options,
358  const char *section, const char *node_uuid, const char *set_type,
359  const char *set_name, const char *attr_id, const char *attr_name,
360  const char *attr_value, gboolean to_console, const char *user_name)
361 {
362  int rc = pcmk_ok;
363  xmlNode *xml_obj = NULL;
364  char *local_attr_id = NULL;
365 
366  CRM_CHECK(section != NULL, return -EINVAL);
367  CRM_CHECK(attr_name != NULL || attr_id != NULL, return -EINVAL);
368 
369  if (attr_id == NULL) {
370  rc = find_nvpair_attr_delegate(the_cib, XML_ATTR_ID, section, node_uuid, set_type,
371  set_name, attr_id, attr_name, to_console, &local_attr_id,
372  user_name);
373  if (rc != pcmk_ok) {
374  return rc;
375  }
376  attr_id = local_attr_id;
377  }
378 
379  xml_obj = create_xml_node(NULL, XML_CIB_TAG_NVPAIR);
380  crm_xml_add(xml_obj, XML_ATTR_ID, attr_id);
381  crm_xml_add(xml_obj, XML_NVPAIR_ATTR_NAME, attr_name);
382  crm_xml_add(xml_obj, XML_NVPAIR_ATTR_VALUE, attr_value);
383 
384  rc = cib_internal_op(the_cib, CIB_OP_DELETE, NULL, section, xml_obj, NULL,
385  options | cib_quorum_override, user_name);
386 
387  if (rc == pcmk_ok) {
388  attr_msg(LOG_DEBUG, "Deleted %s %s: id=%s%s%s%s%s\n",
389  section, node_uuid ? "attribute" : "option", local_attr_id,
390  set_name ? " set=" : "", set_name ? set_name : "",
391  attr_name ? " name=" : "", attr_name ? attr_name : "");
392  }
393 
394  free(local_attr_id);
395  free_xml(xml_obj);
396  return rc;
397 }
398 
409 static int
410 get_uuid_from_result(xmlNode *result, char **uuid, int *is_remote)
411 {
412  int rc = -ENXIO;
413  const char *tag;
414  const char *parsed_uuid = NULL;
415  int parsed_is_remote = FALSE;
416 
417  if (result == NULL) {
418  return rc;
419  }
420 
421  /* If there are multiple results, the first is sufficient */
422  tag = (const char *) (result->name);
423  if (safe_str_eq(tag, "xpath-query")) {
424  result = __xml_first_child(result);
425  tag = (const char *) (result->name);
426  }
427 
428  if (safe_str_eq(tag, XML_CIB_TAG_NODE)) {
429  /* Result is <node> tag from <nodes> section */
430 
431  if (safe_str_eq(crm_element_value(result, XML_ATTR_TYPE), "remote")) {
432  parsed_uuid = crm_element_value(result, XML_ATTR_UNAME);
433  parsed_is_remote = TRUE;
434  } else {
435  parsed_uuid = ID(result);
436  parsed_is_remote = FALSE;
437  }
438 
439  } else if (safe_str_eq(tag, XML_CIB_TAG_RESOURCE)) {
440  /* Result is <primitive> for ocf:pacemaker:remote resource */
441 
442  parsed_uuid = ID(result);
443  parsed_is_remote = TRUE;
444 
445  } else if (safe_str_eq(tag, XML_CIB_TAG_NVPAIR)) {
446  /* Result is remote-node parameter of <primitive> for guest node */
447 
448  parsed_uuid = crm_element_value(result, XML_NVPAIR_ATTR_VALUE);
449  parsed_is_remote = TRUE;
450 
451  } else if (safe_str_eq(tag, XML_CIB_TAG_STATE)) {
452  /* Result is <node_state> tag from <status> section */
453 
454  parsed_uuid = crm_element_value(result, XML_ATTR_UNAME);
456  parsed_is_remote = TRUE;
457  }
458  }
459 
460  if (parsed_uuid) {
461  if (uuid) {
462  *uuid = strdup(parsed_uuid);
463  }
464  if (is_remote) {
465  *is_remote = parsed_is_remote;
466  }
467  rc = pcmk_ok;
468  }
469 
470  return rc;
471 }
472 
473 /* Search string to find a node by name, as:
474  * - cluster or remote node in nodes section
475  * - remote node in resources section
476  * - guest node in resources section
477  * - orphaned remote node or bundle guest node in status section
478  */
479 #define XPATH_NODE \
480  "/" XML_TAG_CIB "/" XML_CIB_TAG_CONFIGURATION "/" XML_CIB_TAG_NODES \
481  "/" XML_CIB_TAG_NODE "[@" XML_ATTR_UNAME "='%s']" \
482  "|/" XML_TAG_CIB "/" XML_CIB_TAG_CONFIGURATION "/" XML_CIB_TAG_RESOURCES \
483  "/" XML_CIB_TAG_RESOURCE \
484  "[@class='ocf'][@provider='pacemaker'][@type='remote'][@id='%s']" \
485  "|/" XML_TAG_CIB "/" XML_CIB_TAG_CONFIGURATION "/" XML_CIB_TAG_RESOURCES \
486  "/" XML_CIB_TAG_RESOURCE "/" XML_TAG_META_SETS "/" XML_CIB_TAG_NVPAIR \
487  "[@name='" XML_RSC_ATTR_REMOTE_NODE "'][@value='%s']" \
488  "|/" XML_TAG_CIB "/" XML_CIB_TAG_STATUS "/" XML_CIB_TAG_STATE \
489  "[@" XML_NODE_IS_REMOTE "='true'][@" XML_ATTR_UUID "='%s']"
490 
491 int
492 query_node_uuid(cib_t * the_cib, const char *uname, char **uuid, int *is_remote_node)
493 {
494  int rc = pcmk_ok;
495  char *xpath_string;
496  xmlNode *xml_search = NULL;
497 
498  CRM_ASSERT(uname != NULL);
499 
500  if (uuid) {
501  *uuid = NULL;
502  }
503  if (is_remote_node) {
504  *is_remote_node = FALSE;
505  }
506 
507  xpath_string = crm_strdup_printf(XPATH_NODE, uname, uname, uname, uname);
508  if (cib_internal_op(the_cib, CIB_OP_QUERY, NULL, xpath_string, NULL,
510  NULL) == pcmk_ok) {
511  rc = get_uuid_from_result(xml_search, uuid, is_remote_node);
512  } else {
513  rc = -ENXIO;
514  }
515  free(xpath_string);
516  free_xml(xml_search);
517 
518  if (rc != pcmk_ok) {
519  crm_debug("Could not map node name '%s' to a UUID: %s",
520  uname, pcmk_strerror(rc));
521  } else {
522  crm_info("Mapped node name '%s' to UUID %s", uname, (uuid? *uuid : ""));
523  }
524  return rc;
525 }
526 
527 int
528 query_node_uname(cib_t * the_cib, const char *uuid, char **uname)
529 {
530  int rc = pcmk_ok;
531  xmlNode *a_child = NULL;
532  xmlNode *xml_obj = NULL;
533  xmlNode *fragment = NULL;
534  const char *child_name = NULL;
535 
536  CRM_ASSERT(uname != NULL);
537  CRM_ASSERT(uuid != NULL);
538 
539  rc = the_cib->cmds->query(the_cib, XML_CIB_TAG_NODES, &fragment,
541  if (rc != pcmk_ok) {
542  return rc;
543  }
544 
545  xml_obj = fragment;
546  CRM_CHECK(safe_str_eq(crm_element_name(xml_obj), XML_CIB_TAG_NODES), return -ENOMSG);
547  CRM_ASSERT(xml_obj != NULL);
548  crm_log_xml_trace(xml_obj, "Result section");
549 
550  rc = -ENXIO;
551  *uname = NULL;
552 
553  for (a_child = __xml_first_child(xml_obj); a_child != NULL; a_child = __xml_next(a_child)) {
554  if (crm_str_eq((const char *)a_child->name, XML_CIB_TAG_NODE, TRUE)) {
555  child_name = ID(a_child);
556  if (safe_str_eq(uuid, child_name)) {
557  child_name = crm_element_value(a_child, XML_ATTR_UNAME);
558  if (child_name != NULL) {
559  *uname = strdup(child_name);
560  rc = pcmk_ok;
561  }
562  break;
563  }
564  }
565  }
566 
567  free_xml(fragment);
568  return rc;
569 }
570 
571 int
572 set_standby(cib_t * the_cib, const char *uuid, const char *scope, const char *standby_value)
573 {
574  int rc = pcmk_ok;
575  char *attr_id = NULL;
576 
577  CRM_CHECK(uuid != NULL, return -EINVAL);
578  CRM_CHECK(standby_value != NULL, return -EINVAL);
579 
580  if (safe_str_eq(scope, "reboot") || safe_str_eq(scope, XML_CIB_TAG_STATUS)) {
581  scope = XML_CIB_TAG_STATUS;
582  attr_id = crm_strdup_printf("transient-standby-%.256s", uuid);
583 
584  } else {
585  scope = XML_CIB_TAG_NODES;
586  attr_id = crm_strdup_printf("standby-%.256s", uuid);
587  }
588 
589  rc = update_attr_delegate(the_cib, cib_sync_call, scope, uuid, NULL, NULL,
590  attr_id, "standby", standby_value, TRUE, NULL, NULL);
591 
592  free(attr_id);
593  return rc;
594 }
#define CRM_CHECK(expr, failure_action)
Definition: logging.h:164
int read_attr_delegate(cib_t *the_cib, const char *section, const char *node_uuid, const char *set_type, const char *set_name, const char *attr_id, const char *attr_name, char **attr_value, gboolean to_console, const char *user_name)
Definition: cib_attrs.c:334
A dumping ground.
gboolean safe_str_neq(const char *a, const char *b)
Definition: strings.c:150
#define XML_ATTR_TYPE
Definition: msg_xml.h:104
const char * pcmk_strerror(int rc)
Definition: logging.c:1132
int set_standby(cib_t *the_cib, const char *uuid, const char *scope, const char *standby_value)
Definition: cib_attrs.c:572
int update_attr_delegate(cib_t *the_cib, int call_options, const char *section, const char *node_uuid, const char *set_type, const char *set_name, const char *attr_id, const char *attr_name, const char *attr_value, gboolean to_console, const char *user_name, const char *node_type)
Definition: cib_attrs.c:175
#define pcmk_ok
Definition: error.h:42
int delete_attr_delegate(cib_t *the_cib, int options, const char *section, const char *node_uuid, const char *set_type, const char *set_name, const char *attr_id, const char *attr_name, const char *attr_value, gboolean to_console, const char *user_name)
Definition: cib_attrs.c:357
#define XML_TAG_TRANSIENT_NODEATTRS
Definition: msg_xml.h:378
const char * get_object_path(const char *object_type)
Definition: cib_utils.c:201
#define XML_NVPAIR_ATTR_NAME
Definition: msg_xml.h:354
#define CRM_LOG_ASSERT(expr)
Definition: logging.h:150
#define attr_snprintf(_str, _offset, _limit,...)
Definition: cib_attrs.c:47
#define XML_CIB_TAG_NVPAIR
Definition: msg_xml.h:174
#define XML_CIB_TAG_NODES
Definition: msg_xml.h:159
Definition: cib.h:60
int find_nvpair_attr_delegate(cib_t *the_cib, const char *attr, const char *section, const char *node_uuid, const char *attr_set_type, const char *set_name, const char *attr_id, const char *attr_name, gboolean to_console, char **value, const char *user_name)
Definition: cib_attrs.c:54
void crm_xml_sanitize_id(char *id)
Sanitize a string so it is usable as an XML ID.
Definition: xml.c:3045
#define XML_CIB_TAG_PROPSET
Definition: msg_xml.h:176
#define XML_TAG_ATTR_SETS
Definition: msg_xml.h:177
char uname[MAX_NAME]
Definition: internal.h:53
gboolean is_remote_node(node_t *node)
Definition: remote.c:62
cib_api_operations_t * cmds
Definition: cib.h:161
#define crm_debug(fmt, args...)
Definition: logging.h:253
#define XML_ATTR_ID
Definition: msg_xml.h:101
#define XML_CIB_TAG_RESOURCE
Definition: msg_xml.h:188
#define XML_CIB_TAG_STATE
Definition: msg_xml.h:170
#define CIB_OP_QUERY
Definition: internal.h:30
#define crm_trace(fmt, args...)
Definition: logging.h:254
#define crm_log_xml_debug(xml, text)
Definition: logging.h:261
node_type
Definition: status.h:40
#define XML_TAG_META_SETS
Definition: msg_xml.h:178
Wrappers for and extensions to libxml2.
#define XML_ATTR_UNAME
Definition: msg_xml.h:129
xmlNode * create_xml_node(xmlNode *parent, const char *name)
Definition: xml.c:2587
int(* query)(cib_t *cib, const char *section, xmlNode **output_data, int call_options)
Definition: cib.h:107
const char * crm_element_value(xmlNode *data, const char *name)
Definition: xml.c:5134
int query_node_uuid(cib_t *the_cib, const char *uname, char **uuid, int *is_remote_node)
Definition: cib_attrs.c:492
#define XML_NODE_IS_REMOTE
Definition: msg_xml.h:260
#define CIB_OPTIONS_FIRST
Definition: msg_xml.h:53
void free_xml(xmlNode *child)
Definition: xml.c:2705
#define XPATH_NODE
Definition: cib_attrs.c:479
gboolean xml_has_children(const xmlNode *root)
Definition: xml.c:3859
gboolean crm_str_eq(const char *a, const char *b, gboolean use_case)
Definition: strings.c:213
#define XML_CIB_TAG_NODE
Definition: msg_xml.h:171
const char * crm_xml_add(xmlNode *node, const char *name, const char *value)
Definition: xml.c:2489
#define crm_perror(level, fmt, args...)
Log a system error message.
Definition: logging.h:226
#define ENOTUNIQ
Definition: portability.h:227
#define XML_CIB_TAG_CRMCONFIG
Definition: msg_xml.h:162
#define XML_CIB_TAG_RSCCONFIG
Definition: msg_xml.h:164
#define CIB_OP_DELETE
Definition: internal.h:34
#define crm_log_xml_info(xml, text)
Definition: logging.h:260
#define CIB_OP_MODIFY
Definition: internal.h:33
#define XML_NVPAIR_ATTR_VALUE
Definition: msg_xml.h:355
#define CRM_ASSERT(expr)
Definition: error.h:35
#define crm_str(x)
Definition: logging.h:274
#define attr_msg(level, fmt, args...)
Definition: cib_attrs.c:38
#define XML_CIB_TAG_STATUS
Definition: msg_xml.h:157
#define crm_log_xml_trace(xml, text)
Definition: logging.h:262
gboolean crm_is_true(const char *s)
Definition: strings.c:165
char * crm_concat(const char *prefix, const char *suffix, char join)
Definition: strings.c:32
#define ID(x)
Definition: msg_xml.h:434
int cib_internal_op(cib_t *cib, const char *op, const char *host, const char *section, xmlNode *data, xmlNode **output_data, int call_options, const char *user_name)
Definition: cib_utils.c:835
#define safe_str_eq(a, b)
Definition: util.h:64
int query_node_uname(cib_t *the_cib, const char *uuid, char **uname)
Definition: cib_attrs.c:528
char * crm_strdup_printf(char const *format,...) __attribute__((__format__(__printf__
#define XML_CIB_TAG_OPCONFIG
Definition: msg_xml.h:163
#define XML_CIB_TAG_TICKETS
Definition: msg_xml.h:401
#define crm_info(fmt, args...)
Definition: logging.h:251
Definition: cib.h:148