summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd.c
diff options
context:
space:
mode:
authorKrishnan Parthasarathi <kparthas@redhat.com>2012-10-11 22:43:17 +0530
committerAnand Avati <avati@redhat.com>2012-10-11 12:04:27 -0700
commit6be13228c45188b104ffde22cee36fb24db8484d (patch)
tree22f5a086de7cca2d68ce8188b14e650398769a62 /xlators/mgmt/glusterd/src/glusterd.c
parent1f2dbafc72e6b4942a47dacb3899665118d7ec6b (diff)
glusterd: volume-start, add-brick and remove-brick to use synctask framework
- Added volume-id validation to glusterd-syncop code. - All daemons are restarted using synctasks in init(). - glusterd_brick_start has wait/nowait variants to support volume commands using synctask framework and those that aren't. Change-Id: Ieec26fe1ea7e5faac88cc7798d93e4cc2b399d34 BUG: 862834 Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com> Reviewed-on: http://review.gluster.org/3969 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.c34
1 files changed, 29 insertions, 5 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c
index fdcc38d8068..164009bfe4d 100644
--- a/xlators/mgmt/glusterd/src/glusterd.c
+++ b/xlators/mgmt/glusterd/src/glusterd.c
@@ -735,6 +735,29 @@ _install_mount_spec (dict_t *opts, char *key, data_t *value, void *data)
return -1;
}
+static int
+glusterd_default_synctask_cbk (int ret, call_frame_t *frame, void *opaque)
+{
+ return ret;
+}
+
+static int
+glusterd_launch_synctask (xlator_t *this, synctask_fn_t fn)
+{
+ glusterd_conf_t *priv = NULL;
+ int ret = -1;
+
+ priv = this->private;
+
+ ret = synctask_new (this->ctx->env, fn,
+ glusterd_default_synctask_cbk, NULL, priv);
+
+ if (ret)
+ gf_log (this->name, GF_LOG_CRITICAL, "Failed to create synctask"
+ "for starting process");
+ return ret;
+}
+
/*
* init - called during glusterd initialization
*
@@ -1016,16 +1039,17 @@ init (xlator_t *this)
if (ret)
goto out;
- glusterd_restart_bricks (conf);
- ret = glusterd_restart_gsyncds (conf);
- if (ret)
- goto out;
+ glusterd_launch_synctask (this,
+ (synctask_fn_t) glusterd_restart_bricks);
+ glusterd_launch_synctask (this,
+ (synctask_fn_t) glusterd_restart_gsyncds);
+ glusterd_launch_synctask (this,
+ (synctask_fn_t) glusterd_restart_rebalance);
ret = glusterd_hooks_spawn_worker (this);
if (ret)
goto out;
- glusterd_restart_rebalance (conf);
ret = 0;
out:
if (ret < 0) {