diff options
author | Vijay Bellur <vijay@gluster.com> | 2010-09-05 13:04:50 +0000 |
---|---|---|
committer | Vijay Bellur <vijay@dev.gluster.com> | 2010-09-05 22:28:30 -0700 |
commit | 07d84f0f77ea336b3c3ae65907261ed3242feacb (patch) | |
tree | d52cd9a6153cebc41fe962387fcfb3bdeba6c177 /xlators | |
parent | 1fb0d35691d385fc7677e42d2e06bb089dbf0b8b (diff) |
mgmt/glusterd: misc fixes in replace-brick and get volumes
Signed-off-by: Vijay Bellur <vijay@gluster.com>
Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
BUG: 971 (dynamic volume management)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=971
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-handler.c | 14 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-op-sm.c | 50 |
2 files changed, 39 insertions, 25 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c index 5a3aafe8edc..b1f07516795 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-handler.c @@ -2859,13 +2859,13 @@ glusterd_get_volumes (rpcsvc_request_t *req, dict_t *dict, int32_t flags) priv = THIS->private; GF_ASSERT (priv); - if (!list_empty (&priv->volumes)) { - volumes = dict_new (); - if (!volumes) { - gf_log ("", GF_LOG_WARNING, "Out of Memory"); - goto out; - } - } else { + volumes = dict_new (); + if (!volumes) { + gf_log ("", GF_LOG_WARNING, "Out of Memory"); + goto out; + } + + if (list_empty (&priv->volumes)) { ret = 0; goto respond; } diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index 73491013400..dd0214b3870 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -1371,6 +1371,8 @@ rb_spawn_glusterfs_client (glusterd_volinfo_t *volinfo, "Successfully started glusterfs: brick=%s:%s", brickinfo->hostname, brickinfo->path); + memset (cmd_str, 0, sizeof (cmd_str)); + snprintf (cmd_str, 4096, "%s/vols/%s/%s", priv->workdir, volinfo->volname, RB_CLIENT_MOUNTPOINT); @@ -1449,6 +1451,7 @@ static const char *dst_brick_volfile_str = "volume src-posix\n" "type protocol/server\n" "option auth.addr.%s.allow *\n" "option listen-port 34034\n" + "option transport-type tcp\n" "subvolumes %s\n" "end-volume\n"; @@ -1505,8 +1508,8 @@ rb_mountpoint_mkdir (glusterd_volinfo_t *volinfo, RB_CLIENT_MOUNTPOINT); ret = mkdir (mount_point_path, 0777); - if (ret) { - gf_log ("", GF_LOG_DEBUG, "mkdir failed"); + if (ret && (errno != EEXIST)) { + gf_log ("", GF_LOG_DEBUG, "mkdir failed, errno: %d", errno); goto out; } @@ -1665,6 +1668,8 @@ rb_do_operation_start (glusterd_volinfo_t *volinfo, { char start_value[8192] = {0,}; int ret = -1; + gf_boolean_t src_host = _gf_false; + gf_boolean_t dst_host = _gf_false; if (!glusterd_is_local_addr (src_brickinfo->hostname)) { gf_log ("", GF_LOG_NORMAL, @@ -1681,6 +1686,31 @@ rb_do_operation_start (glusterd_volinfo_t *volinfo, dst_brickinfo->hostname, dst_brickinfo->path); + src_host = _gf_true; + + } + + if (!glusterd_is_local_addr (dst_brickinfo->hostname)) { + gf_log ("", GF_LOG_NORMAL, + "I AM THE DESTINATION HOST"); + dst_host = _gf_true; + ret = rb_spawn_destination_brick (volinfo, dst_brickinfo); + if (ret) { + gf_log ("", GF_LOG_DEBUG, + "Failed to spawn destination brick"); + goto out; + } + + } + + if (!src_host || !dst_host) { + gf_log ("", GF_LOG_DEBUG, + "Not a source or destination brick"); + ret = 0; + goto out; + } + + if (src_host) { ret = rb_send_xattr_command (volinfo, src_brickinfo, dst_brickinfo, RB_PUMP_START_CMD, start_value); @@ -1697,22 +1727,6 @@ rb_do_operation_start (glusterd_volinfo_t *volinfo, "client"); goto out; } - - } else if (!glusterd_is_local_addr (dst_brickinfo->hostname)) { - gf_log ("", GF_LOG_NORMAL, - "I AM THE DESTINATION HOST"); - ret = rb_spawn_destination_brick (volinfo, dst_brickinfo); - if (ret) { - gf_log ("", GF_LOG_DEBUG, - "Failed to spawn destination brick"); - goto out; - } - - } else { - gf_log ("", GF_LOG_DEBUG, - "Not a source or destination brick"); - ret = 0; - goto out; } ret = 0; |