FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Cluster Development

 
 
LinkBack Thread Tools
 
Old 01-12-2011, 03:44 PM
Lon Hohberger
 
Default rgmanager: Present flags in clustat output

This is a clean cherry-pick in to the RHEL6 branch

Resolves: rhbz#634298

Signed-off-by: Lon Hohberger <lhh@redhat.com>
---
rgmanager/src/utils/clustat.c | 31 +++++++++++++++++++++++++++++--
1 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/rgmanager/src/utils/clustat.c b/rgmanager/src/utils/clustat.c
index f56d3f5..b3a2b4f 100644
--- a/rgmanager/src/utils/clustat.c
+++ b/rgmanager/src/utils/clustat.c
@@ -454,6 +454,7 @@ _txt_rg_state(rg_state_t *rs, cluster_member_list_t *members, int flags,
int svcsize, int nodesize, int statsize)
{
char owner[MAXHOSTNAMELEN+1];
+ char state_string[255] = "";
char *name = rs->rs_name, *ptr;
int l;

@@ -481,11 +482,22 @@ _txt_rg_state(rg_state_t *rs, cluster_member_list_t *members, int flags,
snprintf(owner, sizeof(owner)-1, "%-.*s", nodesize,
my_memb_id_to_name(members, rs->rs_owner));
}
+
+ /* Show a frozen service */
+ if (rs->rs_flags & RG_FLAG_FROZEN) {
+ snprintf(state_string, sizeof(state_string),
+ "%-*.*s[Z]", statsize-3, statsize-3,
+ rg_state_str(rs->rs_state));
+ } else {
+ snprintf(state_string, sizeof(state_string),
+ "%-*.*s", statsize, statsize,
+ rg_state_str(rs->rs_state));
+ }

printf(" %-*.*s %-*.*s %-*.*s
",
svcsize, svcsize, rs->rs_name,
nodesize, nodesize, owner,
- statsize, statsize, rg_state_str(rs->rs_state));
+ statsize, statsize, state_string);
}


@@ -493,10 +505,20 @@ static void
_txt_rg_state_v(rg_state_t *rs, cluster_member_list_t *members, int flags)
{
time_t t;
+ char flags_string[255] = "";
+
+ rg_flags_str(flags_string, sizeof(flags_string), rs->rs_flags,
+ (char *)", ");

printf("Service Name : %s
", rs->rs_name);
printf(" Current State : %s (%d)
",
rg_state_str(rs->rs_state), rs->rs_state);
+ if (rs->rs_flags)
+ printf(" Flags : %s (%d)
",
+ flags_string, rs->rs_flags);
+ else
+ printf(" Flags : none (%d)
",
+ rs->rs_flags);
printf(" Owner : %s
",
my_memb_id_to_name(members, rs->rs_owner));
printf(" Last Owner : %s
",
@@ -522,6 +544,7 @@ static void
xml_rg_state(rg_state_t *rs, cluster_member_list_t *members, int flags)
{
char time_str[32];
+ char flags_string[255] = "";
int x;
time_t t;

@@ -535,12 +558,16 @@ xml_rg_state(rg_state_t *rs, cluster_member_list_t *members, int flags)
}
}

- printf(" <group name="%s" state="%d" state_str="%s" "
+ printf(" <group name="%s" state="%d" state_str="%s""
+ " flags="%d" flags_str="%s""
" owner="%s" last_owner="%s" restarts="%d""
" last_transition="%llu" last_transition_str="%s"/>
",
rs->rs_name,
rs->rs_state,
rg_state_str(rs->rs_state),
+ rs->rs_flags,
+ rg_flags_str(flags_string, sizeof(flags_string),
+ rs->rs_flags, (char *)" "),
my_memb_id_to_name(members, rs->rs_owner),
my_memb_id_to_name(members, rs->rs_last_owner),
rs->rs_restarts,
--
1.7.1.1
 

Thread Tools




All times are GMT. The time now is 02:58 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org