Skip to content

Commit

Permalink
Merge pull request #668 from kgaillot/mon
Browse files Browse the repository at this point in the history
Improvements to crm_mon output
  • Loading branch information
beekhof committed Mar 25, 2015
2 parents fe7503a + b2ae244 commit c0f6394
Show file tree
Hide file tree
Showing 3 changed files with 193 additions and 110 deletions.
1 change: 1 addition & 0 deletions include/crm/pengine/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ enum pe_print_options {
pe_print_brief = 0x0800,
pe_print_pending = 0x1000,
pe_print_clone_details = 0x2000,
pe_print_clone_active = 0x4000, /* print clone instances only if active */
};
/* *INDENT-ON* */

Expand Down
48 changes: 25 additions & 23 deletions lib/pengine/clone.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,8 @@ clone_print(resource_t * rsc, const char *pre_text, long options, void *print_da

} else if (is_set(rsc->flags, pe_rsc_unique)) {
print_full = TRUE;
} else {

} else if (is_not_set(options, pe_print_clone_active)) {
stopped_list = add_list_element(stopped_list, child_rsc->id);
}

Expand Down Expand Up @@ -508,37 +509,38 @@ clone_print(resource_t * rsc, const char *pre_text, long options, void *print_da
free(list_text);
list_text = NULL;

/* Stopped */
if(is_not_set(rsc->flags, pe_rsc_unique)
&& (clone_data->clone_max > active_instances)) {
if (is_not_set(options, pe_print_clone_active)) {
/* Stopped */
if (is_not_set(rsc->flags, pe_rsc_unique)
&& (clone_data->clone_max > active_instances)) {

GListPtr nIter;
GListPtr list = g_hash_table_get_values(rsc->allowed_nodes);
GListPtr nIter;
GListPtr list = g_hash_table_get_values(rsc->allowed_nodes);

/* Custom stopped list for non-unique clones */
free(stopped_list); stopped_list = NULL;
/* Custom stopped list for non-unique clones */
free(stopped_list); stopped_list = NULL;

if(g_list_length(list) == 0) {
/* Clusters with symmetrical=false haven't calculated allowed_nodes yet
* If we've not probed for them yet, the Stopped list will be empty
*/
list = g_hash_table_get_values(rsc->known_on);
}
if (g_list_length(list) == 0) {
/* Clusters with symmetrical=false haven't calculated allowed_nodes yet
* If we've not probed for them yet, the Stopped list will be empty
*/
list = g_hash_table_get_values(rsc->known_on);
}

list = g_list_sort(list, sort_node_uname);
for (nIter = list; nIter != NULL; nIter = nIter->next) {
node_t *node = (node_t *)nIter->data;
list = g_list_sort(list, sort_node_uname);
for (nIter = list; nIter != NULL; nIter = nIter->next) {
node_t *node = (node_t *)nIter->data;

if(pe_find_node(rsc->running_on, node->details->uname) == NULL) {
stopped_list = add_list_element(stopped_list, node->details->uname);
if (pe_find_node(rsc->running_on, node->details->uname) == NULL) {
stopped_list = add_list_element(stopped_list, node->details->uname);
}
}
g_list_free(list);
}
g_list_free(list);
short_print(stopped_list, child_text, "Stopped", options, print_data);
free(stopped_list);
}

short_print(stopped_list, child_text, "Stopped", options, print_data);
free(stopped_list);

if (options & pe_print_html) {
status_print("</ul>\n");
}
Expand Down
Loading

0 comments on commit c0f6394

Please sign in to comment.