pacemaker  1.1.16-94ff4df
Scalable High-Availability cluster resource manager
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules
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  int lpc = 0;
270 
271  local_attr_id = crm_concat(set_name, attr_name, '-');
272  attr_id = local_attr_id;
273 
274  /* Minimal attempt at sanitizing automatic IDs */
275  for (lpc = 0; local_attr_id[lpc] != 0; lpc++) {
276  switch (local_attr_id[lpc]) {
277  case ':':
278  local_attr_id[lpc] = '.';
279  }
280  }
281 
282  } else if (attr_name == NULL) {
283  attr_name = attr_id;
284  }
285 
286  crm_trace("Creating %s/%s", section, tag);
287  if (tag != NULL) {
288  xml_obj = create_xml_node(xml_obj, tag);
289  crm_xml_add(xml_obj, XML_ATTR_ID, node_uuid);
290  if (xml_top == NULL) {
291  xml_top = xml_obj;
292  }
293  }
294 
295  if (node_uuid == NULL && safe_str_neq(node_type, XML_CIB_TAG_TICKETS)) {
296  if (safe_str_eq(section, XML_CIB_TAG_CRMCONFIG)) {
297  xml_obj = create_xml_node(xml_obj, XML_CIB_TAG_PROPSET);
298  } else {
299  xml_obj = create_xml_node(xml_obj, XML_TAG_META_SETS);
300  }
301 
302  } else if (set_type) {
303  xml_obj = create_xml_node(xml_obj, set_type);
304 
305  } else {
306  xml_obj = create_xml_node(xml_obj, XML_TAG_ATTR_SETS);
307  }
308  crm_xml_add(xml_obj, XML_ATTR_ID, set_name);
309 
310  if (xml_top == NULL) {
311  xml_top = xml_obj;
312  }
313  }
314 
315  do_modify:
316  xml_obj = create_xml_node(xml_obj, XML_CIB_TAG_NVPAIR);
317  if (xml_top == NULL) {
318  xml_top = xml_obj;
319  }
320 
321  crm_xml_add(xml_obj, XML_ATTR_ID, attr_id);
322  crm_xml_add(xml_obj, XML_NVPAIR_ATTR_NAME, attr_name);
323  crm_xml_add(xml_obj, XML_NVPAIR_ATTR_VALUE, attr_value);
324 
325  crm_log_xml_trace(xml_top, "update_attr");
326  rc = cib_internal_op(the_cib, CIB_OP_MODIFY, NULL, section, xml_top, NULL,
327  call_options | cib_quorum_override, user_name);
328 
329  if (rc < pcmk_ok) {
330  attr_msg(LOG_ERR, "Error setting %s=%s (section=%s, set=%s): %s",
331  attr_name, attr_value, section, crm_str(set_name), pcmk_strerror(rc));
332  crm_log_xml_info(xml_top, "Update");
333  }
334 
335  free(local_set_name);
336  free(local_attr_id);
337  free_xml(xml_top);
338 
339  return rc;
340 }
341 
342 int
344  const char *section, const char *node_uuid, const char *set_type,
345  const char *set_name, const char *attr_id, const char *attr_name,
346  char **attr_value, gboolean to_console, const char *user_name)
347 {
348  int rc = pcmk_ok;
349 
350  CRM_ASSERT(attr_value != NULL);
351  CRM_CHECK(section != NULL, return -EINVAL);
352  CRM_CHECK(attr_name != NULL || attr_id != NULL, return -EINVAL);
353 
354  *attr_value = NULL;
355 
356  rc = find_nvpair_attr_delegate(the_cib, XML_NVPAIR_ATTR_VALUE, section, node_uuid, set_type,
357  set_name, attr_id, attr_name, to_console, attr_value, user_name);
358  if (rc != pcmk_ok) {
359  crm_trace("Query failed for attribute %s (section=%s, node=%s, set=%s): %s",
360  attr_name, section, crm_str(set_name), crm_str(node_uuid), pcmk_strerror(rc));
361  }
362  return rc;
363 }
364 
365 int
366 delete_attr_delegate(cib_t * the_cib, int options,
367  const char *section, const char *node_uuid, const char *set_type,
368  const char *set_name, const char *attr_id, const char *attr_name,
369  const char *attr_value, gboolean to_console, const char *user_name)
370 {
371  int rc = pcmk_ok;
372  xmlNode *xml_obj = NULL;
373  char *local_attr_id = NULL;
374 
375  CRM_CHECK(section != NULL, return -EINVAL);
376  CRM_CHECK(attr_name != NULL || attr_id != NULL, return -EINVAL);
377 
378  if (attr_id == NULL) {
379  rc = find_nvpair_attr_delegate(the_cib, XML_ATTR_ID, section, node_uuid, set_type,
380  set_name, attr_id, attr_name, to_console, &local_attr_id,
381  user_name);
382  if (rc != pcmk_ok) {
383  return rc;
384  }
385  attr_id = local_attr_id;
386  }
387 
388  xml_obj = create_xml_node(NULL, XML_CIB_TAG_NVPAIR);
389  crm_xml_add(xml_obj, XML_ATTR_ID, attr_id);
390  crm_xml_add(xml_obj, XML_NVPAIR_ATTR_NAME, attr_name);
391  crm_xml_add(xml_obj, XML_NVPAIR_ATTR_VALUE, attr_value);
392 
393  rc = cib_internal_op(the_cib, CIB_OP_DELETE, NULL, section, xml_obj, NULL,
394  options | cib_quorum_override, user_name);
395 
396  if (rc == pcmk_ok) {
397  attr_msg(LOG_DEBUG, "Deleted %s %s: id=%s%s%s%s%s\n",
398  section, node_uuid ? "attribute" : "option", local_attr_id,
399  set_name ? " set=" : "", set_name ? set_name : "",
400  attr_name ? " name=" : "", attr_name ? attr_name : "");
401  }
402 
403  free(local_attr_id);
404  free_xml(xml_obj);
405  return rc;
406 }
407 
408 static gboolean
409 found_remote_node_xpath(cib_t *the_cib, const char *xpath)
410 {
411  int rc = pcmk_ok;
412  xmlNode *xml_search = NULL;
413 
414  rc = cib_internal_op(the_cib, CIB_OP_QUERY, NULL, xpath, NULL, &xml_search,
416  free(xml_search);
417 
418  return rc == pcmk_ok ? TRUE : FALSE;
419 }
420 
421 static int
422 get_remote_node_uuid(cib_t * the_cib, const char *uname, char **uuid)
423 {
424 #define CONTAINER_REMOTE_NODE_XPATH "//" XML_CIB_TAG_NVPAIR \
425  "[@name='" XML_RSC_ATTR_REMOTE_NODE "'][@value='%s']"
426 
427 #define BAREMETAL_REMOTE_NODE_XPATH "//" XML_CIB_TAG_RESOURCE "[@type='remote'][@provider='pacemaker'][@id='%s']"
428 
429 #define ORPHAN_REMOTE_NODE_XPATH \
430  "//" XML_CIB_TAG_STATUS "//" XML_CIB_TAG_STATE \
431  "[@" XML_ATTR_UUID "='%s'][@" XML_NODE_IS_REMOTE "='true']"
432 
433  int len = 128 + strlen(uname);
434  int rc = pcmk_ok;
435  char *xpath_string = calloc(1, len);
436 
437  sprintf(xpath_string, CONTAINER_REMOTE_NODE_XPATH, uname);
438  if (found_remote_node_xpath(the_cib, xpath_string)) {
439  goto found_remote;
440  }
441 
442  sprintf(xpath_string, BAREMETAL_REMOTE_NODE_XPATH, uname);
443  if (found_remote_node_xpath(the_cib, xpath_string)) {
444  goto found_remote;
445  }
446 
447  sprintf(xpath_string, ORPHAN_REMOTE_NODE_XPATH, uname);
448  if (found_remote_node_xpath(the_cib, xpath_string)) {
449  goto found_remote;
450  }
451 
452  rc = -1;
453 found_remote:
454  if (rc == pcmk_ok) {
455  /* reuse allocation */
456  *uuid = xpath_string;
457  strcpy(*uuid, uname);
458  } else {
459  *uuid = NULL;
460  free(xpath_string);
461  }
462  return rc;
463 }
464 
465 static int
466 get_cluster_node_uuid(cib_t * the_cib, const char *uname, char **uuid)
467 {
468  int rc = pcmk_ok;
469  xmlNode *a_child = NULL;
470  xmlNode *xml_obj = NULL;
471  xmlNode *fragment = NULL;
472  const char *child_name = NULL;
473 
474  rc = the_cib->cmds->query(the_cib, XML_CIB_TAG_NODES, &fragment,
476  if (rc != pcmk_ok) {
477  return rc;
478  }
479 
480  xml_obj = fragment;
481  CRM_CHECK(safe_str_eq(crm_element_name(xml_obj), XML_CIB_TAG_NODES), return -ENOMSG);
482  CRM_ASSERT(xml_obj != NULL);
483  crm_log_xml_debug(xml_obj, "Result section");
484 
485  rc = -ENXIO;
486  *uuid = NULL;
487 
488  for (a_child = __xml_first_child(xml_obj); a_child != NULL; a_child = __xml_next(a_child)) {
489  if (crm_str_eq((const char *)a_child->name, XML_CIB_TAG_NODE, TRUE)) {
490  const char *node_type = crm_element_value(a_child, XML_ATTR_TYPE);
491  /* Only if it's a cluster node */
492  if (safe_str_eq(node_type, "remote")) {
493  continue;
494  }
495 
496  child_name = crm_element_value(a_child, XML_ATTR_UNAME);
497  if (safe_str_eq(uname, child_name)) {
498  child_name = ID(a_child);
499  if (child_name != NULL) {
500  *uuid = strdup(child_name);
501  rc = pcmk_ok;
502  }
503  break;
504  }
505  }
506  }
507 
508  free_xml(fragment);
509  return rc;
510 }
511 
512 int
513 query_node_uuid(cib_t * the_cib, const char *uname, char **uuid, int *is_remote_node)
514 {
515  int rc = pcmk_ok;
516 
517  CRM_ASSERT(uname != NULL);
518  CRM_ASSERT(uuid != NULL);
519 
520  if (is_remote_node) {
521  *is_remote_node = FALSE;
522  }
523 
524  rc = get_cluster_node_uuid(the_cib, uname, uuid);
525  if (rc != pcmk_ok) {
526  crm_debug("%s is not a cluster node, checking to see if remote-node", uname);
527  rc = get_remote_node_uuid(the_cib, uname, uuid);
528  if (rc != pcmk_ok) {
529  crm_debug("%s is not a remote node either", uname);
530 
531  } else if (is_remote_node) {
532  *is_remote_node = TRUE;
533  }
534  }
535 
536  if (rc != pcmk_ok) {
537  crm_debug("Could not map name=%s to a UUID: %s", uname, pcmk_strerror(rc));
538  } else {
539  crm_info("Mapped %s to %s", uname, *uuid);
540  }
541 
542  return rc;
543 }
544 
545 int
546 query_node_uname(cib_t * the_cib, const char *uuid, char **uname)
547 {
548  int rc = pcmk_ok;
549  xmlNode *a_child = NULL;
550  xmlNode *xml_obj = NULL;
551  xmlNode *fragment = NULL;
552  const char *child_name = NULL;
553 
554  CRM_ASSERT(uname != NULL);
555  CRM_ASSERT(uuid != NULL);
556 
557  rc = the_cib->cmds->query(the_cib, XML_CIB_TAG_NODES, &fragment,
559  if (rc != pcmk_ok) {
560  return rc;
561  }
562 
563  xml_obj = fragment;
564  CRM_CHECK(safe_str_eq(crm_element_name(xml_obj), XML_CIB_TAG_NODES), return -ENOMSG);
565  CRM_ASSERT(xml_obj != NULL);
566  crm_log_xml_trace(xml_obj, "Result section");
567 
568  rc = -ENXIO;
569  *uname = NULL;
570 
571  for (a_child = __xml_first_child(xml_obj); a_child != NULL; a_child = __xml_next(a_child)) {
572  if (crm_str_eq((const char *)a_child->name, XML_CIB_TAG_NODE, TRUE)) {
573  child_name = ID(a_child);
574  if (safe_str_eq(uuid, child_name)) {
575  child_name = crm_element_value(a_child, XML_ATTR_UNAME);
576  if (child_name != NULL) {
577  *uname = strdup(child_name);
578  rc = pcmk_ok;
579  }
580  break;
581  }
582  }
583  }
584 
585  free_xml(fragment);
586  return rc;
587 }
588 
589 int
590 set_standby(cib_t * the_cib, const char *uuid, const char *scope, const char *standby_value)
591 {
592  int rc = pcmk_ok;
593  char *attr_id = NULL;
594 
595  CRM_CHECK(uuid != NULL, return -EINVAL);
596  CRM_CHECK(standby_value != NULL, return -EINVAL);
597 
598  if (safe_str_eq(scope, "reboot") || safe_str_eq(scope, XML_CIB_TAG_STATUS)) {
599  scope = XML_CIB_TAG_STATUS;
600  attr_id = crm_strdup_printf("transient-standby-%.256s", uuid);
601 
602  } else {
603  scope = XML_CIB_TAG_NODES;
604  attr_id = crm_strdup_printf("standby-%.256s", uuid);
605  }
606 
607  rc = update_attr_delegate(the_cib, cib_sync_call, scope, uuid, NULL, NULL,
608  attr_id, "standby", standby_value, TRUE, NULL, NULL);
609 
610  free(attr_id);
611  return rc;
612 }
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:343
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:103
const char * pcmk_strerror(int rc)
Definition: logging.c:1128
int set_standby(cib_t *the_cib, const char *uuid, const char *scope, const char *standby_value)
Definition: cib_attrs.c:590
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:366
#define XML_TAG_TRANSIENT_NODEATTRS
Definition: msg_xml.h:367
const char * get_object_path(const char *object_type)
Definition: cib_utils.c:201
#define XML_NVPAIR_ATTR_NAME
Definition: msg_xml.h:343
#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:173
#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:175
#define XML_TAG_ATTR_SETS
Definition: msg_xml.h:176
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:100
#define XML_CIB_TAG_STATE
Definition: msg_xml.h:169
#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:177
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:2532
const char * crm_element_value(xmlNode *data, const char *name)
Definition: xml.c:4987
int query_node_uuid(cib_t *the_cib, const char *uname, char **uuid, int *is_remote_node)
Definition: cib_attrs.c:513
#define CIB_OPTIONS_FIRST
Definition: msg_xml.h:53
void free_xml(xmlNode *child)
Definition: xml.c:2587
gboolean xml_has_children(const xmlNode *root)
Definition: xml.c:3736
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:170
const char * crm_xml_add(xmlNode *node, const char *name, const char *value)
Definition: xml.c:2434
#define crm_perror(level, fmt, args...)
Log a system error message.
Definition: logging.h:226
#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:344
#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: strings.c:32
#define ID(x)
Definition: msg_xml.h:423
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:63
int query_node_uname(cib_t *the_cib, const char *uuid, char **uname)
Definition: cib_attrs.c:546
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:390
#define crm_info(fmt, args...)
Definition: logging.h:251
Definition: cib.h:148
#define CONTAINER_REMOTE_NODE_XPATH