summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-snapshot.c
diff options
context:
space:
mode:
authorJiffin Tony Thottan <jthottan@redhat.com>2015-08-27 23:26:40 +0530
committerKaleb KEITHLEY <kkeithle@redhat.com>2015-10-30 13:39:42 -0700
commit5583bac79851d24f0a552478b361049fe63c32b7 (patch)
treefeaed9ccaf31d0dde6b80ddd2be4bcbafc1d4c4d /xlators/mgmt/glusterd/src/glusterd-snapshot.c
parente13733ab871f34c54a6fc44059b3343a5c2f992a (diff)
snapshot : copying nfs-ganesha export file
While taking snapshot, the export file used by the volume should copy to snap directory. So that when restore of snapshot happens, the volume can retain all its configuration for exporting via nfs-ganesha. The export file is stored at "/etc/ganesha/export" in the following format "export.<volname>.conf" The fix handles given cases in the following manner : case a: The nfs-ganesha(global) is ON during snapshot and restore. i.) Volume was exported during snapshot. When we restore snapshot, then volume should be exported back with old configuration file. ii.) Volume was unexported during snapshot. When we restore snapshot, then volume should unexported again. case b: The nfs-ganesha is ON during snapshot and OFF during restore Volume was exported during snapshot. When we restore snapshot, the conf will be copied to corresponding location and if nfs-ganesha enabled again, then volume will be exported. For the clones, export conf file will created in /etc/ganesha/export and then export it via ganesha. Change-Id: Ideecda15bd4db58e991cf6c8de7bb93f3db6cd20 BUG: 1257709 Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com> Reviewed-on: http://review.gluster.org/12034 Reviewed-by: Avra Sengupta <asengupt@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-snapshot.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-snapshot.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
index e75e5722138..272d497f418 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
@@ -5241,6 +5241,16 @@ glusterd_do_snap_vol (glusterd_volinfo_t *origin_vol, glusterd_snap_t *snap,
origin_vol->volname);
goto out;
}
+
+
+ }
+
+ ret = glusterd_copy_nfs_ganesha_file (origin_vol, snap_vol);
+ if (ret < 0) {
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOL_OP_FAILED, "Failed to copy export "
+ "file for volume %s", origin_vol->volname);
+ goto out;
}
glusterd_auth_set_username (snap_vol, username);
glusterd_auth_set_password (snap_vol, password);
@@ -9629,6 +9639,16 @@ gd_restore_snap_volume (dict_t *dict, dict_t *rsp_dict,
snap_vol->snapshot->snapname);
}
+ ret = glusterd_restore_nfs_ganesha_file (orig_vol, snap);
+ if (ret) {
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_SNAP_RESTORE_FAIL,
+ "Failed to restore "
+ "nfs-ganesha export file for snap %s",
+ snap_vol->snapshot->snapname);
+ goto out;
+ }
+
ret = glusterd_copy_quota_files (snap_vol, orig_vol, &conf_present);
if (ret) {
gf_msg (this->name, GF_LOG_ERROR, 0,