summaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c28
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.h10
2 files changed, 36 insertions, 2 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index f79cd23..dd64867 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;
diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h
index bb998cc..fb4f32a 100644
--- a/xlators/mgmt/glusterd/src/glusterd.h
+++ b/xlators/mgmt/glusterd/src/glusterd.h
@@ -468,6 +468,16 @@ typedef ssize_t (*gd_serialize_t) (struct iovec outmsg, void *args);
volpath, brickinfo->hostname, exp_path); \
} while (0)
+#define GLUSTERD_GET_SNAP_BRICK_PIDFILE(pidfile,volinfo,snapname,brickinfo, \
+ priv) do { \
+ char exp_path[PATH_MAX] = {0,}; \
+ char volpath[PATH_MAX] = {0,}; \
+ GLUSTERD_GET_SNAP_DIR(volpath, volinfo, snapname, priv); \
+ GLUSTERD_REMOVE_SLASH_FROM_PATH (brickinfo->path, exp_path); \
+ snprintf (pidfile, PATH_MAX, "%s/run/%s-%s.pid", \
+ volpath, brickinfo->hostname, exp_path); \
+ } while (0)
+
#define GLUSTERD_GET_NFS_PIDFILE(pidfile,nfspath) { \
snprintf (pidfile, PATH_MAX, "%s/run/nfs.pid", \
nfspath); \