Hi, Andrew I made a patch to revise an attribute information indication function of crm_mon.
The following is a revision point. - I sort the attribute information indication of the node in ascending order and display it. - A state does not display the attribute information of the node of OFFLINE. I want you to merge it into Pacemaker-1.1 Best Regards, Yuusuke IIDA -- ---------------------------------------- METRO SYSTEMS CO., LTD YuusukeIida Mail: iiday...@intellilink.co.jp ----------------------------------------
diff -r 28ce43d5212d tools/crm_mon.c --- a/tools/crm_mon.c Fri Aug 20 14:27:59 2010 +0800 +++ b/tools/crm_mon.c Wed Aug 25 11:43:11 2010 +0900 @@ -67,6 +67,7 @@ gboolean daemonize = FALSE; GMainLoop *mainloop = NULL; guint timer_id = 0; +GList *attr_list = NULL; const char *crm_mail_host = NULL; const char *crm_mail_prefix = NULL; @@ -796,11 +797,23 @@ ); } -static void print_node_attribute(gpointer name, gpointer value, gpointer node_data) +static int +compare_attribute(gconstpointer a, gconstpointer b) +{ + int rc; + + rc = strcmp((const char*)a, (const char*)b); + + return rc; +} + +static void +create_attr_list(gpointer name, gpointer value, gpointer data) { int i; - node_t *node = (node_t *)node_data; const char *filt_str[] = FILTER_STR; + + CRM_CHECK(name != NULL, return); /* filtering automatic attributes */ for(i = 0; filt_str[i] != NULL; i++) { @@ -808,7 +821,18 @@ return; } } - print_as(" + %-32s\t: %-10s", (char *)name, (char *)value); + + attr_list = g_list_insert_sorted(attr_list, name, compare_attribute); +} + +static void +print_node_attribute(gpointer name, gpointer node_data) +{ + const char *value = NULL; + node_t *node = (node_t *)node_data; + + value = g_hash_table_lookup(node->details->attrs, name); + print_as(" + %-32s\t: %-10s", (char *)name, value); print_attr_msg(node, node->details->running_rsc, name, value); print_as("\n"); } @@ -1051,8 +1075,13 @@ print_as("\nNode Attributes:\n"); slist_iter( node, node_t, data_set->nodes, lpc, + if(node == NULL || node->details->online == FALSE){ + continue; + } + attr_list = NULL; print_as("* Node %s:\n", node->details->uname); - g_hash_table_foreach(node->details->attrs, print_node_attribute, node); + g_hash_table_foreach(node->details->attrs, create_attr_list, NULL); + g_list_foreach(attr_list, print_node_attribute, node); ); }
_______________________________________________ Pacemaker mailing list: Pacemaker@oss.clusterlabs.org http://oss.clusterlabs.org/mailman/listinfo/pacemaker Project Home: http://www.clusterlabs.org Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf Bugs: http://developerbugs.linux-foundation.org/enter_bug.cgi?product=Pacemaker