summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-utils.c
diff options
context:
space:
mode:
authorRaghavendra Bhat <raghavendra@redhat.com>2013-11-27 12:46:21 +0530
committerRaghavendra Bhat <raghavendra@redhat.com>2013-11-29 11:20:10 +0530
commit5fb7e741c746bf32162967720daceda04d56f615 (patch)
tree56b2ade831b775dbd2f3460a707bd19a823e09ee /xlators/mgmt/glusterd/src/glusterd-utils.c
parentfae2c3e27037899198d8e7d83ea6aeb7f45f0ebd (diff)
mgmt/glusterd: create the pid file for the brick process of the snap volume
Change-Id: I8fafb19c2c13caac2a509c36f99d2dd782865b13 Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index f79cd2353..dd64867db 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -1310,6 +1310,28 @@ _mk_rundir_p (glusterd_volinfo_t *volinfo)
return ret;
}
+static int
+_mk_snap_rundir_p (glusterd_volinfo_t *volinfo, glusterd_volinfo_t *snap_volinfo)
+{
+ char voldir[PATH_MAX] = {0,};
+ char rundir[PATH_MAX] = {0,};
+ glusterd_conf_t *priv = NULL;
+ xlator_t *this = NULL;
+ int ret = -1;
+
+ GF_ASSERT (volinfo);
+ GF_ASSERT (snap_volinfo);
+
+ this = THIS;
+ priv = this->private;
+ GLUSTERD_GET_SNAP_DIR (voldir, volinfo, snap_volinfo->volname, priv);
+ snprintf (rundir, sizeof (rundir)-1, "%s/run", voldir);
+ ret = mkdir_p (rundir, 0777, _gf_true);
+ if (ret)
+ gf_log (this->name, GF_LOG_ERROR, "Failed to create rundir");
+ return ret;
+}
+
int32_t
glusterd_volume_start_glusterfs (glusterd_volinfo_t *volinfo,
glusterd_brickinfo_t *brickinfo,
@@ -1482,10 +1504,12 @@ glusterd_snap_volume_start_glusterfs (glusterd_volinfo_t *volinfo,
priv = this->private;
GF_ASSERT (priv);
- ret = _mk_rundir_p (volinfo);
+ ret = _mk_snap_rundir_p (volinfo, snap_volinfo);
if (ret)
goto out;
- GLUSTERD_GET_BRICK_PIDFILE (pidfile, volinfo, brickinfo, priv);
+ GLUSTERD_GET_SNAP_BRICK_PIDFILE (pidfile, volinfo,
+ snap_volinfo->volname, brickinfo,
+ priv);
if (glusterd_is_service_running (pidfile, NULL))
goto connect;