diff options
author | Pranith Kumar K <pkarampu@redhat.com> | 2014-12-29 15:32:28 +0530 |
---|---|---|
committer | Krishnan Parthasarathi <kparthas@redhat.com> | 2015-01-20 02:24:24 -0800 |
commit | 7510d8edf4e7bea50e0c1f041202f063a5d138af (patch) | |
tree | 77814773e915cedccbcb9149ff8c86ca704514fa /libglusterfs | |
parent | 1ee8ce725f0e70f45419aa0e2f4d85db7223d766 (diff) |
mgmt/glusterd: Implement Volume heal enable/disable
For volumes with replicate, disperse xlators, self-heal daemon should do
healing. This patch provides enable/disable functionality for the xlators to be
part of self-heal-daemon. Replicate already had this functionality with
'gluster volume set cluster.self-heal-daemon on/off'. But this patch makes it
uniform for both types of volumes. Internally it still does 'volume set' based
on the volume type.
Change-Id: Ie0f3799b74c2afef9ac658ef3d50dce3e8072b29
BUG: 1177601
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/9358
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Xavier Hernandez <xhernandez@datalab.es>
Tested-by: Krishnan Parthasarathi <kparthas@redhat.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r-- | libglusterfs/src/common-utils.c | 18 | ||||
-rw-r--r-- | libglusterfs/src/common-utils.h | 2 |
2 files changed, 20 insertions, 0 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c index 3bd7c3d8fa2..6882b6c3178 100644 --- a/libglusterfs/src/common-utils.c +++ b/libglusterfs/src/common-utils.c @@ -3630,3 +3630,21 @@ recursive_rmdir (const char *delete_path) out: return ret; } +/* + * Input: Array of strings 'array' terminating in NULL + * string 'elem' to be searched in the array + * + * Output: Index of the element in the array if found, '-1' otherwise + */ +int +gf_get_index_by_elem (char **array, char *elem) +{ + int i = 0; + + for (i = 0; array[i]; i++) { + if (strcmp (elem, array[i]) == 0) + return i; + } + + return -1; +} diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h index 2a46f768e75..eaede81a5c8 100644 --- a/libglusterfs/src/common-utils.h +++ b/libglusterfs/src/common-utils.h @@ -677,4 +677,6 @@ gf_build_absolute_path (char *current_path, char *relative_path, char **path); int recursive_rmdir (const char *delete_path); +int +gf_get_index_by_elem (char **array, char *elem); #endif /* _COMMON_UTILS_H */ |