summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-snapshot.c
diff options
context:
space:
mode:
authorRajesh Joseph <rjoseph@redhat.com>2014-05-05 13:37:34 +0530
committerVijay Bellur <vbellur@redhat.com>2014-07-12 09:50:25 -0700
commit656e6b38189d14c440a46d4d69b5ddfc5d8cfffc (patch)
tree6c8b5c8125258816b18e79cd0e342014892d4cbe /xlators/mgmt/glusterd/src/glusterd-snapshot.c
parent99685f18f190a73f2a46478cac0b09f4c59834b1 (diff)
cli/snapshot: provide --xml support for all snapshot command
Now --xml option can be used with all snapshot command. It will form the cli output in xml form. Change-Id: Ifc0ac31d2a9f91e136e87f3b51a629df7dba94e8 BUG: 1096610 Signed-off-by: Rajesh Joseph <rjoseph@redhat.com> Reviewed-on: http://review.gluster.org/7663 Reviewed-by: Sachin Pandit <spandit@redhat.com> Reviewed-by: Vijaikumar Mallikarjuna <vmallika@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-snapshot.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-snapshot.c86
1 files changed, 81 insertions, 5 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
index 7678d77b3d5..dccf57f7c93 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
@@ -770,6 +770,34 @@ glusterd_snapshot_restore (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
goto out;
}
+ ret = dict_set_dynstr_with_alloc (rsp_dict, "snapuuid",
+ uuid_utoa (snap->snap_id));
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR, "Failed to set snap "
+ "uuid in response dictionary for %s snapshot",
+ snap->snapname);
+ goto out;
+ }
+
+
+ ret = dict_set_dynstr_with_alloc (rsp_dict, "volname",
+ snap_volinfo->parent_volname);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR, "Failed to set snap "
+ "uuid in response dictionary for %s snapshot",
+ snap->snapname);
+ goto out;
+ }
+
+ ret = dict_set_dynstr_with_alloc (rsp_dict, "volid",
+ uuid_utoa (parent_volinfo->volume_id));
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR, "Failed to set snap "
+ "uuid in response dictionary for %s snapshot",
+ snap->snapname);
+ goto out;
+ }
+
/* Take backup of the volinfo folder */
ret = glusterd_snapshot_backup_vol (parent_volinfo);
if (ret) {
@@ -2768,7 +2796,7 @@ glusterd_snapshot_get_all_snap_info (dict_t *dict)
}
}
- ret = dict_set_int32 (dict, "snap-count", snapcount);
+ ret = dict_set_int32 (dict, "snapcount", snapcount);
if (ret) {
gf_log (this->name, GF_LOG_ERROR, "Failed to set snapcount");
goto out;
@@ -2870,7 +2898,7 @@ glusterd_snapshot_get_info_by_volume (dict_t *dict, char *volname,
goto out;
}
}
- ret = dict_set_int32 (dict, "snap-count", snapcount);
+ ret = dict_set_int32 (dict, "snapcount", snapcount);
if (ret) {
gf_log (this->name, GF_LOG_ERROR, "Failed to set snapcount");
goto out;
@@ -2941,7 +2969,7 @@ glusterd_handle_snapshot_info (rpcsvc_request_t *req, glusterd_op_t op,
goto out;
}
- ret = dict_set_int32 (dict, "snap-count", 1);
+ ret = dict_set_int32 (dict, "snapcount", 1);
if (ret) {
gf_log (this->name, GF_LOG_ERROR,
"Failed to set snapcount");
@@ -3047,7 +3075,7 @@ glusterd_snapshot_get_all_snapnames (dict_t *dict)
}
}
- ret = dict_set_int32 (dict, "snap-count", snapcount);
+ ret = dict_set_int32 (dict, "snapcount", snapcount);
if (ret) {
gf_log (this->name, GF_LOG_ERROR, "Failed to set snapcount");
goto out;
@@ -3096,7 +3124,7 @@ glusterd_snapshot_get_vol_snapnames (dict_t *dict, glusterd_volinfo_t *volinfo)
}
}
- ret = dict_set_int32 (dict, "snap-count", snapcount);
+ ret = dict_set_int32 (dict, "snapcount", snapcount);
if (ret) {
gf_log (this->name, GF_LOG_ERROR, "Failed to set snapcount");
goto out;
@@ -4538,6 +4566,15 @@ glusterd_snapshot_remove_prevalidate (dict_t *dict, char **op_errstr,
goto out;
}
+ ret = dict_set_dynstr_with_alloc (dict, "snapuuid",
+ uuid_utoa (snap->snap_id));
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR, "Failed to set snap "
+ "uuid in response dictionary for %s snapshot",
+ snap->snapname);
+ goto out;
+ }
+
ret = 0;
out:
return ret;
@@ -4699,6 +4736,16 @@ glusterd_snapshot_activate_commit (dict_t *dict, char **op_errstr,
snap_volinfo->volname, snap->snapname);
goto out;
}
+
+ ret = dict_set_dynstr_with_alloc (rsp_dict, "snapuuid",
+ uuid_utoa (snap->snap_id));
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR, "Failed to set snap "
+ "uuid in response dictionary for %s snapshot",
+ snap->snapname);
+ goto out;
+ }
+
ret = 0;
out:
return ret;
@@ -4759,6 +4806,15 @@ glusterd_snapshot_deactivate_commit (dict_t *dict, char **op_errstr,
goto out;
}
+ ret = dict_set_dynstr_with_alloc (rsp_dict, "snapuuid",
+ uuid_utoa (snap->snap_id));
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR, "Failed to set snap "
+ "uuid in response dictionary for %s snapshot",
+ snap->snapname);
+ goto out;
+ }
+
ret = 0;
out:
return ret;
@@ -4805,6 +4861,15 @@ glusterd_snapshot_remove_commit (dict_t *dict, char **op_errstr,
goto out;
}
+ ret = dict_set_dynstr_with_alloc (rsp_dict, "snapuuid",
+ uuid_utoa (snap->snap_id));
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR, "Failed to set snap uuid in "
+ "response dictionary for %s snapshot",
+ snap->snapname);
+ goto out;
+ }
+
/* Save the snap status as GD_SNAP_STATUS_DECOMMISSION so
* that if the node goes down the snap would be removed
*/
@@ -5276,6 +5341,17 @@ glusterd_snapshot_create_commit (dict_t *dict, char **op_errstr,
}
}
+ ret = dict_set_dynstr_with_alloc (rsp_dict, "snapuuid",
+ uuid_utoa (snap->snap_id));
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR, "Failed to set snap "
+ "uuid in response dictionary for %s snapshot",
+ snap->snapname);
+ goto out;
+ }
+
+ ret = 0;
+
out:
if (ret) {
if (snap)