diff options
author | Krishnan Parthasarathi <kp@gluster.com> | 2011-10-31 18:05:23 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2011-11-18 04:24:42 -0800 |
commit | 9b391694eb53b73a5284bd5294ee66a690e7398d (patch) | |
tree | 07850891c8e9f0e374e01cc8baf1cda03ea8f9a4 /xlators/mgmt | |
parent | 1e652740f74298637577e9861cb5092091404d29 (diff) |
glusterd:replace-brick subcmds should detect src_brick offline.
Change-Id: I686494c9c2d01fd027d333b267334842cb1dc875
BUG: 3043
Reviewed-on: http://review.gluster.com/651
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amar@gluster.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/mgmt')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-replace-brick.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c index e883b289f9f..48db4ab3ced 100644 --- a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c +++ b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c @@ -243,6 +243,12 @@ glusterd_op_stage_replace_brick (dict_t *dict, char **op_errstr, glusterd_brickinfo_t *dst_brickinfo = NULL; gf_boolean_t is_run = _gf_false; dict_t *ctx = NULL; + glusterd_conf_t *priv = NULL; + char voldir[PATH_MAX] = {0}; + char pidfile[PATH_MAX] = {0}; + + priv = THIS->private; + GF_ASSERT (priv); ret = dict_get_str (dict, "src-brick", &src_brick); @@ -416,6 +422,20 @@ glusterd_op_stage_replace_brick (dict_t *dict, char **op_errstr, } } + GLUSTERD_GET_VOLUME_DIR (voldir, volinfo, priv); + GLUSTERD_GET_BRICK_PIDFILE (pidfile, voldir, + src_brickinfo->hostname, + src_brickinfo->path); + if (!glusterd_is_service_running (pidfile, NULL)) { + snprintf(msg, sizeof(msg), "Source brick %s:%s " + "is not online.", src_brickinfo->hostname, + src_brickinfo->path); + *op_errstr = gf_strdup (msg); + ret = -1; + goto out; + } + + } dup_dstbrick = gf_strdup (dst_brick); |