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

Function native_print

lib/pengine/native.c:319–489  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

317}
318
319void
320native_print(resource_t * rsc, const char *pre_text, long options, void *print_data)
321{
322 node_t *node = NULL;
323 const char *prov = NULL;
324 const char *class = crm_element_value(rsc->xml, XML_AGENT_ATTR_CLASS);
325
326 if (pre_text == NULL && (options & pe_print_printf)) {
327 pre_text = " ";
328 }
329
330 if (options & pe_print_xml) {
331 native_print_xml(rsc, pre_text, options, print_data);
332 return;
333 }
334
335 if (safe_str_eq(class, "ocf")) {
336 prov = crm_element_value(rsc->xml, XML_AGENT_ATTR_PROVIDER);
337 }
338
339 if (rsc->running_on != NULL) {
340 node = rsc->running_on->data;
341 }
342
343 if (options & pe_print_html) {
344 if (is_not_set(rsc->flags, pe_rsc_managed)) {
345 status_print("<font color=\"yellow\">");
346
347 } else if (is_set(rsc->flags, pe_rsc_failed)) {
348 status_print("<font color=\"red\">");
349
350 } else if (rsc->variant == pe_native && g_list_length(rsc->running_on) == 0) {
351 status_print("<font color=\"red\">");
352
353 } else if (g_list_length(rsc->running_on) > 1) {
354 status_print("<font color=\"orange\">");
355
356 } else if (is_set(rsc->flags, pe_rsc_failure_ignored)) {
357 status_print("<font color=\"yellow\">");
358
359 } else {
360 status_print("<font color=\"green\">");
361 }
362 }
363
364 if ((options & pe_print_rsconly) || g_list_length(rsc->running_on) > 1) {
365 const char *desc = NULL;
366
367 desc = crm_element_value(rsc->xml, XML_ATTR_DESC);
368 status_print("%s%s\t(%s%s%s:%s%s):\t%s %s%s%s%s%s",
369 pre_text ? pre_text : "", rsc->id,
370 class, prov ? "::" : "", prov ? prov : "",
371 crm_element_value(rsc->xml, XML_ATTR_TYPE),
372 is_set(rsc->flags, pe_rsc_orphan) ? " ORPHANED" : "",
373 (rsc->variant != pe_native) ? "" : role2text(rsc->role),
374 is_set(rsc->flags, pe_rsc_managed) ? "" : "(unmanaged) ",
375 is_set(rsc->flags, pe_rsc_failed) ? "FAILED " : "",
376 is_set(rsc->flags, pe_rsc_failure_ignored) ? "(failure ignored) " : "",

Callers

nothing calls this directly

Calls 8

crm_element_valueFunction · 0.85
native_print_xmlFunction · 0.85
is_not_setFunction · 0.85
is_setFunction · 0.85
role2textFunction · 0.85
g_hash_table_iter_initFunction · 0.85
g_hash_table_iter_nextFunction · 0.85
print_nodeFunction · 0.85

Tested by

no test coverage detected