From 5fb7e741c746bf32162967720daceda04d56f615 Mon Sep 17 00:00:00 2001 From: Raghavendra Bhat Date: Wed, 27 Nov 2013 12:46:21 +0530 Subject: mgmt/glusterd: create the pid file for the brick process of the snap volume Change-Id: I8fafb19c2c13caac2a509c36f99d2dd782865b13 Signed-off-by: Raghavendra Bhat --- xlators/mgmt/glusterd/src/glusterd-utils.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.c') 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; -- cgit