From e6b6d1235daa483384d2b0701561b8f3a85be583 Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Sat, 20 Apr 2013 16:55:15 +0200 Subject: cli: add a command 'gluster pool list [--xml]' * unlike 'gluster peer status', which lists only info about peers, this command lists localhost also in the list, so the sorted output from all the nodes should match. * made the output script friendly by keeping it one output per line. Change-Id: I853656753b35c617debbcceecbb71c8d6dd3c334 BUG: 764638 Original-review: http://review.gluster.org/4221 Original-author: Amar Tumballi Signed-off-by: Niels de Vos Reviewed-on: http://review.gluster.org/4862 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- cli/src/cli-xml-output.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'cli/src/cli-xml-output.c') diff --git a/cli/src/cli-xml-output.c b/cli/src/cli-xml-output.c index 72e1264f78c..168159b68d0 100644 --- a/cli/src/cli-xml-output.c +++ b/cli/src/cli-xml-output.c @@ -2801,29 +2801,30 @@ cli_xml_output_peer_status (dict_t *dict, int op_ret, int op_errno, memset (key, 0, sizeof (key)); snprintf (key, sizeof (key), "friend%d.stateId", i); ret = dict_get_int32 (dict, key, &state_id); - if (ret) - goto out; + if (!ret) { + /* ignore */ - ret = xmlTextWriterWriteFormatElement (writer, - (xmlChar *)"state", - "%d", state_id); - XML_RET_CHECK_AND_GOTO (ret, out); + ret = xmlTextWriterWriteFormatElement (writer, + (xmlChar *)"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; + if (!ret) { + /* ignore */ - ret = xmlTextWriterWriteFormatElement (writer, - (xmlChar *)"stateStr", - "%s", state_str); - XML_RET_CHECK_AND_GOTO (ret, out); + ret = xmlTextWriterWriteFormatElement (writer, + (xmlChar *)"stateStr", "%s", state_str); + XML_RET_CHECK_AND_GOTO (ret, out); + } memset (key, 0, sizeof (key)); snprintf (key, sizeof (key), "friend%d.port", i); ret = dict_get_int32 (dict, key, &port); - if (port != 0) { + if (!ret) { + /* ignore */ ret = xmlTextWriterWriteFormatElement (writer, (xmlChar *)"port", "%d", port); XML_RET_CHECK_AND_GOTO (ret, out); -- cgit