From 8f3ad1e3ede77fa5f8c8d606e18a7e83865a822c Mon Sep 17 00:00:00 2001 From: Avra Sengupta Date: Fri, 11 Mar 2016 15:27:30 +0530 Subject: snapshot/quota: Copy quota.cksum during snapshot operations A volume having a quota.conf file, should always have a quota.cksum file too. Based on this above assumption modifying glusterd_copy_quota_files() to always copy quota.cksum, if quota.conf is present. This change will be reflected when a snapshot is created, restored and cloned. Change-Id: Ia49dc26eacef32eeb8f7d7d9553c80e304b08779 BUG: 1316848 Signed-off-by: Avra Sengupta Reviewed-on: http://review.gluster.org/13760 Smoke: Gluster Build System CentOS-regression: Gluster Build System NetBSD-regression: NetBSD Build System Reviewed-by: Vijaikumar Mallikarjuna Reviewed-by: Rajesh Joseph --- .../mgmt/glusterd/src/glusterd-snapshot-utils.c | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c index ae2616342f4..c67c9d752c6 100644 --- a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c @@ -3649,6 +3649,34 @@ 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, quota.cksum has to be present. * + * Fail snapshot operation if file is absent * + */ + ret = sys_lstat (src_path, &stbuf); + if (ret) { + gf_msg (this->name, GF_LOG_ERROR, 0, + GD_MSG_FILE_NOT_FOUND, "%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_msg (this->name, GF_LOG_ERROR, ENOMEM, + GD_MSG_NO_MEMORY, "Failed to copy %s in %s", + src_path, dest_path); + goto out; + } + *conf_present = _gf_true; out: return ret; -- cgit