summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAvra Sengupta <asengupt@redhat.com>2014-12-17 11:20:20 +0000
committerKrishnan Parthasarathi <kparthas@redhat.com>2014-12-19 01:59:14 -0800
commit81301d3b006e5490699d5bf70833d92b05a47dca (patch)
treecf69085cb083d1f50cf01198e2807e55b030b1b1
parent8484a88364b97ce3bc882db0f2da29633c03c1a5 (diff)
glusterd: Copy brick port no. if brick is running
Instead of relying on brickinfo->status, check if the brick process is running before copying the brick port number. Change-Id: I246465fa4cf4911da63a1c26bbb51cc4ed4630ac BUG: 1175700 Signed-off-by: Avra Sengupta <asengupt@redhat.com> Reviewed-on: http://review.gluster.org/9297 Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com> Tested-by: Krishnan Parthasarathi <kparthas@redhat.com>
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 406d9136c61..be96884d098 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -4574,21 +4574,34 @@ int32_t
glusterd_volinfo_copy_brick_portinfo (glusterd_volinfo_t *new_volinfo,
glusterd_volinfo_t *old_volinfo)
{
- glusterd_brickinfo_t *new_brickinfo = NULL;
- glusterd_brickinfo_t *old_brickinfo = NULL;
+ char pidfile[PATH_MAX+1] = {0,};
+ glusterd_brickinfo_t *new_brickinfo = NULL;
+ glusterd_brickinfo_t *old_brickinfo = NULL;
+ glusterd_conf_t *priv = NULL;
+ int ret = 0;
+ xlator_t *this = NULL;
- int ret = 0;
GF_ASSERT (new_volinfo);
GF_ASSERT (old_volinfo);
+ this = THIS;
+ GF_ASSERT (this);
+ priv = this->private;
+ GF_ASSERT (priv);
+
if (_gf_false == glusterd_is_volume_started (new_volinfo))
goto out;
+
list_for_each_entry (new_brickinfo, &new_volinfo->bricks, brick_list) {
ret = glusterd_volume_brickinfo_get (new_brickinfo->uuid,
new_brickinfo->hostname,
new_brickinfo->path,
old_volinfo, &old_brickinfo);
- if ((0 == ret) && glusterd_is_brick_started (old_brickinfo)) {
- new_brickinfo->port = old_brickinfo->port;
+ if (ret == 0) {
+ GLUSTERD_GET_BRICK_PIDFILE (pidfile, old_volinfo,
+ old_brickinfo, priv);
+ if (gf_is_service_running (pidfile, NULL))
+ new_brickinfo->port = old_brickinfo->port;
+
}
}
out: