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

Function do_work

tools/crmadmin.c:252–386  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

250}
251
252int
253do_work(void)
254{
255 int ret = 1;
256
257 /* construct the request */
258 xmlNode *msg_data = NULL;
259 gboolean all_is_good = TRUE;
260
261 msg_options = create_xml_node(NULL, XML_TAG_OPTIONS);
262 crm_xml_add(msg_options, XML_ATTR_VERBOSE, admin_verbose);
263 crm_xml_add(msg_options, XML_ATTR_TIMEOUT, "0");
264
265 if (DO_HEALTH == TRUE) {
266 crm_trace("Querying the system");
267
268 sys_to = CRM_SYSTEM_DC;
269
270 if (dest_node != NULL) {
271 sys_to = CRM_SYSTEM_CRMD;
272 crmd_operation = CRM_OP_PING;
273
274 if (BE_VERBOSE) {
275 expected_responses = 1;
276 }
277
278 crm_xml_add(msg_options, XML_ATTR_TIMEOUT, "0");
279
280 } else {
281 crm_info("Cluster-wide health not available yet");
282 all_is_good = FALSE;
283 }
284
285 } else if (DO_ELECT_DC) {
286 /* tell the local node to initiate an election */
287
288 dest_node = NULL;
289 sys_to = CRM_SYSTEM_CRMD;
290 crmd_operation = CRM_OP_VOTE;
291
292 crm_xml_add(msg_options, XML_ATTR_TIMEOUT, "0");
293 ret = 0; /* no return message */
294
295 } else if (DO_WHOIS_DC) {
296 dest_node = NULL;
297 sys_to = CRM_SYSTEM_DC;
298 crmd_operation = CRM_OP_PING;
299 crm_xml_add(msg_options, XML_ATTR_TIMEOUT, "0");
300
301
302 } else if (DO_NODE_LIST) {
303
304 cib_t *the_cib = cib_new();
305 xmlNode *output = NULL;
306
307 int rc = the_cib->cmds->signon(the_cib, crm_system_name, cib_command);
308
309 if (rc != pcmk_ok) {

Callers 1

mainFunction · 0.70

Calls 8

create_xml_nodeFunction · 0.85
crm_xml_addFunction · 0.85
cib_newFunction · 0.85
get_cib_copyFunction · 0.85
do_find_node_listFunction · 0.85
free_xmlFunction · 0.85
crm_exitFunction · 0.85
crm_ipc_sendFunction · 0.85

Tested by

no test coverage detected