diff options
author | Avra Sengupta <asengupt@redhat.com> | 2013-12-18 01:01:47 +0000 |
---|---|---|
committer | Avra Sengupta <asengupt@redhat.com> | 2014-01-07 15:26:25 +0530 |
commit | 4afa88d6cc39be11f122489900af07b57a50fcc4 (patch) | |
tree | d7a829bc7be6e98a2979ff35410ddccd674395bb /xlators/mgmt/glusterd/src/glusterd-utils.c | |
parent | a783136347ed2716f3f0ee0ca284f291f4e29652 (diff) |
glusterd/snapshot: Defining snap-max-soft-limit as a percentage of snap-max-hard-limit.
This patch also prohibits configuration of snap-max-hard-limit
and snap-max-soft-limit for snap volumes. Also displaying the
snapshot configs by reading data only from local node, as all
config data will be in sync across the cluster.
Change-Id: I635b925c02ed5b108cd10c7193b154ad82d5afad
BUG: 1043792
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 80 |
1 files changed, 74 insertions, 6 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 6947facbd..6e8ef080c 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -463,8 +463,7 @@ glusterd_volinfo_new (glusterd_volinfo_t **volinfo) snprintf (new_volinfo->parent_volname, GLUSTERD_MAX_VOLUME_NAME, "N/A"); - new_volinfo->snap_max_hard_limit = GLUSTERD_SNAPS_MAX_LIMIT; - new_volinfo->snap_max_soft_limit = GLUSTERD_SNAPS_MAX_LIMIT; + new_volinfo->snap_max_hard_limit = GLUSTERD_SNAPS_MAX_HARD_LIMIT; new_volinfo->xl = THIS; @@ -7855,9 +7854,13 @@ out: int glusterd_snap_config_use_rsp_dict (dict_t *dst, dict_t *src) { + char buf[PATH_MAX] = ""; + char *volname = NULL; int ret = -1; - uint64_t value = 0; int config_command = 0; + uint64_t i = 0; + uint64_t value = 0; + uint64_t voldisplaycount = 0; if (!dst || !src) { gf_log ("", GF_LOG_ERROR, "Source or Destination " @@ -7881,13 +7884,78 @@ glusterd_snap_config_use_rsp_dict (dict_t *dst, dict_t *src) gf_log ("", GF_LOG_ERROR, "Unable to set snap_max_hard_limit"); goto out; } + } else { + /* Received dummy response from other nodes */ + ret = 0; + goto out; } ret = dict_get_uint64 (src, "snap-max-soft-limit", &value); - if (!ret) { - ret = dict_set_uint64 (dst, "snap-max-soft-limit", value); + if (ret) { + 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"); + goto out; + } + + ret = dict_get_uint64 (src, "voldisplaycount", &voldisplaycount); + if (ret) { + gf_log ("", GF_LOG_ERROR, "Unable to get voldisplaycount"); + goto out; + } + + ret = dict_set_uint64 (dst, "voldisplaycount", voldisplaycount); + if (ret) { + gf_log ("", GF_LOG_ERROR, "Unable to set voldisplaycount"); + goto out; + } + + for (i = 0; i < voldisplaycount; i++) { + snprintf (buf, sizeof(buf), "volume%ld-volname", i); + ret = dict_get_str (src, buf, &volname); if (ret) { - gf_log ("", GF_LOG_ERROR, "Unable to set snap_max_soft_limit"); + gf_log ("", GF_LOG_ERROR, + "Unable to get %s", buf); + goto out; + } + ret = dict_set_str (dst, buf, volname); + if (ret) { + gf_log ("", GF_LOG_ERROR, + "Unable to set %s", buf); + goto out; + } + + snprintf (buf, sizeof(buf), + "volume%ld-snap-max-hard-limit", i); + ret = dict_get_uint64 (src, buf, &value); + if (ret) { + gf_log ("", GF_LOG_ERROR, + "Unable to get %s", buf); + goto out; + } + ret = dict_set_uint64 (dst, buf, value); + if (ret) { + gf_log ("", GF_LOG_ERROR, + "Unable to set %s", buf); + goto out; + } + + snprintf (buf, sizeof(buf), + "volume%ld-snap-max-soft-limit-value", i); + ret = dict_get_uint64 (src, buf, &value); + if (ret) { + gf_log ("", GF_LOG_ERROR, + "Unable to get %s", buf); + goto out; + } + ret = dict_set_uint64 (dst, buf, value); + if (ret) { + gf_log ("", GF_LOG_ERROR, + "Unable to set %s", buf); goto out; } } |