diff options
author | Sachin Pandit <spandit@redhat.com> | 2014-03-27 08:30:29 +0530 |
---|---|---|
committer | Rajesh Joseph <rjoseph@redhat.com> | 2014-03-27 09:12:31 -0700 |
commit | 3b2408904dbbfb7987a4792fa71ba3fe61f18398 (patch) | |
tree | 472ce338fb3c9d853d4857cc0327a6fb4e67778c /xlators/mgmt | |
parent | ef32f3059b9dae18f9e76e0385eb01674dc6b94e (diff) |
glusterd/snapshot : glusterd-utils related fix for upstream review comments
Change-Id: I7add37a8e8a7d68de9d4c09110987ed1afd2f86c
Signed-off-by: Sachin Pandit <spandit@redhat.com>
Reviewed-on: http://review.gluster.org/7356
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
Tested-by: Rajesh Joseph <rjoseph@redhat.com>
Diffstat (limited to 'xlators/mgmt')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 58 |
1 files changed, 28 insertions, 30 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 00c551e4d..a3685dbeb 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -427,12 +427,6 @@ glusterd_volinfo_new (glusterd_volinfo_t **volinfo) { glusterd_volinfo_t *new_volinfo = NULL; int32_t ret = -1; - xlator_t *this = NULL; - glusterd_conf_t *conf = NULL; - - this = THIS; - - conf = this->private; GF_ASSERT (volinfo); @@ -543,14 +537,18 @@ out: * * @return 0 on success else -1 */ -int +int32_t glusterd_brickinfo_dup (glusterd_brickinfo_t *brickinfo, glusterd_brickinfo_t *dup_brickinfo) { - int ret = -1; + int32_t ret = -1; + xlator_t *this = NULL; - GF_ASSERT (brickinfo); - GF_ASSERT (dup_brickinfo); + this = THIS; + GF_ASSERT (this); + + GF_VALIDATE_OR_GOTO (this->name, brickinfo, out); + GF_VALIDATE_OR_GOTO (this->name, dup_brickinfo, out); strcpy (dup_brickinfo->hostname, brickinfo->hostname); strcpy (dup_brickinfo->path, brickinfo->path); @@ -639,7 +637,8 @@ glusterd_snap_volinfo_restore (glusterd_volinfo_t *new_volinfo, } } - list_add_tail (&new_brickinfo->brick_list, &new_volinfo->bricks); + list_add_tail (&new_brickinfo->brick_list, + &new_volinfo->bricks); /* ownership of new_brickinfo is passed to new_volinfo */ new_brickinfo = NULL; } @@ -1611,7 +1610,8 @@ glusterd_volume_start_glusterfs (glusterd_volinfo_t *volinfo, } if (volinfo->is_snap_volume) { - snprintf (volfile, PATH_MAX, "/snaps/%s/%s.%s.%s", + snprintf (volfile, PATH_MAX,"/%s/%s/%s.%s.%s", + GLUSTERD_VOL_SNAP_DIR_PREFIX, volinfo->snapshot->snapname, volinfo->volname, brickinfo->hostname, exp_path); } else { @@ -2920,7 +2920,6 @@ glusterd_import_volinfo (dict_t *vols, int count, char *rb_id_str = NULL; int op_version = 0; int client_op_version = 0; - uint32_t is_snap_volume = 0; GF_ASSERT (vols); GF_ASSERT (volinfo); @@ -2934,14 +2933,14 @@ glusterd_import_volinfo (dict_t *vols, int count, memset (key, 0, sizeof (key)); snprintf (key, sizeof (key), "volume%d.is_snap_volume", count); - ret = dict_get_uint32 (vols, key, &is_snap_volume); + ret = dict_get_uint32 (vols, key, &new_volinfo->is_snap_volume); if (ret) { snprintf (msg, sizeof (msg), "%s missing in payload for %s", key, volname); goto out; } - if (is_snap_volume == _gf_true) { + if (new_volinfo->is_snap_volume == _gf_true) { gf_log (THIS->name, GF_LOG_DEBUG, "Not syncing snap volume %s", volname); ret = 0; @@ -3073,14 +3072,6 @@ glusterd_import_volinfo (dict_t *vols, int count, goto out; } - snprintf (key, sizeof (key), "volume%d.is_snap_volume", count); - ret = dict_get_uint32 (vols, key, &new_volinfo->is_snap_volume); - if (ret) { - snprintf (msg, sizeof (msg), "%s missing in payload for %s", - key, volname); - goto out; - } - snprintf (key, sizeof (key), "volume%d.snap-max-hard-limit", count); ret = dict_get_uint64 (vols, key, &new_volinfo->snap_max_hard_limit); if (ret) { @@ -7694,7 +7685,8 @@ glusterd_snap_config_use_rsp_dict (dict_t *dst, dict_t *src) if (!ret) { ret = dict_set_uint64 (dst, "snap-max-hard-limit", value); if (ret) { - gf_log ("", GF_LOG_ERROR, "Unable to set snap_max_hard_limit"); + gf_log ("", GF_LOG_ERROR, + "Unable to set snap_max_hard_limit"); goto out; } } else { @@ -7705,25 +7697,31 @@ glusterd_snap_config_use_rsp_dict (dict_t *dst, dict_t *src) ret = dict_get_uint64 (src, "snap-max-soft-limit", &value); if (ret) { - gf_log ("", GF_LOG_ERROR, "Unable to get snap_max_soft_limit"); + gf_log ("", GF_LOG_ERROR, + "Unable to get snap_max_soft_limit"); goto out; } ret = dict_set_uint64 (dst, "snap-max-soft-limit", value); if (ret) { - gf_log ("", GF_LOG_ERROR, "Unable to set snap_max_soft_limit"); + gf_log ("", GF_LOG_ERROR, + "Unable to set snap_max_soft_limit"); goto out; } - ret = dict_get_uint64 (src, "voldisplaycount", &voldisplaycount); + ret = dict_get_uint64 (src, "voldisplaycount", + &voldisplaycount); if (ret) { - gf_log ("", GF_LOG_ERROR, "Unable to get voldisplaycount"); + gf_log ("", GF_LOG_ERROR, + "Unable to get voldisplaycount"); goto out; } - ret = dict_set_uint64 (dst, "voldisplaycount", voldisplaycount); + ret = dict_set_uint64 (dst, "voldisplaycount", + voldisplaycount); if (ret) { - gf_log ("", GF_LOG_ERROR, "Unable to set voldisplaycount"); + gf_log ("", GF_LOG_ERROR, + "Unable to set voldisplaycount"); goto out; } |