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

Function list_resource_operations

tools/crm_resource.c:957–992  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

955}
956
957static int
958list_resource_operations(const char *rsc_id, const char *host_uname, gboolean active,
959 pe_working_set_t * data_set)
960{
961 resource_t *rsc = NULL;
962 int opts = pe_print_printf | pe_print_rsconly | pe_print_suppres_nl;
963 GListPtr ops = find_operations(rsc_id, host_uname, active, data_set);
964 GListPtr lpc = NULL;
965
966 for (lpc = ops; lpc != NULL; lpc = lpc->next) {
967 xmlNode *xml_op = (xmlNode *) lpc->data;
968
969 const char *op_rsc = crm_element_value(xml_op, "resource");
970 const char *last = crm_element_value(xml_op, "last_run");
971 const char *status_s = crm_element_value(xml_op, XML_LRM_ATTR_OPSTATUS);
972 const char *op_key = crm_element_value(xml_op, XML_LRM_ATTR_TASK_KEY);
973 int status = crm_parse_int(status_s, "0");
974
975 rsc = pe_find_resource(data_set->resources, op_rsc);
976 rsc->fns->print(rsc, "", opts, stdout);
977
978 fprintf(stdout, ": %s (node=%s, call=%s, rc=%s",
979 op_key ? op_key : ID(xml_op),
980 crm_element_value(xml_op, XML_ATTR_UNAME),
981 crm_element_value(xml_op, XML_LRM_ATTR_CALLID),
982 crm_element_value(xml_op, XML_LRM_ATTR_RC));
983 if (last) {
984 time_t run_at = crm_parse_int(last, "0");
985
986 fprintf(stdout, ", last-run=%s, exec=%sms\n",
987 ctime(&run_at), crm_element_value(xml_op, "exec_time"));
988 }
989 fprintf(stdout, "): %s\n", services_lrm_status_str(status));
990 }
991 return pcmk_ok;
992}
993
994#include "../pengine/pengine.h"
995

Callers 1

mainFunction · 0.85

Calls 5

find_operationsFunction · 0.85
crm_element_valueFunction · 0.85
crm_parse_intFunction · 0.85
pe_find_resourceFunction · 0.85
services_lrm_status_strFunction · 0.85

Tested by

no test coverage detected