summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnand Avati <avati@gluster.com>2011-08-19 14:56:13 +0530
committerAnand Avati <avati@gluster.com>2011-08-19 03:06:19 -0700
commitdd2c197c1d5d5942a65c860997ec1d5793ef249f (patch)
treeb64d3d9af03c042f2da4a9f7cb349d5a0f8bb508
parent0143a2ef653d0f7a337c8220f127655dadbca942 (diff)
option validation: further fixes
fixes in option handling changes Change-Id: I0a44cdb088e3f08cd43d583a580736d0903fa88c BUG: 3415 Reviewed-on: http://review.gluster.com/261 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@gluster.com>
-rw-r--r--libglusterfs/src/options.c7
-rw-r--r--xlators/cluster/afr/src/afr.c15
-rw-r--r--xlators/performance/write-behind/src/write-behind.c2
-rw-r--r--xlators/protocol/client/src/client.c3
4 files changed, 22 insertions, 5 deletions
diff --git a/libglusterfs/src/options.c b/libglusterfs/src/options.c
index 37302e0daec..dee3c91854f 100644
--- a/libglusterfs/src/options.c
+++ b/libglusterfs/src/options.c
@@ -501,14 +501,13 @@ xlator_option_validate_addr (xlator_t *xl, const char *key, const char *value,
if (!valid_internet_address ((char *)value)) {
snprintf (errstr, 256,
- "internet address '%s' does not conform to standards.",
+ "internet address '%s' does not conform to standards.",
value);
gf_log (xl->name, GF_LOG_ERROR, "%s", errstr);
+ if (op_errstr)
+ *op_errstr = gf_strdup (errstr);
}
- if (ret && op_errstr)
- *op_errstr = gf_strdup (errstr);
-
ret = 0;
return ret;
diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c
index 289a27d6079..903060f4934 100644
--- a/xlators/cluster/afr/src/afr.c
+++ b/xlators/cluster/afr/src/afr.c
@@ -87,6 +87,18 @@ xlator_subvolume_index (xlator_t *this, xlator_t *subvol)
int
+xlator_subvolume_count (xlator_t *this)
+{
+ int i = 0;
+ xlator_list_t *list = NULL;
+
+ for (list = this->children; list; list = list->next)
+ i++;
+ return i;
+}
+
+
+int
reconfigure (xlator_t *this, dict_t *options)
{
afr_private_t * priv = NULL;
@@ -186,6 +198,7 @@ init (xlator_t *this)
priv = this->private;
priv->read_child = -1;
+
GF_OPTION_INIT ("read-subvolume", read_subvol, xlator, out);
if (read_subvol) {
priv->read_child = xlator_subvolume_index (this, read_subvol);
@@ -245,6 +258,8 @@ init (xlator_t *this)
priv->wait_count = 1;
+ child_count = xlator_subvolume_count (this);
+
priv->child_count = child_count;
LOCK_INIT (&priv->lock);
diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c
index 1eff4385ae3..361c90d7eb2 100644
--- a/xlators/performance/write-behind/src/write-behind.c
+++ b/xlators/performance/write-behind/src/write-behind.c
@@ -3035,7 +3035,7 @@ struct volume_options options[] = {
},
{ .key = {"disable-for-first-nbytes"},
.type = GF_OPTION_TYPE_SIZET,
- .min = 1,
+ .min = 0,
.max = 1 * GF_UNIT_MB,
.default_value = "0",
},
diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c
index 355b0d16043..c0d52488a9c 100644
--- a/xlators/protocol/client/src/client.c
+++ b/xlators/protocol/client/src/client.c
@@ -2365,6 +2365,9 @@ struct volume_options options[] = {
{ .key = {"remote-host"},
.type = GF_OPTION_TYPE_INTERNET_ADDRESS
},
+ { .key = {"remote-port"},
+ .type = GF_OPTION_TYPE_INT,
+ },
{ .key = {"remote-subvolume"},
.type = GF_OPTION_TYPE_ANY
},