diff options
Diffstat (limited to 'xlators/mgmt')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-op-sm.c | 61 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-rebalance.c | 2 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-replace-brick.c | 4 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 3 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volume-ops.c | 2 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd.h | 2 |
6 files changed, 46 insertions, 28 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index f9813db12f5..d96d6717eeb 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -391,11 +391,25 @@ glusterd_op_stage_set_volume (dict_t *dict, char **op_errstr) global_opt = _gf_false; sprintf (str, "key%d", count); ret = dict_get_str (dict, str, &key); - - if (ret) break; + sprintf (str, "value%d", count); + ret = dict_get_str (dict, str, &value); + if (ret) { + gf_log (this->name, GF_LOG_ERROR, + "invalid key,value pair in 'volume set'"); + ret = -1; + goto out; + } + + if (strcmp (key, "memory-accounting") == 0) { + gf_log (this->name, GF_LOG_INFO, + "enabling memory accounting for volume %s", + volname); + ret = 0; + goto out; + } exists = glusterd_check_option_exists (key, &key_fixed); if (exists == -1) { ret = -1; @@ -416,16 +430,6 @@ glusterd_op_stage_set_volume (dict_t *dict, char **op_errstr) goto out; } - sprintf (str, "value%d", count); - ret = dict_get_str (dict, str, &value); - - if (ret) { - gf_log (this->name, GF_LOG_ERROR, - "invalid key,value pair in 'volume set'"); - ret = -1; - goto out; - } - if (key_fixed) key = key_fixed; @@ -1008,24 +1012,9 @@ glusterd_op_set_volume (dict_t *dict) global_opt = _gf_false; sprintf (str, "key%d", count); ret = dict_get_str (dict, str, &key); - if (ret) break; - if (!ret) { - ret = glusterd_check_option_exists (key, &key_fixed); - GF_ASSERT (ret); - if (ret == -1) { - key_fixed = NULL; - goto out; - } - ret = 0; - } - - ret = glusterd_check_globaloption (key); - if (ret) - global_opt = _gf_true; - sprintf (str, "value%d", count); ret = dict_get_str (dict, str, &value); if (ret) { @@ -1035,6 +1024,22 @@ glusterd_op_set_volume (dict_t *dict) goto out; } + if (strcmp (key, "memory-accounting") == 0) { + ret = gf_string2boolean (value, + &volinfo->memory_accounting); + goto out; + } + ret = glusterd_check_option_exists (key, &key_fixed); + GF_ASSERT (ret); + if (ret == -1) { + key_fixed = NULL; + goto out; + } + + ret = glusterd_check_globaloption (key); + if (ret) + global_opt = _gf_true; + if (!global_opt) value = gf_strdup (value); @@ -1067,7 +1072,7 @@ glusterd_op_set_volume (dict_t *dict) } } - if ( count == 1 ) { + if (count == 1) { gf_log (this->name, GF_LOG_ERROR, "No options received "); ret = -1; goto out; diff --git a/xlators/mgmt/glusterd/src/glusterd-rebalance.c b/xlators/mgmt/glusterd/src/glusterd-rebalance.c index 5d567e37a8a..36435868602 100644 --- a/xlators/mgmt/glusterd/src/glusterd-rebalance.c +++ b/xlators/mgmt/glusterd/src/glusterd-rebalance.c @@ -327,6 +327,8 @@ glusterd_handle_defrag_start (glusterd_volinfo_t *volinfo, char *op_errstr, runner_argprintf (&runner, "%s",pidfile); runner_add_arg (&runner, "-l"); runner_argprintf (&runner, logfile); + if (volinfo->memory_accounting) + runner_add_arg (&runner, "--mem-accounting"); ret = runner_run_reuse (&runner); if (ret) { diff --git a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c index 01bc974b75f..ca127f7a8ea 100644 --- a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c +++ b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c @@ -635,6 +635,8 @@ rb_spawn_dst_brick (glusterd_volinfo_t *volinfo, priv->workdir, volinfo->volname); runner_add_arg (&runner, "--xlator-option"); runner_argprintf (&runner, "src-server.listen-port=%d", port); + if (volinfo->memory_accounting) + runner_add_arg (&runner, "--mem-accounting"); ret = runner_run (&runner); if (ret) { @@ -671,6 +673,8 @@ rb_spawn_glusterfs_client (glusterd_volinfo_t *volinfo, priv->workdir, volinfo->volname); runner_argprintf (&runner, "%s/vols/%s/"RB_CLIENT_MOUNTPOINT, priv->workdir, volinfo->volname); + if (volinfo->memory_accounting) + runner_add_arg (&runner, "--mem-accounting"); ret = runner_run (&runner); if (ret) { diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 64b7ba9ad1b..3c084635166 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -1236,6 +1236,9 @@ glusterd_volume_start_glusterfs (glusterd_volinfo_t *volinfo, runner_argprintf (&runner, "%s-server.listen-port=%d", volinfo->volname, port); + if (volinfo->memory_accounting) + runner_add_arg (&runner, "--mem-accounting"); + runner_log (&runner, "", GF_LOG_DEBUG, "Starting GlusterFS"); ret = runner_run (&runner); diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c index ef338658b97..d6e58c1b844 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c @@ -1665,6 +1665,8 @@ glusterd_clearlocks_mount (glusterd_volinfo_t *volinfo, char **xl_opts, runner_add_arg (&runner, "-l"); runner_argprintf (&runner, DEFAULT_LOG_FILE_DIRECTORY "/%s-clearlocks-mnt.log", volinfo->volname); + if (volinfo->memory_accounting) + runner_add_arg (&runner, "--mem-accounting"); for (i = 0; i < volinfo->brick_count && xl_opts[i]; i++) { runner_add_arg (&runner, "--xlator-option"); diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h index 7a6ee653f0f..44934b2fc80 100644 --- a/xlators/mgmt/glusterd/src/glusterd.h +++ b/xlators/mgmt/glusterd/src/glusterd.h @@ -244,6 +244,8 @@ struct glusterd_volinfo_ { int decommission_in_progress; xlator_t *xl; + + gf_boolean_t memory_accounting; }; typedef enum gd_node_type_ { |