diff options
author | Sachin Pandit <spandit@redhat.com> | 2014-01-08 07:36:50 +0530 |
---|---|---|
committer | Sachin Pandit <spandit@redhat.com> | 2014-01-13 10:44:53 +0530 |
commit | 33c45ff71cb43eec7cdcee054a6a55b7c3aaa8fb (patch) | |
tree | bbf509eecdb86177d20782f635fad253b2dd50b8 /xlators/mgmt/glusterd/src/glusterd-snapshot.c | |
parent | 847e14ccbaddd5d1f06f9200cba063ee007199ad (diff) |
glusterd/snapshot : Making CG Name persistent and handle Snap Description Issue.
1)Write the CG Name in the "snap_list.info"
file, so that CG Name is not lost when we restart the
glusterd.
2)Fixes the issue where Description given for CG,
as a part of create command, was getting stored
as snap description rather than CG Description.
3)Fixes the problem with glusterd restart
when we have multiple words in Snap Descripition
Change-Id: I3129c53d1ec54dd170ca1300583f278f58c4e0e2
BUG: 1044476
Signed-off-by: Sachin Pandit <spandit@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-snapshot.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-snapshot.c | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c index 8386b44c5..acc8bef16 100644 --- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c +++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c @@ -2695,7 +2695,7 @@ int32_t glusterd_snap_create (glusterd_volinfo_t *volinfo, glusterd_volinfo_t *snap_volinfo, char *description, uuid_t *cg_id, - char *cg_name) + glusterd_snap_cg_t *cg, char *cg_name) { glusterd_snap_t *snap = NULL; xlator_t *this = NULL; @@ -2724,8 +2724,26 @@ glusterd_snap_create (glusterd_volinfo_t *volinfo, // for now ignore if description is not strduped - if (description) - snap->description = gf_strdup (description); + if (description) { + if (cg_id) { + cg->description = gf_strdup (description); + if (cg->description == NULL) { + gf_log ("", GF_LOG_ERROR, + "Saving the CG Description Failed"); + ret = -1; + goto out; + } + } + else { + snap->description = gf_strdup (description); + if (snap->description == NULL) { + gf_log ("", GF_LOG_ERROR, + "Saving the Snap Description Failed"); + ret = -1; + goto out; + } + } + } snap->time_stamp = time (NULL); uuid_copy (snap->snap_id, snap_volinfo->volume_id); if (cg_id){ @@ -3047,7 +3065,7 @@ out: */ int32_t glusterd_do_snap (glusterd_volinfo_t *volinfo, char *snapname, dict_t *dict, - gf_boolean_t cg, uuid_t *cg_id, int volcount, + glusterd_snap_cg_t *cg, uuid_t *cg_id, int volcount, uuid_t snap_volid, char *cg_name) { char *snap_brick_mount_path = ""; @@ -3191,7 +3209,7 @@ glusterd_do_snap (glusterd_volinfo_t *volinfo, char *snapname, dict_t *dict, // for now continue the snap, if getting description fails. ret = glusterd_snap_create (volinfo, snap_volume, description, cg_id, - cg_name); + cg, cg_name); if (ret) { gf_log (this->name, GF_LOG_ERROR, "creating the" "snap object failed for the volume %s", @@ -4107,11 +4125,11 @@ glusterd_snapshot_create_commit (dict_t *dict, char **op_errstr, */ if (is_cg) { ret = glusterd_do_snap (volinfo, tmp, dict, - is_cg, cg_id, i, *snap_volid, name); + cg, cg_id, i, *snap_volid, name); } else { ret = glusterd_do_snap (volinfo, tmp, dict, - is_cg, cg_id, i, *snap_volid, NULL); + cg, cg_id, i, *snap_volid, NULL); } if (ret) { gf_log (this->name, GF_LOG_WARNING, "taking the " |