diff options
author | Sachin Pandit <spandit@redhat.com> | 2015-03-16 13:12:12 +0530 |
---|---|---|
committer | Krishnan Parthasarathi <kparthas@redhat.com> | 2015-04-10 08:19:09 +0000 |
commit | da48df4e91b69b8f586d658de9573287cad2ce64 (patch) | |
tree | 5046c2ad5de3fbd22cc99879cd52dce8f904f36c /xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c | |
parent | df26c5e162b2ff413ff551119346e239df5ed663 (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-utils.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c | 31 |
1 files changed, 3 insertions, 28 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c index 8819f69c594..1da8a5b4490 100644 --- a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c @@ -3054,7 +3054,8 @@ out: int32_t glusterd_copy_quota_files (glusterd_volinfo_t *src_vol, - glusterd_volinfo_t *dest_vol) { + glusterd_volinfo_t *dest_vol, + gf_boolean_t *conf_present) { int32_t ret = -1; char src_dir[PATH_MAX] = ""; @@ -3104,33 +3105,7 @@ glusterd_copy_quota_files (glusterd_volinfo_t *src_vol, goto out; } - ret = snprintf (src_path, sizeof (src_path), "%s/quota.cksum", - src_dir); - if (ret < 0) - goto out; - - /* If quota.conf is present and quota.cksum is not present, then - * that scenario is considered as invalid, hence error out. - */ - ret = lstat (src_path, &stbuf); - if (ret) { - ret = -1; - gf_log (this->name, GF_LOG_ERROR, "%s not found", src_path); - goto out; - } - - ret = snprintf (dest_path, sizeof (dest_path), "%s/quota.cksum", - dest_dir); - if (ret < 0) - goto out; - - ret = glusterd_copy_file (src_path, dest_path); - if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to copy %s in %s", - src_path, dest_path); - goto out; - } - + *conf_present = _gf_true; out: return ret; |