diff options
author | Kaushik BV <kaushikbv@gluster.com> | 2011-04-15 09:15:23 +0000 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2011-04-15 23:33:22 -0700 |
commit | 5c9c2555911d8d7131e3c0d918f6ee9c0b3b612f (patch) | |
tree | 7e1ee383e014af09e3653ce1d400a9684ad1df5f /xlators | |
parent | 2479f442ca8f9e2dd23988e1f2dc20238443a769 (diff) |
mgmt/glusterd: does not allow disabling of indexing (xtime marking), if a gsync session is active.
Signed-off-by: Kaushik BV <kaushikbv@gluster.com>
Signed-off-by: Anand Avati <avati@gluster.com>
BUG: 2559 (provide two options in CLI for gluster volume gsync indexing <volname> <enable|disable>)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2559
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-op-sm.c | 4 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-op-sm.h | 2 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volgen.c | 62 |
3 files changed, 63 insertions, 5 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index 578b39363ed..64eb688efb2 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -110,8 +110,6 @@ typedef struct glusterd_quota_child_info { static int glusterd_restart_brick_servers (glusterd_volinfo_t *); -static int -glusterd_check_gsync_running (glusterd_volinfo_t *volinfo, gf_boolean_t *flag); char* @@ -2351,7 +2349,7 @@ out: return ret; } -static int +int glusterd_check_gsync_running (glusterd_volinfo_t *volinfo, gf_boolean_t *flag) { diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.h b/xlators/mgmt/glusterd/src/glusterd-op-sm.h index 52e36ed3a71..d550b108cca 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.h +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.h @@ -306,4 +306,6 @@ gsync_status (char *master, char *slave, int *status); int glusterd_gsync_get_param_file (char *prmfile, const char *ext, char *master, char *slave, char *gl_workdir); +int +glusterd_check_gsync_running (glusterd_volinfo_t *volinfo, gf_boolean_t *flag); #endif diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c index 1cea50bda2b..d5c5d5bdb9e 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volgen.c +++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c @@ -35,6 +35,7 @@ #include "glusterd-mem-types.h" #include "cli1.h" #include "glusterd-volgen.h" +#include "glusterd-op-sm.h" /* dispatch table for VOLUME SET @@ -155,6 +156,7 @@ static struct volopt_map_entry glusterd_volopt_map[] = { {VKEY_PERF_STAT_PREFETCH, "performance/stat-prefetch", "!perf", "on", NO_DOC, 0}, {VKEY_MARKER_XTIME, "features/marker", "xtime", "off", NO_DOC, OPT_FLAG_FORCE}, + {VKEY_MARKER_XTIME, "features/marker", "!xtime", "off", NO_DOC, OPT_FLAG_FORCE}, {"nfs.enable-ino32", "nfs/server", "nfs.enable-ino32", NULL, GLOBAL_DOC, 0}, {"nfs.mem-factor", "nfs/server", "nfs.mem-factor", NULL, GLOBAL_DOC, 0}, @@ -1169,13 +1171,69 @@ loglevel_option_handler (glusterfs_graph_t *graph, } static int +server_check_marker_off (struct volopt_map_entry *vme, + glusterd_volinfo_t *volinfo) +{ + gf_boolean_t bool = _gf_false; + int ret = 0; + + GF_ASSERT (volinfo); + GF_ASSERT (vme); + + if (strcmp (vme->option, "!xtime") != 0) + return 0; + + ret = gf_string2boolean (vme->value, &bool); + if (ret || bool) + goto out; + + ret = glusterd_volinfo_get_boolean (volinfo, VKEY_MARKER_XTIME); + if (ret < 0) { + gf_log ("", GF_LOG_WARNING, "failed to get the marker status"); + ret = -1; + goto out; + } + + if (ret) { + bool = _gf_false; + ret = glusterd_check_gsync_running (volinfo, &bool); + + if (bool) { + gf_log ("", GF_LOG_WARNING, "Gsync sessions active" + "for the volume %s, cannot disable marker " + ,volinfo->volname); + ret = -1; + goto out; + } + + if (ret) { + gf_log ("", GF_LOG_WARNING, "Unable to get the status" + " of active gsync session"); + goto out; + } + } + + ret = 0; + out: + gf_log ("", GF_LOG_DEBUG, "Returning %d", ret); + return ret; + +} + +static int server_spec_option_handler (glusterfs_graph_t *graph, struct volopt_map_entry *vme, void *param) { - int ret = 0; + int ret = 0; + glusterd_volinfo_t *volinfo = NULL; + + volinfo = param; ret = server_auth_option_handler (graph, vme, NULL); if (!ret) + ret = server_check_marker_off (vme, volinfo); + + if (!ret) ret = loglevel_option_handler (graph, vme, "brick"); return ret; @@ -1272,7 +1330,7 @@ server_graph_builder (glusterfs_graph_t *graph, glusterd_volinfo_t *volinfo, if (ret) return -1; - ret = volgen_graph_set_options_generic (graph, set_dict, NULL, + ret = volgen_graph_set_options_generic (graph, set_dict, volinfo, &server_spec_option_handler); return ret; |