summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-snapshot.c
diff options
context:
space:
mode:
authorSachin Pandit <spandit@redhat.com>2015-03-16 13:12:12 +0530
committerKrishnan Parthasarathi <kparthas@redhat.com>2015-04-10 08:19:09 +0000
commitda48df4e91b69b8f586d658de9573287cad2ce64 (patch)
tree5046c2ad5de3fbd22cc99879cd52dce8f904f36c /xlators/mgmt/glusterd/src/glusterd-snapshot.c
parentdf26c5e162b2ff413ff551119346e239df5ed663 (diff)
glusterd/snapshot : While snapshot restore, compute quota checksum.
Problem : During snapshot restore we anyways copy the quota conf file after that we need to compute the checksum for that. If not, there might be a checksum mismatch during glusterd handshake. Solution : Compute a checksum file for quota conf file if its present. Change-Id: Ic4a6567c6ede9923443abf4ca59380679be88094 BUG: 1202436 Signed-off-by: Sachin Pandit <spandit@redhat.com> Reviewed-on: http://review.gluster.org/9901 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Avra Sengupta <asengupt@redhat.com> Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com> Tested-by: Krishnan Parthasarathi <kparthas@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-snapshot.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-snapshot.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
index 6d1f79b65d0..cdd19cd354d 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
@@ -4707,7 +4707,8 @@ glusterd_do_snap_vol (glusterd_volinfo_t *origin_vol, glusterd_snap_t *snap,
int32_t brick_count = 0;
xlator_t *this = NULL;
int64_t brick_order = 0;
- char *clonename = NULL;
+ char *clonename = NULL;
+ gf_boolean_t conf_present = _gf_false;
this = THIS;
GF_ASSERT (this);
@@ -4834,7 +4835,7 @@ glusterd_do_snap_vol (glusterd_volinfo_t *origin_vol, glusterd_snap_t *snap,
goto out;
}
- ret = glusterd_copy_quota_files (origin_vol, snap_vol);
+ ret = glusterd_copy_quota_files (origin_vol, snap_vol, &conf_present);
if (ret) {
gf_log (this->name, GF_LOG_ERROR, "Failed to copy quota "
"config and cksum for volume %s", origin_vol->volname);
@@ -8781,6 +8782,7 @@ gd_restore_snap_volume (dict_t *dict, dict_t *rsp_dict,
glusterd_conf_t *conf = NULL;
glusterd_volinfo_t *temp_volinfo = NULL;
glusterd_volinfo_t *voliter = NULL;
+ gf_boolean_t conf_present = _gf_false;
this = THIS;
GF_ASSERT (this);
@@ -8870,7 +8872,7 @@ gd_restore_snap_volume (dict_t *dict, dict_t *rsp_dict,
snap_vol->snapshot->snapname);
}
- ret = glusterd_copy_quota_files (snap_vol, orig_vol);
+ ret = glusterd_copy_quota_files (snap_vol, orig_vol, &conf_present);
if (ret) {
gf_log (this->name, GF_LOG_ERROR, "Failed to restore "
"quota files for snap %s",
@@ -8878,6 +8880,25 @@ gd_restore_snap_volume (dict_t *dict, dict_t *rsp_dict,
goto out;
}
+ if (conf_present) {
+ /* TO calculate checksum of quota conf we need to send
+ * second argument as _gf_true
+ */
+ ret = glusterd_compute_cksum (new_volinfo, _gf_true);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR, "Failed to compute "
+ "checksum for quota conf file");
+ goto out;
+ }
+
+ ret = glusterd_store_save_quota_version_and_cksum (new_volinfo);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR, "Failed to "
+ "store quota version and cksum");
+ goto out;
+ }
+ }
+
/* New volinfo always shows the status as created. Therefore
* set the status to the original volume's status. */
glusterd_set_volume_status (new_volinfo, orig_vol->status);