summaryrefslogtreecommitdiffstats
path: root/cli/src/cli-xml-output.c
diff options
context:
space:
mode:
Diffstat (limited to 'cli/src/cli-xml-output.c')
-rw-r--r--cli/src/cli-xml-output.c78
1 files changed, 47 insertions, 31 deletions
diff --git a/cli/src/cli-xml-output.c b/cli/src/cli-xml-output.c
index 673decec160..cdce2d79870 100644
--- a/cli/src/cli-xml-output.c
+++ b/cli/src/cli-xml-output.c
@@ -5075,8 +5075,16 @@ cli_xml_snapshot_volume_status (xmlTextWriterPtr writer, xmlDocPtr doc,
ret = dict_get_str (dict, key, &buffer);
if (ret) {
- gf_log ("cli", GF_LOG_INFO, "Unable to get Brick Path");
- goto out;
+ gf_log ("cli", GF_LOG_ERROR,
+ "Unable to get Brick Path");
+ /*
+ * If path itself is not present, then end *
+ * this brick's status and continue to the *
+ * brick *
+ */
+ ret = xmlTextWriterEndElement (writer);
+ XML_RET_CHECK_AND_GOTO (ret, out);
+ continue;
}
ret = xmlTextWriterWriteFormatElement (writer,
@@ -5088,14 +5096,14 @@ cli_xml_snapshot_volume_status (xmlTextWriterPtr writer, xmlDocPtr doc,
ret = dict_get_str (dict, key, &buffer);
if (ret) {
- gf_log ("cli", GF_LOG_INFO,
+ gf_log ("cli", GF_LOG_ERROR,
"Unable to get Volume Group");
- goto out;
- }
+ ret = xmlTextWriterWriteFormatElement (writer,
+ (xmlChar *) "volumeGroup", "N/A");
+ } else
+ ret = xmlTextWriterWriteFormatElement (writer,
+ (xmlChar *) "volumeGroup", "%s", buffer);
- ret = xmlTextWriterWriteFormatElement (writer,
- (xmlChar *) "volumeGroup",
- "%s", buffer);
XML_RET_CHECK_AND_GOTO (ret, out);
snprintf (key, sizeof (key), "%s.brick%d.status", keyprefix, i);
@@ -5104,19 +5112,25 @@ cli_xml_snapshot_volume_status (xmlTextWriterPtr writer, xmlDocPtr doc,
if (ret) {
gf_log ("cli", GF_LOG_ERROR,
"Unable to get Brick Running");
- goto out;
- }
+ ret = xmlTextWriterWriteFormatElement (writer,
+ (xmlChar *) "brick_running", "N/A");
+ } else
+ ret = xmlTextWriterWriteFormatElement (writer,
+ (xmlChar *) "brick_running", "%s", buffer);
+
+ XML_RET_CHECK_AND_GOTO (ret, out);
snprintf (key, sizeof (key), "%s.brick%d.pid", keyprefix, i);
ret = dict_get_int32 (dict, key, &pid);
if (ret) {
- gf_log ("cli", GF_LOG_ERROR, "Unable to get pid");
- goto out;
- }
+ gf_log ("cli", GF_LOG_INFO, "Unable to get pid");
+ ret = xmlTextWriterWriteFormatElement (writer,
+ (xmlChar *) "pid", "N/A");
+ } else
+ ret = xmlTextWriterWriteFormatElement (writer,
+ (xmlChar *) "pid", "%d", pid);
- ret = xmlTextWriterWriteFormatElement (writer,
- (xmlChar *) "pid", "%d", pid);
XML_RET_CHECK_AND_GOTO (ret, out);
snprintf (key, sizeof (key), "%s.brick%d.data", keyprefix, i);
@@ -5125,28 +5139,29 @@ cli_xml_snapshot_volume_status (xmlTextWriterPtr writer, xmlDocPtr doc,
if (ret) {
gf_log ("cli", GF_LOG_ERROR,
"Unable to get Data Percent");
- goto out;
- }
+ ret = xmlTextWriterWriteFormatElement (writer,
+ (xmlChar *) "data_percentage", "N/A");
+ } else
+ ret = xmlTextWriterWriteFormatElement (writer,
+ (xmlChar *) "data_percentage", "%s", buffer);
- ret = xmlTextWriterWriteFormatElement (writer,
- (xmlChar *) "lvUsage",
- "%s", buffer);
XML_RET_CHECK_AND_GOTO (ret, out);
snprintf (key, sizeof (key), "%s.brick%d.lvsize",
keyprefix, i);
ret = dict_get_str (dict, key, &buffer);
if (ret) {
- gf_log ("cli", GF_LOG_INFO, "Unable to get LV Size");
- goto out;
- }
+ gf_log ("cli", GF_LOG_ERROR, "Unable to get LV Size");
+ ret = xmlTextWriterWriteFormatElement (writer,
+ (xmlChar *) "lvSize", "N/A");
+ } else {
+ /* Truncate any newline character */
+ buffer = strtok (buffer, "\n");
- /* Truncate any newline character */
- buffer = strtok (buffer, "\n");
+ ret = xmlTextWriterWriteFormatElement (writer,
+ (xmlChar *) "lvSize", "%s", buffer);
+ }
- ret = xmlTextWriterWriteFormatElement (writer,
- (xmlChar *) "lvSize",
- "%s", buffer);
XML_RET_CHECK_AND_GOTO (ret, out);
/* </brick> */
@@ -5284,7 +5299,8 @@ cli_xml_snapshot_status (xmlTextWriterPtr writer, xmlDocPtr doc, dict_t *dict)
goto out;
}
- if (GF_SNAP_STATUS_TYPE_SNAP == status_cmd) {
+ if ((GF_SNAP_STATUS_TYPE_SNAP == status_cmd) ||
+ (GF_SNAP_STATUS_TYPE_ITER == status_cmd)) {
snapcount = 1;
} else {
ret = dict_get_int32 (dict, "status.snapcount", &snapcount);
@@ -6041,7 +6057,7 @@ cli_xml_snapshot_begin_composite_op (cli_local_t *local)
goto out;
}
- if (cmd == GF_SNAP_STATUS_TYPE_SNAP ||
+ if (cmd == GF_SNAP_STATUS_TYPE_ITER ||
cmd == GF_SNAP_DELETE_TYPE_SNAP){
ret = 0;
goto out;
@@ -6086,7 +6102,7 @@ cli_xml_snapshot_end_composite_op (cli_local_t *local)
goto out;
}
- if (cmd == GF_SNAP_STATUS_TYPE_SNAP ||
+ if (cmd == GF_SNAP_STATUS_TYPE_ITER ||
cmd == GF_SNAP_DELETE_TYPE_SNAP){
ret = 0;
goto out;