summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorCsaba Henk <csaba@gluster.com>2011-07-25 11:53:55 +0300
committerVijay Bellur <vijay@gluster.com>2011-09-22 05:10:30 -0700
commit7edb580b1a702096ee11ba28b66fad16fc83dbd6 (patch)
treee2cab55eb86bfc37d3ee9b1c7be38bc90e81e861 /xlators
parentc3b764cad74114f77e8c4acc4c040c4b20666b5d (diff)
glusterd: do preparative gsyncd invocations with proper logging
Change-Id: I28de4cce140faf1b35ecdc5cbd408f21c9926341 BUG: 3231 Reviewed-on: http://review.gluster.com/167 Reviewed-by: Amar Tumballi <amar@gluster.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.c58
1 files changed, 22 insertions, 36 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c
index 9e9c2949862..dfdc53cf1e7 100644
--- a/xlators/mgmt/glusterd/src/glusterd.c
+++ b/xlators/mgmt/glusterd/src/glusterd.c
@@ -366,6 +366,14 @@ glusterd_crt_georep_folders (char *georepdir, glusterd_conf_t *conf)
static int
configure_syncdaemon (glusterd_conf_t *conf)
+#define libc_system system
+#define RUN_GSYNCD_CMD(prf) do { \
+ ret = prf##_system (cmd); \
+ if (ret) { \
+ gf_log ("", GF_LOG_ERROR, "command failed: \"%s\"", cmd); \
+ goto out; \
+ } \
+} while (0)
{
int ret = 0;
#if SYNCDAEMON_COMPILE
@@ -409,66 +417,48 @@ configure_syncdaemon (glusterd_conf_t *conf)
/* remote-gsyncd */
strcpy (cmd + blen, "remote-gsyncd " GSYNCD_PREFIX"/gsyncd . .");
- ret = system (cmd);
- if (ret)
- goto out;
+ RUN_GSYNCD_CMD(libc);
strcpy (cmd + blen,
"remote-gsyncd /usr/local/libexec/glusterfs/gsyncd . ^ssh:");
- ret = system (cmd);
- if (ret)
- goto out;
+ RUN_GSYNCD_CMD(libc);
/* gluster-command */
/* XXX $sbindir should be used (throughout the codebase) */
strcpy (cmd + blen,
"gluster-command '"GFS_PREFIX"/sbin/glusterfs "
"--xlator-option *-dht.assert-no-child-down=true' . .");
- ret = system (cmd);
- if (ret)
- goto out;
+ RUN_GSYNCD_CMD(libc);
/* ssh-command */
sprintf (cmd + blen,
"ssh-command "
"'ssh -oPasswordAuthentication=no -oStrictHostKeyChecking=no "
"-i %s/secret.pem' . .", georepdir);
- ret = system (cmd);
- if (ret)
- goto out;
+ RUN_GSYNCD_CMD(libc);
/* session-owner */
uuid_unparse (conf->uuid, volid);
sprintf (cmd + blen, "session-owner %s . .", volid);
- ret = system (cmd);
- if (ret)
- goto out;
+ RUN_GSYNCD_CMD(libc);
/* pid-file */
sprintf (cmd + blen, "pid-file %s/${mastervol}/${eSlave}.pid . .", georepdir);
- ret = gf_system (cmd);
- if (ret)
- goto out;
+ RUN_GSYNCD_CMD(gf);
/* state-file */
sprintf (cmd + blen, "state-file %s/${mastervol}/${eSlave}.status . .", georepdir);
- ret = gf_system (cmd);
- if (ret)
- goto out;
+ RUN_GSYNCD_CMD(gf);
/* log-file */
strcpy (cmd + blen,
"log-file "DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP"/${mastervol}/${eSlave}.log . .");
- ret = gf_system (cmd);
- if (ret)
- goto out;
+ RUN_GSYNCD_CMD(gf);
/* gluster-log-file */
strcpy (cmd + blen, "gluster-log-file "
DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP"/${mastervol}/${eSlave}.gluster.log . .");
- ret = gf_system (cmd);
- if (ret)
- goto out;
+ RUN_GSYNCD_CMD(gf);
/************
* slave pre-configuration
@@ -478,23 +468,17 @@ configure_syncdaemon (glusterd_conf_t *conf)
strcpy (cmd + blen,
"gluster-command '"GFS_PREFIX"/sbin/glusterfs "
"--xlator-option *-dht.assert-no-child-down=true' .");
- ret = system (cmd);
- if (ret)
- goto out;
+ RUN_GSYNCD_CMD(libc);
/* log-file */
strcpy (cmd + blen,
"log-file "DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP"-slaves/${session_owner}:${eSlave}.log .");
- ret = gf_system (cmd);
- if (ret)
- goto out;
+ RUN_GSYNCD_CMD(gf);
/* gluster-log-file */
strcpy (cmd + blen, "gluster-log-file "
DEFAULT_LOG_FILE_DIRECTORY"/"GEOREP"-slaves/${session_owner}:${eSlave}.gluster.log .");
- ret = gf_system (cmd);
- if (ret)
- goto out;
+ RUN_GSYNCD_CMD(gf);
out:
#else
@@ -502,6 +486,8 @@ configure_syncdaemon (glusterd_conf_t *conf)
#endif
return ret ? -1 : 0;
}
+#undef libc_system
+#undef RUN_GSYNCD_CMD
/*