MCPcopy Create free account
hub / github.com/ClusterLabs/pacemaker / do_work

Function do_work

tools/cibadmin.c:528–562  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

526}
527
528int
529do_work(xmlNode * input, int call_options, xmlNode ** output)
530{
531 /* construct the request */
532 the_cib->call_timeout = message_timeout_ms;
533 if (strcasecmp(CIB_OP_REPLACE, cib_action) == 0
534 && safe_str_eq(crm_element_name(input), XML_TAG_CIB)) {
535 xmlNode *status = get_object_root(XML_CIB_TAG_STATUS, input);
536
537 if (status == NULL) {
538 create_xml_node(input, XML_CIB_TAG_STATUS);
539 }
540 }
541
542 if (strcasecmp(CIB_OP_SYNC, cib_action) == 0) {
543 crm_trace("Performing %s op...", cib_action);
544 return the_cib->cmds->sync_from(the_cib, host, obj_type, call_options);
545
546 } else if (strcasecmp(CIB_OP_SLAVE, cib_action) == 0 && (call_options ^ cib_scope_local)) {
547 crm_trace("Performing %s op on all nodes...", cib_action);
548 return the_cib->cmds->set_slave_all(the_cib, call_options);
549
550 } else if (strcasecmp(CIB_OP_MASTER, cib_action) == 0) {
551 crm_trace("Performing %s op on all nodes...", cib_action);
552 return the_cib->cmds->set_master(the_cib, call_options);
553
554 } else if (cib_action != NULL) {
555 crm_trace("Passing \"%s\" to variant_op...", cib_action);
556 return cib_internal_op(the_cib, cib_action, host, obj_type, input, output, call_options, NULL);
557
558 } else {
559 crm_err("You must specify an operation");
560 }
561 return -EINVAL;
562}
563
564int
565do_init(void)

Callers 1

mainFunction · 0.70

Calls 3

get_object_rootFunction · 0.85
create_xml_nodeFunction · 0.85
cib_internal_opFunction · 0.85

Tested by

no test coverage detected