summaryrefslogtreecommitdiffstats
path: root/cli/src/cli-xml-output.c
diff options
context:
space:
mode:
authorNiels de Vos <ndevos@redhat.com>2013-04-20 16:55:15 +0200
committerVijay Bellur <vbellur@redhat.com>2013-04-26 04:28:06 -0700
commite6b6d1235daa483384d2b0701561b8f3a85be583 (patch)
tree5d83225225cddba382c217f27b4a13526d0dc83f /cli/src/cli-xml-output.c
parent5e0116109e3c444b11adb9809c75b4da72e85457 (diff)
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 <amarts@redhat.com> Signed-off-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/4862 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'cli/src/cli-xml-output.c')
-rw-r--r--cli/src/cli-xml-output.c27
1 files changed, 14 insertions, 13 deletions
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);