diff options
author | Kaushik BV <kaushikbv@gluster.com> | 2011-08-16 13:10:41 +0530 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2011-08-18 22:42:48 -0700 |
commit | ce0aaba383b97dca52d11c18846a8154d529bf8a (patch) | |
tree | 494673947140ddded481e4532ce6c340eac09446 /xlators/cluster/dht | |
parent | b7596882b3ceba77bd812d2e5757d9fa3aa0fa17 (diff) |
mgmt/Glusterd: Implementation volume set help/help-xml
Change-Id: I0c54fd1c15550e5e5551e95ed32adb14d8029fab
Reviewed-on: http://review.gluster.com/238
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@gluster.com>
Diffstat (limited to 'xlators/cluster/dht')
-rw-r--r-- | xlators/cluster/dht/src/dht.c | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/xlators/cluster/dht/src/dht.c b/xlators/cluster/dht/src/dht.c index ffdcce340..0958a8bab 100644 --- a/xlators/cluster/dht/src/dht.c +++ b/xlators/cluster/dht/src/dht.c @@ -34,7 +34,7 @@ - handle all cases in self heal layout reconstruction - complete linkfile selfheal */ - +struct volume_options options[]; void dht_layout_dump (dht_layout_t *layout, const char *prefix) @@ -359,6 +359,7 @@ init (xlator_t *this) int ret = -1; int i = 0; uint32_t temp_free_disk = 0; + char *def_val = NULL; GF_VALIDATE_OR_GOTO ("dht", this, err); @@ -401,8 +402,27 @@ init (xlator_t *this) gf_string2boolean (temp_str, &conf->use_readdirp); } - conf->disk_unit = 'p'; - conf->min_free_disk = 10; + if (xlator_get_volopt_info (&this->volume_options, "min-free-disk", + &def_val, NULL)) { + gf_log (this->name, GF_LOG_ERROR, "Default value of " + " min-free-disk not found"); + ret = -1; + goto err; + } else { + if (gf_string2percent (def_val, &temp_free_disk) == 0) { + if (temp_free_disk > 100) { + gf_string2bytesize (temp_str, + &conf->min_free_disk); + conf->disk_unit = 'b'; + } else { + conf->min_free_disk = (uint64_t)temp_free_disk; + conf->disk_unit = 'p'; + } + } else { + gf_string2bytesize (temp_str, &conf->min_free_disk); + conf->disk_unit = 'b'; + } + } if (dict_get_str (this->options, "min-free-disk", &temp_str) == 0) { if (gf_string2percent (temp_str, &temp_free_disk) == 0) { @@ -550,6 +570,9 @@ struct volume_options options[] = { }, { .key = {"min-free-disk"}, .type = GF_OPTION_TYPE_PERCENT_OR_SIZET, + .default_value = "10%", + .description = "Percentage/Size of disk space that must be " + "kept free." }, { .key = {"unhashed-sticky-bit"}, .type = GF_OPTION_TYPE_BOOL |