summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cli/src/cli-rpc-ops.c66
1 files changed, 47 insertions, 19 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
index 6ee039f..c24bfc8 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -7560,22 +7560,25 @@ list_snap_of_volume (dict_t *dict_n, char *prefix_str) {
if (ret < 0) {
goto out;
}
+
ret = dict_get_str (dict_n, buffer, &get_buffer);
if (ret == 0) {
cli_out ("%s",get_buffer);
ret = 0;
goto out;
}
+
ret = snprintf (buffer, sizeof(buffer), "%s.volname", prefix_str);
if (ret < 0) { /* Negative value is an error */
goto out;
}
+
ret = dict_get_str (dict_n, buffer, &get_buffer);
if (get_buffer == NULL){
ret = 0;
goto out;
}
- cli_out ("\nVolume Name : %s", get_buffer);
+ cli_out ("\n%-28s %s %s", "Volume Name", ":", get_buffer);
/* if Volume is present then get the snapcount.
* string is "snaplist.vol{0..}.snap-count.
*/
@@ -7584,6 +7587,7 @@ list_snap_of_volume (dict_t *dict_n, char *prefix_str) {
if (ret < 0) { /* Negative value is an error */
goto out;
}
+
ret = dict_get_uint64 (dict_n, buffer, &snapcount);
if (ret) {
gf_log("", GF_LOG_ERROR, "Could not fetch snapcount");
@@ -7610,9 +7614,11 @@ list_snap_of_volume (dict_t *dict_n, char *prefix_str) {
if (ret < 0) {
goto out;
}
+
ret = dict_get_uint64 (dict_n, buffer, &snapcount_total);
if (!ret)
- cli_out ("Number of snaps taken : %ld", snapcount_total);
+ cli_out ("%-28s %s %ld", "Number of snaps taken", ":",
+ snapcount_total);
else
gf_log ("", GF_LOG_ERROR, "Failed to get snapcount total");
@@ -7621,13 +7627,15 @@ list_snap_of_volume (dict_t *dict_n, char *prefix_str) {
if (ret < 0) {
goto out;
}
+
ret = dict_get_uint64 (dict_n, buffer, &snap_available);
if (!ret)
- cli_out ("Number of snaps available : %ld",
- snap_available);
+ cli_out ("%-28s %s %ld", "Number of snaps available",
+ ":", snap_available);
else
gf_log ("", GF_LOG_ERROR, "Failed to get snap-available");
+
for (i = 0 ; i < snapcount; i++) {
/* get snapname "snaplist.vol-{0..}.snap-{0..}.snapname" */
ret = snprintf (buffer, sizeof(buffer),
@@ -7635,22 +7643,28 @@ list_snap_of_volume (dict_t *dict_n, char *prefix_str) {
if (ret < 0) { /* Negative value is an error */
goto out;
}
+
ret = dict_get_str (dict_n, buffer, &get_buffer);
if (!ret)
- cli_out ("\n\tSnap Name : %s",get_buffer);
+ cli_out ("\n\t%-17s %s %s", "Snap Name", ":",
+ get_buffer);
else
- cli_out ("\n\tSnap Name : %s","Does not exist");
+ cli_out ("\n\t%-17s %s %s", "Snap Name", ":",
+ "Does not exist");
ret = snprintf (buffer, sizeof(buffer),
"%s.snap-%ld.snap-time", prefix_str, i);
if (ret < 0) { /* Negative value is an error */
goto out;
}
+
ret = dict_get_str (dict_n, buffer, &get_buffer);
if (!ret)
- cli_out ("\tSnap Time : %s",get_buffer);
+ cli_out ("\t%-17s %s %s", "Snap Time", ":",
+ get_buffer);
else
- cli_out ("\tSnap Time : %s","Does not exist");
+ cli_out ("\t%-17s %s %s", "Snap Time", ":",
+ "Does not exist");
ret = snprintf (buffer, sizeof(buffer), "%s.snap-%ld.snap-id"
@@ -7658,11 +7672,14 @@ list_snap_of_volume (dict_t *dict_n, char *prefix_str) {
if (ret < 0) { /* Negative value is an error */
goto out;
}
+
ret = dict_get_str (dict_n, buffer, &get_buffer);
if (!ret)
- cli_out("\tSnap ID : %s",get_buffer);
+ cli_out("\t%-17s %s %s", "Snap UUID", ":",
+ get_buffer);
else
- cli_out("\tSnap ID : %s","Does not exist");
+ cli_out("\t%-17s %s %s", "Snap UUID", ":",
+ "Does not exist");
if(detail == 0) {
/* if snap_details is set to zero
@@ -7675,45 +7692,56 @@ list_snap_of_volume (dict_t *dict_n, char *prefix_str) {
if (ret < 0) { /* Negative value is an error */
goto out;
}
+
ret = dict_get_str (dict_n, buffer, &get_buffer);
if (!ret)
- cli_out("\tCG Name : %s",get_buffer);
+ cli_out("\t%-17s %s %s", "CG Name", ":",
+ get_buffer);
else
- cli_out("\tCG Name : %s","Does not exist");
+ cli_out("\t%-17s %s %s","CG Name", ":",
+ "Does not exist");
ret = snprintf (buffer, sizeof(buffer),
"%s.snap-%ld.cg-id", prefix_str, i);
if (ret < 0) { /* Negative value is an error */
goto out;
}
+
ret = dict_get_str (dict_n, buffer, &get_buffer);
if (!ret)
- cli_out("\tCG ID : %s",get_buffer);
+ cli_out("\t%-17s %s %s", "CG ID", ":",
+ get_buffer);
else
- cli_out("\tCG ID : %s","Does not exist");
+ cli_out("\t%-17s %s %s", "CG ID", ":",
+ "Does not exist");
ret = snprintf (buffer, sizeof(buffer),
"%s.snap-%ld.snap-desc", prefix_str, i);
if (ret < 0) { /* Negative value is an error */
goto out;
}
+
ret = dict_get_str (dict_n, buffer, &get_buffer);
if (!ret)
- cli_out ("\tSnap Description : %s",get_buffer);
+ cli_out ("\t%-17s %s %s", "Snap Description", ":",
+ get_buffer);
else
- cli_out ("\tSnap Description : %s",
- "Description not present");
+ cli_out ("\t%-17s %s %s", "Snap Description", ":",
+ "Description not present");
ret = snprintf (buffer, sizeof(buffer),
"%s.snap-%ld.snap-status", prefix_str, i);
if (ret < 0) { /* Negative value is an error */
goto out;
}
+
ret = dict_get_str (dict_n, buffer, &get_buffer);
if (!ret)
- cli_out ("\tSnap Status : %s",get_buffer);
+ cli_out ("\t%-17s %s %s", "Snap Status", ":",
+ get_buffer);
else
- cli_out ("\tSnap Status : %s","Does not exist");
+ cli_out ("\t%-17s %s %s", "Snap Status", ":",
+ "Does not exist");
ret = 0;
}