summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-rebalance.c
diff options
context:
space:
mode:
authorAvra Sengupta <asengupt@redhat.com>2014-11-24 08:24:24 +0000
committerKrishnan Parthasarathi <kparthas@redhat.com>2014-11-30 23:09:44 -0800
commita93164cd2a7f7ec37cf30d52b1a73fdc211981c3 (patch)
tree637079704020927ecd961aaa951f3af17eb6d344 /xlators/mgmt/glusterd/src/glusterd-rebalance.c
parent92242ecd1047fe23ca494555edd6033685522c82 (diff)
glusterd/uss: Create rebalance volfile.
Create a new rebalance volfile, which will not contain snap-view client translators, irrespective of the status of USS. This volfile, will be created and regenerated everytime the fuse-volfile is generated, and will be consumed by the rebalance process. Change-Id: I514a8e88d06c0b8fb6949c3a3e6dc4dbe55e38af BUG: 1164711 Signed-off-by: Avra Sengupta <asengupt@redhat.com> Reviewed-on: http://review.gluster.org/9190 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com> Reviewed-by: Atin Mukherjee <amukherj@redhat.com> Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com> Tested-by: Krishnan Parthasarathi <kparthas@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-rebalance.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-rebalance.c40
1 files changed, 33 insertions, 7 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-rebalance.c b/xlators/mgmt/glusterd/src/glusterd-rebalance.c
index fd63a9bafc6..c986fc12e7b 100644
--- a/xlators/mgmt/glusterd/src/glusterd-rebalance.c
+++ b/xlators/mgmt/glusterd/src/glusterd-rebalance.c
@@ -207,6 +207,7 @@ glusterd_handle_defrag_start (glusterd_volinfo_t *volinfo, char *op_errstr,
char sockfile[PATH_MAX] = {0,};
char pidfile[PATH_MAX] = {0,};
char logfile[PATH_MAX] = {0,};
+ char volname[PATH_MAX] = {0,};
char valgrind_logfile[PATH_MAX] = {0,};
priv = THIS->private;
@@ -264,8 +265,9 @@ glusterd_handle_defrag_start (glusterd_volinfo_t *volinfo, char *op_errstr,
runner_argprintf (&runner, "--log-file=%s", valgrind_logfile);
}
+ snprintf (volname, sizeof(volname), "rebalance/%s", volinfo->volname);
runner_add_args (&runner, SBIN_DIR"/glusterfs",
- "-s", "localhost", "--volfile-id", volinfo->volname,
+ "-s", "localhost", "--volfile-id", volname,
"--xlator-option", "*dht.use-readdirp=yes",
"--xlator-option", "*dht.lookup-unhashed=yes",
"--xlator-option", "*dht.assert-no-child-down=yes",
@@ -804,19 +806,41 @@ out:
int32_t
glusterd_defrag_event_notify_handle (dict_t *dict)
{
- glusterd_volinfo_t *volinfo = NULL;
- char *volname = NULL;
- int32_t ret = -1;
+ glusterd_volinfo_t *volinfo = NULL;
+ char *volname = NULL;
+ char *volname_ptr = NULL;
+ int32_t ret = -1;
+ xlator_t *this = NULL;
+
+ this = THIS;
+ GF_ASSERT (this);
+ GF_ASSERT (dict);
ret = dict_get_str (dict, "volname", &volname);
if (ret) {
- gf_log ("", GF_LOG_ERROR, "Failed to get volname");
+ gf_log (this->name, GF_LOG_ERROR, "Failed to get volname");
return ret;
}
+ volname_ptr = strstr (volname, "rebalance/");
+ if (volname_ptr) {
+ volname_ptr = strchr (volname_ptr, '/');
+ if (!volname_ptr) {
+ ret = -1;
+ goto out;
+ }
+ volname = volname_ptr + 1;
+ } else {
+ gf_log (this->name, GF_LOG_ERROR,
+ "volname recieved (%s) is not prefixed with rebalance.",
+ volname);
+ ret = -1;
+ goto out;
+ }
+
ret = glusterd_volinfo_find (volname, &volinfo);
if (ret) {
- gf_log ("", GF_LOG_ERROR, "Failed to get volinfo for %s"
+ gf_log (this->name, GF_LOG_ERROR, "Failed to get volinfo for %s"
, volname);
return ret;
}
@@ -824,6 +848,8 @@ glusterd_defrag_event_notify_handle (dict_t *dict)
ret = glusterd_defrag_volume_status_update (volinfo, dict);
if (ret)
- gf_log ("", GF_LOG_ERROR, "Failed to update status");
+ gf_log (this->name, GF_LOG_ERROR, "Failed to update status");
+
+out:
return ret;
}