pacemaker  1.1.14-70404b0
Scalable High-Availability cluster resource manager
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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  CRM_CHECK(xpath_string != NULL, return -ENOMEM);
97 
98  attr_snprintf(xpath_string, offset, xpath_max, "%.128s", get_object_path(section));
99 
100  if (safe_str_eq(node_type, XML_CIB_TAG_TICKETS)) {
101  attr_snprintf(xpath_string, offset, xpath_max, "//%s", node_type);
102 
103  } else if (node_uuid) {
104  const char *node_type = XML_CIB_TAG_NODE;
105 
106  if (safe_str_eq(section, XML_CIB_TAG_STATUS)) {
107  node_type = XML_CIB_TAG_STATE;
108  set_type = XML_TAG_TRANSIENT_NODEATTRS;
109  }
110  attr_snprintf(xpath_string, offset, xpath_max, "//%s[@id='%s']", node_type,
111  node_uuid);
112  }
113 
114  if (set_name) {
115  attr_snprintf(xpath_string, offset, xpath_max, "//%s[@id='%.128s']", set_type,
116  set_name);
117  } else {
118  attr_snprintf(xpath_string, offset, xpath_max, "//%s", set_type);
119  }
120 
121  attr_snprintf(xpath_string, offset, xpath_max, "//nvpair[");
122  if (attr_id) {
123  attr_snprintf(xpath_string, offset, xpath_max, "@id='%s'", attr_id);
124  }
125 
126  if (attr_name) {
127  if (attr_id) {
128  attr_snprintf(xpath_string, offset, xpath_max, " and ");
129  }
130  attr_snprintf(xpath_string, offset, xpath_max, "@name='%.128s'", attr_name);
131  }
132  attr_snprintf(xpath_string, offset, xpath_max, "]");
133  CRM_LOG_ASSERT(offset > 0);
134 
135  rc = cib_internal_op(the_cib, CIB_OP_QUERY, NULL, xpath_string, NULL, &xml_search,
136  cib_sync_call | cib_scope_local | cib_xpath, user_name);
137 
138  if (rc != pcmk_ok) {
139  crm_trace("Query failed for attribute %s (section=%s, node=%s, set=%s, xpath=%s): %s",
140  attr_name, section, crm_str(node_uuid), crm_str(set_name), xpath_string,
141  pcmk_strerror(rc));
142  goto done;
143  }
144 
145  crm_log_xml_debug(xml_search, "Match");
146  if (xml_has_children(xml_search)) {
147  xmlNode *child = NULL;
148 
149  rc = -ENOTUNIQ;
150  attr_msg(LOG_WARNING, "Multiple attributes match name=%s", attr_name);
151 
152  for (child = __xml_first_child(xml_search); child != NULL; child = __xml_next(child)) {
153  attr_msg(LOG_INFO, " Value: %s \t(id=%s)",
154  crm_element_value(child, XML_NVPAIR_ATTR_VALUE), ID(child));
155  }
156 
157  } else {
158  const char *tmp = crm_element_value(xml_search, attr);
159 
160  if (tmp) {
161  *value = strdup(tmp);
162  }
163  }
164 
165  done:
166  free(xpath_string);
167  free_xml(xml_search);
168  return rc;
169 }
170 
171 int
172 update_attr_delegate(cib_t * the_cib, int call_options,
173  const char *section, const char *node_uuid, const char *set_type,
174  const char *set_name, const char *attr_id, const char *attr_name,
175  const char *attr_value, gboolean to_console, const char *user_name,
176  const char *node_type)
177 {
178  const char *tag = NULL;
179  int rc = pcmk_ok;
180  xmlNode *xml_top = NULL;
181  xmlNode *xml_obj = NULL;
182 
183  char *local_attr_id = NULL;
184  char *local_set_name = NULL;
185 
186  CRM_CHECK(section != NULL, return -EINVAL);
187  CRM_CHECK(attr_value != NULL, return -EINVAL);
188  CRM_CHECK(attr_name != NULL || attr_id != NULL, return -EINVAL);
189 
190  rc = find_nvpair_attr_delegate(the_cib, XML_ATTR_ID, section, node_uuid, set_type, set_name,
191  attr_id, attr_name, to_console, &local_attr_id, user_name);
192  if (rc == pcmk_ok) {
193  attr_id = local_attr_id;
194  goto do_modify;
195 
196  } else if (rc != -ENXIO) {
197  return rc;
198 
199  /* } else if(attr_id == NULL) { */
200  /* return -EINVAL; */
201 
202  } else {
203  crm_trace("%s does not exist, create it", attr_name);
204  if (safe_str_eq(section, XML_CIB_TAG_TICKETS)) {
205  node_uuid = NULL;
206  section = XML_CIB_TAG_STATUS;
207  node_type = XML_CIB_TAG_TICKETS;
208 
209  xml_top = create_xml_node(xml_obj, XML_CIB_TAG_STATUS);
210  xml_obj = create_xml_node(xml_top, XML_CIB_TAG_TICKETS);
211 
212  } else if (safe_str_eq(section, XML_CIB_TAG_NODES)) {
213 
214  if (node_uuid == NULL) {
215  return -EINVAL;
216  }
217 
218  if (safe_str_eq(node_type, "remote")) {
219  xml_top = create_xml_node(xml_obj, XML_CIB_TAG_NODES);
220  xml_obj = create_xml_node(xml_top, XML_CIB_TAG_NODE);
221  crm_xml_add(xml_obj, XML_ATTR_TYPE, "remote");
222  crm_xml_add(xml_obj, XML_ATTR_ID, node_uuid);
223  crm_xml_add(xml_obj, XML_ATTR_UNAME, node_uuid);
224  } else {
225  tag = XML_CIB_TAG_NODE;
226  }
227 
228  } else if (safe_str_eq(section, XML_CIB_TAG_STATUS)) {
230  if (node_uuid == NULL) {
231  return -EINVAL;
232  }
233 
234  xml_top = create_xml_node(xml_obj, XML_CIB_TAG_STATE);
235  crm_xml_add(xml_top, XML_ATTR_ID, node_uuid);
236  xml_obj = xml_top;
237 
238  } else {
239  tag = section;
240  node_uuid = NULL;
241  }
242 
243  if (set_name == NULL) {
244  if (safe_str_eq(section, XML_CIB_TAG_CRMCONFIG)) {
245  local_set_name = strdup(CIB_OPTIONS_FIRST);
246 
247  } else if (safe_str_eq(node_type, XML_CIB_TAG_TICKETS)) {
248  local_set_name = crm_concat(section, XML_CIB_TAG_TICKETS, '-');
249 
250  } else if (node_uuid) {
251  local_set_name = crm_concat(section, node_uuid, '-');
252 
253  if (set_type) {
254  char *tmp_set_name = local_set_name;
255 
256  local_set_name = crm_concat(tmp_set_name, set_type, '-');
257  free(tmp_set_name);
258  }
259  } else {
260  local_set_name = crm_concat(section, "options", '-');
261  }
262  set_name = local_set_name;
263  }
264 
265  if (attr_id == NULL) {
266  int lpc = 0;
267 
268  local_attr_id = crm_concat(set_name, attr_name, '-');
269  attr_id = local_attr_id;
270 
271  /* Minimal attempt at sanitizing automatic IDs */
272  for (lpc = 0; local_attr_id[lpc] != 0; lpc++) {
273  switch (local_attr_id[lpc]) {
274  case ':':
275  local_attr_id[lpc] = '.';
276  }
277  }
278 
279  } else if (attr_name == NULL) {
280  attr_name = attr_id;
281  }
282 
283  crm_trace("Creating %s/%s", section, tag);
284  if (tag != NULL) {
285  xml_obj = create_xml_node(xml_obj, tag);
286  crm_xml_add(xml_obj, XML_ATTR_ID, node_uuid);
287  if (xml_top == NULL) {
288  xml_top = xml_obj;
289  }
290  }
291 
292  if (node_uuid == NULL && safe_str_neq(node_type, XML_CIB_TAG_TICKETS)) {
293  if (safe_str_eq(section, XML_CIB_TAG_CRMCONFIG)) {
294  xml_obj = create_xml_node(xml_obj, XML_CIB_TAG_PROPSET);
295  } else {
296  xml_obj = create_xml_node(xml_obj, XML_TAG_META_SETS);
297  }
298 
299  } else if (set_type) {
300  xml_obj = create_xml_node(xml_obj, set_type);
301 
302  } else {
303  xml_obj = create_xml_node(xml_obj, XML_TAG_ATTR_SETS);
304  }
305  crm_xml_add(xml_obj, XML_ATTR_ID, set_name);
306 
307  if (xml_top == NULL) {
308  xml_top = xml_obj;
309  }
310  }
311 
312  do_modify:
313  xml_obj = create_xml_node(xml_obj, XML_CIB_TAG_NVPAIR);
314  if (xml_top == NULL) {
315  xml_top = xml_obj;
316  }
317 
318  crm_xml_add(xml_obj, XML_ATTR_ID, attr_id);
319  crm_xml_add(xml_obj, XML_NVPAIR_ATTR_NAME, attr_name);
320  crm_xml_add(xml_obj, XML_NVPAIR_ATTR_VALUE, attr_value);
321 
322  crm_log_xml_trace(xml_top, "update_attr");
323  rc = cib_internal_op(the_cib, CIB_OP_MODIFY, NULL, section, xml_top, NULL,
324  call_options | cib_quorum_override, user_name);
325 
326  if (rc < pcmk_ok) {
327  attr_msg(LOG_ERR, "Error setting %s=%s (section=%s, set=%s): %s",
328  attr_name, attr_value, section, crm_str(set_name), pcmk_strerror(rc));
329  crm_log_xml_info(xml_top, "Update");
330  }
331 
332  free(local_set_name);
333  free(local_attr_id);
334  free_xml(xml_top);
335 
336  return rc;
337 }
338 
339 int
341  const char *section, const char *node_uuid, const char *set_type,
342  const char *set_name, const char *attr_id, const char *attr_name,
343  char **attr_value, gboolean to_console, const char *user_name)
344 {
345  int rc = pcmk_ok;
346 
347  CRM_ASSERT(attr_value != NULL);
348  CRM_CHECK(section != NULL, return -EINVAL);
349  CRM_CHECK(attr_name != NULL || attr_id != NULL, return -EINVAL);
350 
351  *attr_value = NULL;
352 
353  rc = find_nvpair_attr_delegate(the_cib, XML_NVPAIR_ATTR_VALUE, section, node_uuid, set_type,
354  set_name, attr_id, attr_name, to_console, attr_value, user_name);
355  if (rc != pcmk_ok) {
356  crm_trace("Query failed for attribute %s (section=%s, node=%s, set=%s): %s",
357  attr_name, section, crm_str(set_name), crm_str(node_uuid), pcmk_strerror(rc));
358  }
359  return rc;
360 }
361 
362 int
363 delete_attr_delegate(cib_t * the_cib, int options,
364  const char *section, const char *node_uuid, const char *set_type,
365  const char *set_name, const char *attr_id, const char *attr_name,
366  const char *attr_value, gboolean to_console, const char *user_name)
367 {
368  int rc = pcmk_ok;
369  xmlNode *xml_obj = NULL;
370  char *local_attr_id = NULL;
371 
372  CRM_CHECK(section != NULL, return -EINVAL);
373  CRM_CHECK(attr_name != NULL || attr_id != NULL, return -EINVAL);
374 
375  if (attr_id == NULL) {
376  rc = find_nvpair_attr_delegate(the_cib, XML_ATTR_ID, section, node_uuid, set_type,
377  set_name, attr_id, attr_name, to_console, &local_attr_id,
378  user_name);
379  if (rc != pcmk_ok) {
380  return rc;
381  }
382  attr_id = local_attr_id;
383  }
384 
385  xml_obj = create_xml_node(NULL, XML_CIB_TAG_NVPAIR);
386  crm_xml_add(xml_obj, XML_ATTR_ID, attr_id);
387  crm_xml_add(xml_obj, XML_NVPAIR_ATTR_NAME, attr_name);
388  crm_xml_add(xml_obj, XML_NVPAIR_ATTR_VALUE, attr_value);
389 
390  rc = cib_internal_op(the_cib, CIB_OP_DELETE, NULL, section, xml_obj, NULL,
391  options | cib_quorum_override, user_name);
392 
393  if (rc == pcmk_ok) {
394  attr_msg(LOG_DEBUG, "Deleted %s %s: id=%s%s%s%s%s\n",
395  section, node_uuid ? "attribute" : "option", local_attr_id,
396  set_name ? " set=" : "", set_name ? set_name : "",
397  attr_name ? " name=" : "", attr_name ? attr_name : "");
398  }
399 
400  free(local_attr_id);
401  free_xml(xml_obj);
402  return rc;
403 }
404 
405 static gboolean
406 found_remote_node_xpath(cib_t *the_cib, const char *xpath)
407 {
408  int rc = pcmk_ok;
409  xmlNode *xml_search = NULL;
410 
411  rc = cib_internal_op(the_cib, CIB_OP_QUERY, NULL, xpath, NULL, &xml_search,
413  free(xml_search);
414 
415  return rc == pcmk_ok ? TRUE : FALSE;
416 }
417 
418 static int
419 get_remote_node_uuid(cib_t * the_cib, const char *uname, char **uuid)
420 {
421 #define CONTAINER_REMOTE_NODE_XPATH "//" XML_CIB_TAG_NVPAIR \
422  "[@name='" XML_RSC_ATTR_REMOTE_NODE "'][@value='%s']"
423 
424 #define BAREMETAL_REMOTE_NODE_XPATH "//" XML_CIB_TAG_RESOURCE "[@type='remote'][@provider='pacemaker'][@id='%s']"
425 
426 #define ORPHAN_REMOTE_NODE_XPATH \
427  "//" XML_CIB_TAG_STATUS "//" XML_CIB_TAG_STATE \
428  "[@" XML_ATTR_UUID "='%s'][@" XML_NODE_IS_REMOTE "='true']"
429 
430  int len = 128 + strlen(uname);
431  int rc = pcmk_ok;
432  char *xpath_string = calloc(1, len);
433 
434  sprintf(xpath_string, CONTAINER_REMOTE_NODE_XPATH, uname);
435  if (found_remote_node_xpath(the_cib, xpath_string)) {
436  goto found_remote;
437  }
438 
439  sprintf(xpath_string, BAREMETAL_REMOTE_NODE_XPATH, uname);
440  if (found_remote_node_xpath(the_cib, xpath_string)) {
441  goto found_remote;
442  }
443 
444  sprintf(xpath_string, ORPHAN_REMOTE_NODE_XPATH, uname);
445  if (found_remote_node_xpath(the_cib, xpath_string)) {
446  goto found_remote;
447  }
448 
449  rc = -1;
450 found_remote:
451  if (rc == pcmk_ok) {
452  /* reuse allocation */
453  *uuid = xpath_string;
454  strcpy(*uuid, uname);
455  } else {
456  *uuid = NULL;
457  free(xpath_string);
458  }
459  return rc;
460 }
461 
462 static int
463 get_cluster_node_uuid(cib_t * the_cib, const char *uname, char **uuid)
464 {
465  int rc = pcmk_ok;
466  xmlNode *a_child = NULL;
467  xmlNode *xml_obj = NULL;
468  xmlNode *fragment = NULL;
469  const char *child_name = NULL;
470 
471  rc = the_cib->cmds->query(the_cib, XML_CIB_TAG_NODES, &fragment,
473  if (rc != pcmk_ok) {
474  return rc;
475  }
476 
477  xml_obj = fragment;
478  CRM_CHECK(safe_str_eq(crm_element_name(xml_obj), XML_CIB_TAG_NODES), return -ENOMSG);
479  CRM_ASSERT(xml_obj != NULL);
480  crm_log_xml_debug(xml_obj, "Result section");
481 
482  rc = -ENXIO;
483  *uuid = NULL;
484 
485  for (a_child = __xml_first_child(xml_obj); a_child != NULL; a_child = __xml_next(a_child)) {
486  if (crm_str_eq((const char *)a_child->name, XML_CIB_TAG_NODE, TRUE)) {
487  child_name = crm_element_value(a_child, XML_ATTR_UNAME);
488  if (safe_str_eq(uname, child_name)) {
489  child_name = ID(a_child);
490  if (child_name != NULL) {
491  *uuid = strdup(child_name);
492  rc = pcmk_ok;
493  }
494  break;
495  }
496  }
497  }
498 
499  free_xml(fragment);
500  return rc;
501 }
502 
503 int
504 query_node_uuid(cib_t * the_cib, const char *uname, char **uuid, int *is_remote_node)
505 {
506  int rc = pcmk_ok;
507 
508  CRM_ASSERT(uname != NULL);
509  CRM_ASSERT(uuid != NULL);
510 
511  rc = get_cluster_node_uuid(the_cib, uname, uuid);
512  if (rc != pcmk_ok) {
513  crm_debug("%s is not a cluster node, checking to see if remote-node", uname);
514  rc = get_remote_node_uuid(the_cib, uname, uuid);
515  if (rc != pcmk_ok) {
516  crm_debug("%s is not a remote node either", uname);
517 
518  } else if (is_remote_node) {
519  *is_remote_node = TRUE;
520  }
521  }
522 
523  if (rc != pcmk_ok) {
524  crm_debug("Could not map name=%s to a UUID: %s\n", uname, pcmk_strerror(rc));
525  } else {
526  crm_info("Mapped %s to %s", uname, *uuid);
527  }
528 
529  return rc;
530 }
531 
532 int
533 query_node_uname(cib_t * the_cib, const char *uuid, char **uname)
534 {
535  int rc = pcmk_ok;
536  xmlNode *a_child = NULL;
537  xmlNode *xml_obj = NULL;
538  xmlNode *fragment = NULL;
539  const char *child_name = NULL;
540 
541  CRM_ASSERT(uname != NULL);
542  CRM_ASSERT(uuid != NULL);
543 
544  rc = the_cib->cmds->query(the_cib, XML_CIB_TAG_NODES, &fragment,
546  if (rc != pcmk_ok) {
547  return rc;
548  }
549 
550  xml_obj = fragment;
551  CRM_CHECK(safe_str_eq(crm_element_name(xml_obj), XML_CIB_TAG_NODES), return -ENOMSG);
552  CRM_ASSERT(xml_obj != NULL);
553  crm_log_xml_trace(xml_obj, "Result section");
554 
555  rc = -ENXIO;
556  *uname = NULL;
557 
558  for (a_child = __xml_first_child(xml_obj); a_child != NULL; a_child = __xml_next(a_child)) {
559  if (crm_str_eq((const char *)a_child->name, XML_CIB_TAG_NODE, TRUE)) {
560  child_name = ID(a_child);
561  if (safe_str_eq(uuid, child_name)) {
562  child_name = crm_element_value(a_child, XML_ATTR_UNAME);
563  if (child_name != NULL) {
564  *uname = strdup(child_name);
565  rc = pcmk_ok;
566  }
567  break;
568  }
569  }
570  }
571 
572  free_xml(fragment);
573  return rc;
574 }
575 
576 int
577 set_standby(cib_t * the_cib, const char *uuid, const char *scope, const char *standby_value)
578 {
579  int rc = pcmk_ok;
580  char *attr_id = NULL;
581 
582  CRM_CHECK(uuid != NULL, return -EINVAL);
583  CRM_CHECK(standby_value != NULL, return -EINVAL);
584 
585  if (safe_str_eq(scope, "reboot") || safe_str_eq(scope, XML_CIB_TAG_STATUS)) {
586  scope = XML_CIB_TAG_STATUS;
587  attr_id = crm_strdup_printf("transient-standby-%.256s", uuid);
588 
589  } else {
590  scope = XML_CIB_TAG_NODES;
591  attr_id = crm_strdup_printf("standby-%.256s", uuid);
592  }
593 
594  rc = update_attr_delegate(the_cib, cib_sync_call, scope, uuid, NULL, NULL,
595  attr_id, "standby", standby_value, TRUE, NULL, NULL);
596 
597  free(attr_id);
598  return rc;
599 }
int(* query)(cib_t *cib, const char *section, xmlNode **output_data, int call_options)
Definition: cib.h:107
#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:340
A dumping ground.
gboolean safe_str_neq(const char *a, const char *b)
Definition: utils.c:668
gboolean is_remote_node(node_t *node)
Definition: utils.c:2061
#define XML_ATTR_TYPE
Definition: msg_xml.h:103
const char * pcmk_strerror(int rc)
Definition: logging.c:1113
int set_standby(cib_t *the_cib, const char *uuid, const char *scope, const char *standby_value)
Definition: cib_attrs.c:577
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:172
#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:363
#define XML_TAG_TRANSIENT_NODEATTRS
Definition: msg_xml.h:352
const char * get_object_path(const char *object_type)
Definition: cib_utils.c:201
#define XML_NVPAIR_ATTR_NAME
Definition: msg_xml.h:333
#define ORPHAN_REMOTE_NODE_XPATH
#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:170
#define XML_CIB_TAG_NODES
Definition: msg_xml.h:158
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
#define XML_CIB_TAG_PROPSET
Definition: msg_xml.h:172
#define XML_TAG_ATTR_SETS
Definition: msg_xml.h:173
char uname[MAX_NAME]
Definition: internal.h:53
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:100
#define XML_CIB_TAG_STATE
Definition: msg_xml.h:166
#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:39
#define XML_TAG_META_SETS
Definition: msg_xml.h:174
Wrappers for and extensions to libxml2.
#define XML_ATTR_UNAME
Definition: msg_xml.h:128
xmlNode * create_xml_node(xmlNode *parent, const char *name)
Definition: xml.c:2793
const char * crm_element_value(xmlNode *data, const char *name)
Definition: xml.c:5839
int query_node_uuid(cib_t *the_cib, const char *uname, char **uuid, int *is_remote_node)
Definition: cib_attrs.c:504
#define CIB_OPTIONS_FIRST
Definition: msg_xml.h:53
void free_xml(xmlNode *child)
Definition: xml.c:2848
gboolean xml_has_children(const xmlNode *root)
Definition: xml.c:3997
gboolean crm_str_eq(const char *a, const char *b, gboolean use_case)
Definition: utils.c:1415
#define XML_CIB_TAG_NODE
Definition: msg_xml.h:167
const char * crm_xml_add(xmlNode *node, const char *name, const char *value)
Definition: xml.c:2695
#define BAREMETAL_REMOTE_NODE_XPATH
#define ENOTUNIQ
Definition: portability.h:227
#define XML_CIB_TAG_CRMCONFIG
Definition: msg_xml.h:161
#define XML_CIB_TAG_RSCCONFIG
Definition: msg_xml.h:163
#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:334
#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:156
#define crm_log_xml_trace(xml, text)
Definition: logging.h:262
char * crm_concat(const char *prefix, const char *suffix, char join)
Definition: utils.c:403
#define ID(x)
Definition: msg_xml.h:408
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:818
#define safe_str_eq(a, b)
Definition: util.h:74
int query_node_uname(cib_t *the_cib, const char *uuid, char **uname)
Definition: cib_attrs.c:533
char * crm_strdup_printf(char const *format,...) __attribute__((__format__(__printf__
#define XML_CIB_TAG_OPCONFIG
Definition: msg_xml.h:162
#define XML_CIB_TAG_TICKETS
Definition: msg_xml.h:375
#define crm_info(fmt, args...)
Definition: logging.h:251
Definition: cib.h:148
#define CONTAINER_REMOTE_NODE_XPATH