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

Function print_attr_msg

tools/crm_mon.c:846–890  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

844}
845
846static void
847print_attr_msg(node_t * node, GListPtr rsc_list, const char *attrname, const char *attrvalue)
848{
849 GListPtr gIter = NULL;
850
851 for (gIter = rsc_list; gIter != NULL; gIter = gIter->next) {
852 resource_t *rsc = (resource_t *) gIter->data;
853 const char *type = g_hash_table_lookup(rsc->meta, "type");
854
855 if (rsc->children != NULL) {
856 print_attr_msg(node, rsc->children, attrname, attrvalue);
857 }
858
859 if (safe_str_eq(type, "ping") || safe_str_eq(type, "pingd")) {
860 const char *name = "pingd";
861 const char *multiplier = NULL;
862 char **host_list = NULL;
863 int host_list_num = 0;
864 int expected_score = 0;
865
866 if (g_hash_table_lookup(rsc->meta, "name") != NULL) {
867 name = g_hash_table_lookup(rsc->meta, "name");
868 }
869
870 /* To identify the resource with the attribute name. */
871 if (safe_str_eq(name, attrname)) {
872 int value = crm_parse_int(attrvalue, "0");
873
874 multiplier = g_hash_table_lookup(rsc->meta, "multiplier");
875 host_list = g_strsplit(g_hash_table_lookup(rsc->meta, "host_list"), " ", 0);
876 host_list_num = g_strv_length(host_list);
877 g_strfreev(host_list);
878 /* pingd multiplier is the same as the default value. */
879 expected_score = host_list_num * crm_parse_int(multiplier, "1");
880
881 /* pingd is abnormal score. */
882 if (value <= 0) {
883 print_as("\t: Connectivity is lost");
884 } else if (value < expected_score) {
885 print_as("\t: Connectivity is degraded (Expected=%d)", expected_score);
886 }
887 }
888 }
889 }
890}
891
892static int
893compare_attribute(gconstpointer a, gconstpointer b)

Callers 1

print_node_attributeFunction · 0.85

Calls 1

crm_parse_intFunction · 0.85

Tested by

no test coverage detected