summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorCsaba Henk <csaba@gluster.com>2011-04-29 06:24:41 +0000
committerAnand Avati <avati@gluster.com>2011-05-09 13:26:51 -0700
commitfa445b44c66eeebc09a3df74d5e924037a3d89c6 (patch)
treeb99e6d8bdc9916a77d47472908572998c90be8cf /xlators
parent97fdc05ab86ca2af992c42b09ed40413be2ef0d8 (diff)
glusterd / geo-rep: set session owner to the uuid of the master vol instead of that of glusterd
Signed-off-by: Csaba Henk <csaba@gluster.com> Signed-off-by: Anand Avati <avati@gluster.com> BUG: 2785 (gsyncd logs on slave side go to /dev/null) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2785
Diffstat (limited to 'xlators')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c4
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c37
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.h4
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.c8
4 files changed, 30 insertions, 23 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 5954a7b6f0f..7a187963d0d 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -4342,7 +4342,7 @@ glusterd_check_restart_gsync_session (glusterd_volinfo_t *volinfo, char *slave)
" retart the process");
}
- ret = glusterd_start_gsync (volinfo->volname, slave,
+ ret = glusterd_start_gsync (volinfo, slave,
uuid_utoa(priv->uuid), NULL);
if (ret)
goto out;
@@ -4617,7 +4617,7 @@ glusterd_op_gsync_set (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
if (ret)
goto out;
- ret = glusterd_start_gsync (volname, slave, host_uuid,
+ ret = glusterd_start_gsync (volinfo, slave, host_uuid,
op_errstr);
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 1dcfdf4b4c7..ec3449de4e0 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -2415,7 +2415,7 @@ _local_gsyncd_start (dict_t *this, char *key, data_t *value, void *data)
strncpy (uuid_str, (char*)value->data, uuid_len);
- glusterd_start_gsync (volinfo->volname, slave, uuid_str, NULL);
+ glusterd_start_gsync (volinfo, slave, uuid_str, NULL);
}
int
@@ -3312,13 +3312,13 @@ mkdir_if_missing (char *path)
}
int
-glusterd_start_gsync (char *master, char *slave, char *uuid_str,
- char **op_errstr)
+glusterd_start_gsync (glusterd_volinfo_t *master_vol, char *slave,
+ char *glusterd_uuid_str, char **op_errstr)
{
int32_t ret = 0;
int32_t status = 0;
char buf[PATH_MAX] = {0,};
- char local_uuid_str [64] = {0};
+ char uuid_str [64] = {0};
xlator_t *this = NULL;
glusterd_conf_t *priv = NULL;
int errcode = 0;
@@ -3328,15 +3328,15 @@ glusterd_start_gsync (char *master, char *slave, char *uuid_str,
priv = this->private;
GF_ASSERT (priv);
- uuid_utoa_r (priv->uuid, local_uuid_str);
- if (strcmp (local_uuid_str, uuid_str))
+ uuid_utoa_r (priv->uuid, uuid_str);
+ if (strcmp (uuid_str, glusterd_uuid_str))
goto out;
- ret = gsync_status (master, slave, &status);
+ ret = gsync_status (master_vol->volname, slave, &status);
if (status == 0)
goto out;
- snprintf (buf, PATH_MAX, "%s/"GEOREP"/%s", priv->workdir, master);
+ snprintf (buf, PATH_MAX, "%s/"GEOREP"/%s", priv->workdir, master_vol->volname);
ret = mkdir_if_missing (buf);
if (ret) {
errcode = -1;
@@ -3344,15 +3344,30 @@ glusterd_start_gsync (char *master, char *slave, char *uuid_str,
}
snprintf (buf, PATH_MAX, DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP"/%s",
- master);
+ master_vol->volname);
ret = mkdir_if_missing (buf);
if (ret) {
errcode = -1;
goto out;
}
+ uuid_utoa_r (master_vol->volume_id, uuid_str);
+ ret = snprintf (buf, PATH_MAX,
+ GSYNCD_PREFIX"/gsyncd -c %s/"GSYNC_CONF" "
+ ":%s %s --config-set session-owner %s",
+ priv->workdir, master_vol->volname, slave, uuid_str);
+ if (ret <= 0 || ret >= PATH_MAX)
+ ret = -1;
+ if (ret != -1)
+ ret = gf_system (buf) ? -1 : 0;
+ if (ret == -1) {
+ errcode = -1;
+ goto out;
+ }
+
ret = snprintf (buf, PATH_MAX, GSYNCD_PREFIX "/gsyncd --monitor -c "
- "%s/"GSYNC_CONF" :%s %s", priv->workdir, master, slave);
+ "%s/"GSYNC_CONF" :%s %s", priv->workdir,
+ master_vol->volname, slave);
if (ret <= 0) {
ret = -1;
errcode = -1;
@@ -3362,7 +3377,7 @@ glusterd_start_gsync (char *master, char *slave, char *uuid_str,
ret = gf_system (buf);
if (ret == -1) {
gf_asprintf (op_errstr, GEOREP" start failed for %s %s",
- master, slave);
+ master_vol->volname, slave);
goto out;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.h b/xlators/mgmt/glusterd/src/glusterd-utils.h
index 7cf06f7ae1f..85d5b828098 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.h
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.h
@@ -274,6 +274,6 @@ glusterd_delete_all_bricks (glusterd_volinfo_t* volinfo);
int
glusterd_restart_gsyncds (glusterd_conf_t *conf);
int
-glusterd_start_gsync (char *master, char *slave, char *uuid_str,
- char **op_errstr);
+glusterd_start_gsync (glusterd_volinfo_t *master_vol, char *slave,
+ char *glusterd_uuid_str, char **op_errstr);
#endif
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c
index c7c5088db2e..28c0a597dfe 100644
--- a/xlators/mgmt/glusterd/src/glusterd.c
+++ b/xlators/mgmt/glusterd/src/glusterd.c
@@ -355,7 +355,6 @@ configure_syncdaemon (glusterd_conf_t *conf)
#if SYNCDAEMON_COMPILE
char georepdir[PATH_MAX] = {0,};
char cmd[2*PATH_MAX + 1024] = {0,};
- char volid[64] = {0,};
int blen = 0;
ret = setenv ("_GLUSTERD_CALLED_", "1", 1);
@@ -421,13 +420,6 @@ configure_syncdaemon (glusterd_conf_t *conf)
if (ret)
goto out;
- /* session-owner */
- uuid_unparse (conf->uuid, volid);
- sprintf (cmd + blen, "session-owner %s . .", volid);
- ret = system (cmd);
- if (ret)
- goto out;
-
/* pid-file */
sprintf (cmd + blen, "pid-file %s/${mastervol}/${eSlave}.pid . .", georepdir);
ret = gf_system (cmd);