diff options
author | Amar Tumballi <amar@gluster.com> | 2011-12-20 14:54:35 +0530 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2012-03-21 11:58:11 -0700 |
commit | c3bdb1d4c6c4491afdf1ba26bb0d6204270cc058 (patch) | |
tree | f1d3e6e9adb2146754ee1a0ec12bd0ea4014ef03 /xlators/mgmt/glusterd/src/glusterd-utils.c | |
parent | 8217148c97a474a9eab4a309589ceb8ff281f5c6 (diff) |
glusterd: bring in feature to use syncop for mgmt ops
* new sycnop routines added to mgmt program
* one should not use 'glusterd_op_begin()', instead can use the
synctask framework, 'glusterd_op_begin_synctask()'
* currently using for below operations:
'volume start', 'volume rebalance', 'volume quota',
'volume replace-brick' and 'volume add-brick'
Change-Id: I0bee76d06790d5c5bb5db15d443b44af0e21f1c0
BUG: 762935
Signed-off-by: Amar Tumballi <amar@gluster.com>
Reviewed-on: http://review.gluster.com/479
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 50 |
1 files changed, 37 insertions, 13 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 6bfcd6c00..68d2473c7 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -1244,12 +1244,12 @@ glusterd_volume_start_glusterfs (glusterd_volinfo_t *volinfo, runner_log (&runner, "", GF_LOG_DEBUG, "Starting GlusterFS"); ret = runner_run (&runner); + if (ret) + goto out; - if (ret == 0) { - //pmap_registry_bind (THIS, port, brickinfo->path); - brickinfo->port = port; - brickinfo->rdma_port = rdma_port; - } + //pmap_registry_bind (THIS, port, brickinfo->path); + brickinfo->port = port; + brickinfo->rdma_port = rdma_port; connect: ret = glusterd_brick_connect (volinfo, brickinfo); @@ -3213,18 +3213,23 @@ out: return ret; } -int -glusterd_restart_bricks (glusterd_conf_t *conf) +void * +glusterd_brick_restart_proc (void *data) { - glusterd_volinfo_t *volinfo = NULL; - glusterd_brickinfo_t *brickinfo = NULL; - int ret = 0; - gf_boolean_t start_nodesvcs = _gf_false; + glusterd_conf_t *conf = NULL; + glusterd_volinfo_t *volinfo = NULL; + glusterd_brickinfo_t *brickinfo = NULL; + gf_boolean_t start_nodesvcs = _gf_false; + + conf = data; GF_ASSERT (conf); + /* set the proper 'THIS' value as it is new thread */ + THIS = conf->xl; + list_for_each_entry (volinfo, &conf->volumes, vol_list) { - //If volume status is not started, do not proceed + /* If volume status is not started, do not proceed */ if (volinfo->status == GLUSTERD_STATUS_STARTED) { list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) { @@ -3233,8 +3238,28 @@ glusterd_restart_bricks (glusterd_conf_t *conf) start_nodesvcs = _gf_true; } } + if (start_nodesvcs) glusterd_nodesvcs_handle_graph_change (NULL); + + return NULL; +} + +int +glusterd_restart_bricks (glusterd_conf_t *conf) +{ + int ret = 0; + + conf->xl = THIS; + ret = pthread_create (&conf->brick_thread, NULL, + glusterd_brick_restart_proc, + conf); + if (ret != 0) { + gf_log (THIS->name, GF_LOG_DEBUG, + "pthread_create() failed (%s)", + strerror (errno)); + } + return ret; } @@ -3255,7 +3280,6 @@ _local_gsyncd_start (dict_t *this, char *key, data_t *value, void *data) return; uuid_len = (slave - value->data - 1); - strncpy (uuid_str, (char*)value->data, uuid_len); glusterd_start_gsync (volinfo, slave, uuid_str, NULL); } |