summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-snapshot.c
diff options
context:
space:
mode:
authorSachin Pandit <spandit@redhat.com>2014-04-26 14:06:47 +0530
committerVijay Bellur <vbellur@redhat.com>2014-05-01 21:35:31 -0700
commitb3031351b0e69195413f5f5b9cad2752e3eb713d (patch)
tree78425489d524dc7f4226919e242b571202a58679 /xlators/mgmt/glusterd/src/glusterd-snapshot.c
parentd12a77cb3263f79f66f48a3b9205746b7d3b50f1 (diff)
glusterd/snapshot : Copy the quota config and cksum file before taking a snapshot
Quota config and cksum file needs to be copied before taking a snapshot, so that when a snapshot is restored these files is copied back to the original place, and the restored snap volume can make use of these quota files. Before taking a snapshot the quota files are copied to /var/lib/glusterd/snaps/<snapname>/quota/ Change-Id: Id175f28d4ee47be64d7491c6aae81a1794928490 BUG: 1061685 Signed-off-by: Sachin Pandit <spandit@redhat.com> Reviewed-on: http://review.gluster.org/7527 Reviewed-by: Vijaikumar Mallikarjuna <vmallika@redhat.com> Reviewed-by: Raghavendra G <rgowdapp@redhat.com> Reviewed-by: Rajesh Joseph <rjoseph@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.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
index ad787070e8c..9c64fe2d61a 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
@@ -410,7 +410,6 @@ out:
return ret;
}
-
int32_t
glusterd_copy_geo_rep_files (glusterd_volinfo_t *origin_vol,
glusterd_volinfo_t *snap_vol, dict_t *rsp_dict)
@@ -3714,6 +3713,13 @@ glusterd_do_snap_vol (glusterd_volinfo_t *origin_vol, glusterd_snap_t *snap,
goto out;
}
+ ret = glusterd_copy_quota_files (origin_vol, snap_vol);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR, "Failed to copy quota "
+ "config and cksum for volume %s", origin_vol->volname);
+ goto out;
+ }
+
ret = generate_brick_volfiles (snap_vol);
if (ret) {
gf_log (this->name, GF_LOG_ERROR, "generating the brick "
@@ -6068,7 +6074,16 @@ gd_restore_snap_volume (dict_t *rsp_dict,
ret = glusterd_restore_geo_rep_files (snap_vol);
if (ret) {
gf_log (this->name, GF_LOG_ERROR, "Failed to restore "
- "geo-rep files");
+ "geo-rep files for snap %s",
+ snap_vol->snapshot->snapname);
+ goto out;
+ }
+
+ ret = glusterd_copy_quota_files (snap_vol, orig_vol);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR, "Failed to restore "
+ "quota files for snap %s",
+ snap_vol->snapshot->snapname);
goto out;
}