From fad24c87cef0cc40c661614cd1cf1ab936311dcb Mon Sep 17 00:00:00 2001 From: Kaushal M Date: Wed, 29 Aug 2012 14:43:30 +0530 Subject: cli, glusterd: Changes to 'peer status' xml output Glusterd now returns the status of a peer as both a string and a number. The xml output for peer status has been modified, such that the element now contains the status number and a new element contains the status string. Change-Id: I0d4b74b84a991893d1029b8408d66ff078bbd254 BUG: 847760 Signed-off-by: Kaushal M Reviewed-on: http://review.gluster.org/3868 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- cli/src/cli-xml-output.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'cli') diff --git a/cli/src/cli-xml-output.c b/cli/src/cli-xml-output.c index 4459a283b..eebcafb97 100644 --- a/cli/src/cli-xml-output.c +++ b/cli/src/cli-xml-output.c @@ -2500,7 +2500,8 @@ cli_xml_output_peer_status (dict_t *dict, int op_ret, int op_errno, char *uuid = NULL; char *hostname = NULL; int connected = 0; - char *state = NULL; + int state_id = 0; + char *state_str = NULL; int port = 0; int i = 1; char key[1024] = {0,}; @@ -2563,14 +2564,25 @@ cli_xml_output_peer_status (dict_t *dict, int op_ret, int op_errno, XML_RET_CHECK_AND_GOTO (ret, out); memset (key, 0, sizeof (key)); - snprintf (key, sizeof (key), "friend%d.state", i); - ret = dict_get_str (dict, key, &state); + snprintf (key, sizeof (key), "friend%d.stateId", i); + ret = dict_get_int32 (dict, key, &state_id); if (ret) goto out; ret = xmlTextWriterWriteFormatElement (writer, (xmlChar *)"state", - "%s", state); + "%d", state_id); + XML_RET_CHECK_AND_GOTO (ret, out); + + memset (key, 0, sizeof (key)); + snprintf (key, sizeof (key), "friend%d.state", i); + ret = dict_get_str (dict, key, &state_str); + if (ret) + goto out; + + ret = xmlTextWriterWriteFormatElement (writer, + (xmlChar *)"stateStr", + "%s", state_str); XML_RET_CHECK_AND_GOTO (ret, out); memset (key, 0, sizeof (key)); -- cgit