diff options
author | Gaurav Kumar Garg <garg.gaurav52@gmail.com> | 2016-03-02 17:42:07 +0530 |
---|---|---|
committer | Atin Mukherjee <amukherj@redhat.com> | 2017-08-11 07:36:41 +0000 |
commit | 220d406ad13d840e950eef001a2b36f87570058d (patch) | |
tree | 9740cb9546b441e555146f5bba5807b95e353703 /xlators/mgmt/glusterd/src/glusterd.h | |
parent | cfdcdd1b1fea3f30d9131dd36afab6efeef2bee0 (diff) |
glusterd: Gluster should keep PID file in correct location
Currently Gluster keeps process pid information of all the daemons
and brick processes in Gluster configuration file directory
(ie., /var/lib/glusterd/*).
These pid files should be seperate from configuration files.
Deletion of the configuration file directory might result into serious problems.
Also, /var/run/gluster is the default placeholder directory for pid files.
So, with this fix Gluster will keep all process pid information of all
processes in /var/run/gluster/* directory.
Change-Id: Idb09e3fccb6a7355fbac1df31082637c8d7ab5b4
BUG: 1258561
Signed-off-by: Gaurav Kumar Garg <ggarg@redhat.com>
Signed-off-by: Saravanakumar Arumugam <sarumuga@redhat.com>
Reviewed-on: https://review.gluster.org/13580
Tested-by: MOHIT AGRAWAL <moagrawa@redhat.com>
Smoke: Gluster Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd.h')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd.h | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h index dd1ff7a66be..722d2f8f420 100644 --- a/xlators/mgmt/glusterd/src/glusterd.h +++ b/xlators/mgmt/glusterd/src/glusterd.h @@ -148,6 +148,7 @@ typedef struct { gf_boolean_t trace; uuid_t uuid; char workdir[PATH_MAX]; + char rundir[PATH_MAX]; rpcsvc_t *rpc; glusterd_svc_t shd_svc; glusterd_svc_t nfs_svc; @@ -578,6 +579,11 @@ typedef enum { #define GLUSTERD_VOL_SNAP_DIR_PREFIX "snaps" #define GLUSTERD_DEFAULT_SNAPS_BRICK_DIR "/gluster/snaps" +#define GLUSTERD_BITD_RUN_DIR "/bitd" +#define GLUSTERD_SCRUB_RUN_DIR "/scrub" +#define GLUSTERD_GLUSTERSHD_RUN_DIR "/glustershd" +#define GLUSTERD_NFS_RUN_DIR "/nfs" +#define GLUSTERD_QUOTAD_RUN_DIR "/quotad" #define GLUSTER_SHARED_STORAGE_BRICK_DIR GLUSTERD_DEFAULT_WORKDIR"/ss_brick" #define GLUSTERD_VAR_RUN_DIR "/var/run" #define GLUSTERD_RUN_DIR "/run" @@ -613,6 +619,19 @@ typedef ssize_t (*gd_serialize_t) (struct iovec outmsg, void *args); volinfo->volname); \ } while (0) +#define GLUSTERD_GET_VOLUME_PID_DIR(path, volinfo, priv) \ +do { \ + if (volinfo->is_snap_volume) { \ + snprintf (path, PATH_MAX, "%s/snaps/%s/%s", \ + priv->rundir, \ + volinfo->snapshot->snapname, volinfo->volname); \ + } else { \ + snprintf (path, PATH_MAX, "%s/vols/%s", \ + priv->rundir, \ + volinfo->volname); \ + } \ +} while (0) + #define GLUSTERD_GET_SNAP_DIR(path, snap, priv) \ snprintf (path, PATH_MAX, "%s/snaps/%s", priv->workdir, \ snap->snapname); @@ -665,20 +684,20 @@ typedef ssize_t (*gd_serialize_t) (struct iovec outmsg, void *args); #define GLUSTERD_GET_BRICK_PIDFILE(pidfile,volinfo,brickinfo, priv) do { \ char exp_path[PATH_MAX] = {0,}; \ char volpath[PATH_MAX] = {0,}; \ - GLUSTERD_GET_VOLUME_DIR (volpath, volinfo, priv); \ + GLUSTERD_GET_VOLUME_PID_DIR (volpath, volinfo, priv); \ GLUSTERD_REMOVE_SLASH_FROM_PATH (brickinfo->path, exp_path); \ - snprintf (pidfile, PATH_MAX, "%s/run/%s-%s.pid", \ - volpath, brickinfo->hostname, exp_path); \ + snprintf (pidfile, PATH_MAX, "%s/%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); \ +#define GLUSTERD_GET_NFS_PIDFILE(pidfile, nfspath, priv) { \ + snprintf (pidfile, PATH_MAX, "%s/nfs/nfs.pid", \ + priv->rundir); \ } -#define GLUSTERD_GET_QUOTAD_PIDFILE(pidfile,quotadpath) { \ - snprintf (pidfile, PATH_MAX, "%s/run/quotad.pid", \ - quotadpath); \ +#define GLUSTERD_GET_QUOTAD_PIDFILE(pidfile, quotadpath, priv) { \ + snprintf (pidfile, PATH_MAX, "%s/quotad/quotad.pid", \ + priv->rundir); \ } #define GLUSTERD_GET_QUOTA_CRAWL_PIDDIR(piddir, volinfo, type) do { \ |