|
|
21ab4e |
From 7554d75e97c36abe2121cca41d98a6e57f3d9640 Mon Sep 17 00:00:00 2001
|
|
|
21ab4e |
From: Gaurav Kumar Garg <garg.gaurav52@gmail.com>
|
|
|
21ab4e |
Date: Wed, 2 Mar 2016 17:42:07 +0530
|
|
|
21ab4e |
Subject: [PATCH 602/602] glusterd: Gluster should keep PID file in correct
|
|
|
21ab4e |
location
|
|
|
21ab4e |
|
|
|
21ab4e |
Currently Gluster keeps process pid information of all the daemons
|
|
|
21ab4e |
and brick processes in Gluster configuration file directory
|
|
|
21ab4e |
(ie., /var/lib/glusterd/*).
|
|
|
21ab4e |
|
|
|
21ab4e |
These pid files should be seperate from configuration files.
|
|
|
21ab4e |
Deletion of the configuration file directory might result into serious problems.
|
|
|
21ab4e |
Also, /var/run/gluster is the default placeholder directory for pid files.
|
|
|
21ab4e |
|
|
|
21ab4e |
So, with this fix Gluster will keep all process pid information of all
|
|
|
21ab4e |
processes in /var/run/gluster/* directory.
|
|
|
21ab4e |
|
|
|
21ab4e |
>Signed-off-by: Saravanakumar Arumugam <sarumuga@redhat.com>
|
|
|
21ab4e |
>Reviewed-on: https://review.gluster.org/13580
|
|
|
21ab4e |
>Tested-by: MOHIT AGRAWAL <moagrawa@redhat.com>
|
|
|
21ab4e |
>Smoke: Gluster Build System <jenkins@build.gluster.org>
|
|
|
21ab4e |
>CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
|
|
|
21ab4e |
>Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
21ab4e |
|
|
|
21ab4e |
Change-Id: Idb09e3fccb6a7355fbac1df31082637c8d7ab5b4
|
|
|
21ab4e |
BUG: 1480423
|
|
|
21ab4e |
Signed-off-by: Gaurav Kumar Garg <ggarg@redhat.com>
|
|
|
21ab4e |
Reviewed-on: https://code.engineering.redhat.com/gerrit/115068
|
|
|
21ab4e |
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
21ab4e |
Tested-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
21ab4e |
---
|
|
|
21ab4e |
extras/ocf/volume.in | 18 +++--
|
|
|
21ab4e |
extras/stop-all-gluster-processes.sh | 2 +-
|
|
|
21ab4e |
libglusterfs/src/store.c | 2 +-
|
|
|
21ab4e |
tests/basic/mount-nfs-auth.t | 2 +-
|
|
|
21ab4e |
tests/bugs/fuse/bug-858215.t | 4 +-
|
|
|
21ab4e |
...-1225716-brick-online-validation-remove-brick.t | 1 -
|
|
|
21ab4e |
tests/bugs/glusterd/bug-916549.t | 4 +-
|
|
|
21ab4e |
tests/bugs/glusterfs-server/bug-861542.t | 2 +-
|
|
|
21ab4e |
tests/bugs/snapshot/bug-1399598-uss-with-ssl.t | 2 +-
|
|
|
21ab4e |
tests/bugs/trace/bug-797171.t | 4 +-
|
|
|
21ab4e |
tests/cluster.rc | 10 +--
|
|
|
21ab4e |
tests/env.rc.in | 3 +
|
|
|
21ab4e |
tests/include.rc | 1 +
|
|
|
21ab4e |
tests/volume.rc | 8 +--
|
|
|
21ab4e |
.../mgmt/glusterd/src/glusterd-snapd-svc-helper.c | 5 +-
|
|
|
21ab4e |
xlators/mgmt/glusterd/src/glusterd-store.c | 34 ++++++++++
|
|
|
21ab4e |
xlators/mgmt/glusterd/src/glusterd-svc-mgmt.c | 9 +--
|
|
|
21ab4e |
xlators/mgmt/glusterd/src/glusterd-utils.c | 14 ++--
|
|
|
21ab4e |
xlators/mgmt/glusterd/src/glusterd.c | 77 ++++++++++++++++++++++
|
|
|
21ab4e |
xlators/mgmt/glusterd/src/glusterd.h | 37 ++++++++---
|
|
|
21ab4e |
20 files changed, 190 insertions(+), 49 deletions(-)
|
|
|
21ab4e |
|
|
|
21ab4e |
diff --git a/extras/ocf/volume.in b/extras/ocf/volume.in
|
|
|
21ab4e |
index 72fd121..de05373 100755
|
|
|
21ab4e |
--- a/extras/ocf/volume.in
|
|
|
21ab4e |
+++ b/extras/ocf/volume.in
|
|
|
21ab4e |
@@ -78,6 +78,16 @@ volume_getdir() {
|
|
|
21ab4e |
return 0
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
+volume_getpid_dir() {
|
|
|
21ab4e |
+ local volpid_dir
|
|
|
21ab4e |
+ volpid_dir="/var/run/gluster/vols/${OCF_RESKEY_volname}"
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ [ -d ${volpid_dir} ] || return 1
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ echo "${volpid_dir}"
|
|
|
21ab4e |
+ return 0
|
|
|
21ab4e |
+}
|
|
|
21ab4e |
+
|
|
|
21ab4e |
volume_getbricks() {
|
|
|
21ab4e |
local infofile
|
|
|
21ab4e |
local voldir
|
|
|
21ab4e |
@@ -92,17 +102,15 @@ volume_getbricks() {
|
|
|
21ab4e |
|
|
|
21ab4e |
volume_getpids() {
|
|
|
21ab4e |
local bricks
|
|
|
21ab4e |
- local piddir
|
|
|
21ab4e |
local pidfile
|
|
|
21ab4e |
local infofile
|
|
|
21ab4e |
- local voldir
|
|
|
21ab4e |
+ local volpid_dir
|
|
|
21ab4e |
|
|
|
21ab4e |
- voldir=`volume_getdir`
|
|
|
21ab4e |
+ volpid_dir=`volume_getpid_dir`
|
|
|
21ab4e |
bricks=`volume_getbricks`
|
|
|
21ab4e |
- piddir="${voldir}/run"
|
|
|
21ab4e |
|
|
|
21ab4e |
for brick in ${bricks}; do
|
|
|
21ab4e |
- pidfile="${piddir}/${SHORTHOSTNAME}${brick}.pid"
|
|
|
21ab4e |
+ pidfile="${volpid_dir}/${SHORTHOSTNAME}${brick}.pid"
|
|
|
21ab4e |
[ -e $pidfile ] || return 1
|
|
|
21ab4e |
cat $pidfile
|
|
|
21ab4e |
done
|
|
|
21ab4e |
diff --git a/extras/stop-all-gluster-processes.sh b/extras/stop-all-gluster-processes.sh
|
|
|
21ab4e |
index 69fd601..ea2b48e 100755
|
|
|
21ab4e |
--- a/extras/stop-all-gluster-processes.sh
|
|
|
21ab4e |
+++ b/extras/stop-all-gluster-processes.sh
|
|
|
21ab4e |
@@ -72,7 +72,7 @@ kill_bricks_and_services()
|
|
|
21ab4e |
local pidfile
|
|
|
21ab4e |
local pid
|
|
|
21ab4e |
|
|
|
21ab4e |
- for pidfile in $(find /var/lib/glusterd/ -name '*.pid');
|
|
|
21ab4e |
+ for pidfile in $(find /var/run/gluster/ -name '*.pid');
|
|
|
21ab4e |
do
|
|
|
21ab4e |
local pid=$(cat ${pidfile});
|
|
|
21ab4e |
echo "sending SIG${signal} to pid: ${pid}";
|
|
|
21ab4e |
diff --git a/libglusterfs/src/store.c b/libglusterfs/src/store.c
|
|
|
21ab4e |
index 1591627..199ba29 100644
|
|
|
21ab4e |
--- a/libglusterfs/src/store.c
|
|
|
21ab4e |
+++ b/libglusterfs/src/store.c
|
|
|
21ab4e |
@@ -24,7 +24,7 @@ gf_store_mkdir (char *path)
|
|
|
21ab4e |
{
|
|
|
21ab4e |
int32_t ret = -1;
|
|
|
21ab4e |
|
|
|
21ab4e |
- ret = sys_mkdir (path, 0777);
|
|
|
21ab4e |
+ ret = mkdir_p (path, 0777, _gf_true);
|
|
|
21ab4e |
|
|
|
21ab4e |
if ((-1 == ret) && (EEXIST != errno)) {
|
|
|
21ab4e |
gf_msg ("", GF_LOG_ERROR, errno, LG_MSG_DIR_OP_FAILED, "mkdir()"
|
|
|
21ab4e |
diff --git a/tests/basic/mount-nfs-auth.t b/tests/basic/mount-nfs-auth.t
|
|
|
21ab4e |
index 9df5cb4..c4f7f65 100755
|
|
|
21ab4e |
--- a/tests/basic/mount-nfs-auth.t
|
|
|
21ab4e |
+++ b/tests/basic/mount-nfs-auth.t
|
|
|
21ab4e |
@@ -132,7 +132,7 @@ function stat_nfs () {
|
|
|
21ab4e |
|
|
|
21ab4e |
# Restarts the NFS server
|
|
|
21ab4e |
function restart_nfs () {
|
|
|
21ab4e |
- local NFS_PID=$(cat ${GLUSTERD_WORKDIR}/nfs/run/nfs.pid)
|
|
|
21ab4e |
+ local NFS_PID=$(cat $GLUSTERD_PIDFILEDIR/nfs/nfs.pid)
|
|
|
21ab4e |
|
|
|
21ab4e |
# kill the NFS-server if it is running
|
|
|
21ab4e |
while ps -q ${NFS_PID} 2>&1 > /dev/null; do
|
|
|
21ab4e |
diff --git a/tests/bugs/fuse/bug-858215.t b/tests/bugs/fuse/bug-858215.t
|
|
|
21ab4e |
index c8613ef..389783b 100755
|
|
|
21ab4e |
--- a/tests/bugs/fuse/bug-858215.t
|
|
|
21ab4e |
+++ b/tests/bugs/fuse/bug-858215.t
|
|
|
21ab4e |
@@ -40,8 +40,8 @@ TEST touch $M0/newfile;
|
|
|
21ab4e |
TEST stat $M0/newfile;
|
|
|
21ab4e |
TEST rm $M0/newfile;
|
|
|
21ab4e |
|
|
|
21ab4e |
-nfs_pid=$(cat $GLUSTERD_WORKDIR/nfs/run/nfs.pid);
|
|
|
21ab4e |
-glustershd_pid=$(cat $GLUSTERD_WORKDIR/glustershd/run/glustershd.pid);
|
|
|
21ab4e |
+nfs_pid=$(cat $GLUSTERD_PIDFILEDIR/nfs/nfs.pid);
|
|
|
21ab4e |
+glustershd_pid=$(cat $GLUSTERD_PIDFILEDIR/glustershd/glustershd.pid);
|
|
|
21ab4e |
|
|
|
21ab4e |
pids=$(pidof glusterfs);
|
|
|
21ab4e |
for i in $pids
|
|
|
21ab4e |
diff --git a/tests/bugs/glusterd/bug-1225716-brick-online-validation-remove-brick.t b/tests/bugs/glusterd/bug-1225716-brick-online-validation-remove-brick.t
|
|
|
21ab4e |
index 47403b4..d168866 100644
|
|
|
21ab4e |
--- a/tests/bugs/glusterd/bug-1225716-brick-online-validation-remove-brick.t
|
|
|
21ab4e |
+++ b/tests/bugs/glusterd/bug-1225716-brick-online-validation-remove-brick.t
|
|
|
21ab4e |
@@ -28,7 +28,6 @@ EXPECT_WITHIN $REBALANCE_TIMEOUT "completed" remove_brick_status_completed_field
|
|
|
21ab4e |
|
|
|
21ab4e |
#kill a brick process
|
|
|
21ab4e |
kill_brick $V0 $H0 $B0/${V0}1
|
|
|
21ab4e |
-EXPECT_WITHIN $PROCESS_DOWN_TIMEOUT "0" brick_up_status $V0 $H0 $B0/${V0}1
|
|
|
21ab4e |
|
|
|
21ab4e |
#remove-brick commit should pass even if the brick is down
|
|
|
21ab4e |
TEST $CLI volume remove-brick $V0 $H0:$B0/${V0}1 commit
|
|
|
21ab4e |
diff --git a/tests/bugs/glusterd/bug-916549.t b/tests/bugs/glusterd/bug-916549.t
|
|
|
21ab4e |
index bedbdd6..6e3612d 100755
|
|
|
21ab4e |
--- a/tests/bugs/glusterd/bug-916549.t
|
|
|
21ab4e |
+++ b/tests/bugs/glusterd/bug-916549.t
|
|
|
21ab4e |
@@ -8,8 +8,8 @@ TEST glusterd;
|
|
|
21ab4e |
TEST $CLI volume create $V0 $H0:$B0/${V0}1;
|
|
|
21ab4e |
TEST $CLI volume start $V0;
|
|
|
21ab4e |
|
|
|
21ab4e |
-pid_file=$(ls $GLUSTERD_WORKDIR/vols/$V0/run);
|
|
|
21ab4e |
-brick_pid=$(cat $GLUSTERD_WORKDIR/vols/$V0/run/$pid_file);
|
|
|
21ab4e |
+pid_file=$(ls $GLUSTERD_PIDFILEDIR/vols/$V0/);
|
|
|
21ab4e |
+brick_pid=$(cat $GLUSTERD_PIDFILEDIR/vols/$V0/$pid_file);
|
|
|
21ab4e |
|
|
|
21ab4e |
|
|
|
21ab4e |
kill -SIGKILL $brick_pid;
|
|
|
21ab4e |
diff --git a/tests/bugs/glusterfs-server/bug-861542.t b/tests/bugs/glusterfs-server/bug-861542.t
|
|
|
21ab4e |
index d335932..60d1b13 100755
|
|
|
21ab4e |
--- a/tests/bugs/glusterfs-server/bug-861542.t
|
|
|
21ab4e |
+++ b/tests/bugs/glusterfs-server/bug-861542.t
|
|
|
21ab4e |
@@ -39,7 +39,7 @@ TEST $CLI --xml volume status $V0;
|
|
|
21ab4e |
TEST $CLI --xml volume status $V0 detail;
|
|
|
21ab4e |
|
|
|
21ab4e |
# Kill the brick process. After this, port number for the killed (in this case brick) process must be "N/A".
|
|
|
21ab4e |
-kill `cat $GLUSTERD_WORKDIR/vols/$V0/run/$H0-d-backends-brick0.pid`
|
|
|
21ab4e |
+kill `cat $GLUSTERD_PIDFILEDIR/vols/$V0/$H0-d-backends-brick0.pid`
|
|
|
21ab4e |
|
|
|
21ab4e |
EXPECT "N/A" port_field $V0 '0'; # volume status
|
|
|
21ab4e |
EXPECT "N/A" port_field $V0 '1'; # volume status detail
|
|
|
21ab4e |
diff --git a/tests/bugs/snapshot/bug-1399598-uss-with-ssl.t b/tests/bugs/snapshot/bug-1399598-uss-with-ssl.t
|
|
|
21ab4e |
index 7d62526..f4e4e6e 100755
|
|
|
21ab4e |
--- a/tests/bugs/snapshot/bug-1399598-uss-with-ssl.t
|
|
|
21ab4e |
+++ b/tests/bugs/snapshot/bug-1399598-uss-with-ssl.t
|
|
|
21ab4e |
@@ -20,7 +20,7 @@ function total_online_bricks
|
|
|
21ab4e |
{
|
|
|
21ab4e |
# This will count snapd, which isn't really a brick, but callers can
|
|
|
21ab4e |
# account for that so it's OK.
|
|
|
21ab4e |
- find $GLUSTERD_WORKDIR -name '*.pid' | wc -l
|
|
|
21ab4e |
+ find $GLUSTERD_PIDFILEDIR -name '*.pid' | wc -l
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
cleanup;
|
|
|
21ab4e |
diff --git a/tests/bugs/trace/bug-797171.t b/tests/bugs/trace/bug-797171.t
|
|
|
21ab4e |
index 29f96b1..b823e47 100755
|
|
|
21ab4e |
--- a/tests/bugs/trace/bug-797171.t
|
|
|
21ab4e |
+++ b/tests/bugs/trace/bug-797171.t
|
|
|
21ab4e |
@@ -21,8 +21,8 @@ $M0;
|
|
|
21ab4e |
touch $M0/{1..22};
|
|
|
21ab4e |
rm -f $M0/*;
|
|
|
21ab4e |
|
|
|
21ab4e |
-pid_file=$(ls $GLUSTERD_WORKDIR/vols/$V0/run);
|
|
|
21ab4e |
-brick_pid=$(cat $GLUSTERD_WORKDIR/vols/$V0/run/$pid_file);
|
|
|
21ab4e |
+pid_file=$(ls $GLUSTERD_PIDFILEDIR/vols/$V0/);
|
|
|
21ab4e |
+brick_pid=$(cat $GLUSTERD_PIDFILEDIR/vols/$V0/$pid_file);
|
|
|
21ab4e |
|
|
|
21ab4e |
mkdir $statedumpdir/statedump_tmp/;
|
|
|
21ab4e |
echo "path=$statedumpdir/statedump_tmp" > $statedumpdir/glusterdump.options;
|
|
|
21ab4e |
diff --git a/tests/cluster.rc b/tests/cluster.rc
|
|
|
21ab4e |
index 467bbcb..7bb4aa3 100644
|
|
|
21ab4e |
--- a/tests/cluster.rc
|
|
|
21ab4e |
+++ b/tests/cluster.rc
|
|
|
21ab4e |
@@ -27,6 +27,7 @@ function define_backends() {
|
|
|
21ab4e |
for i in `seq 1 $count`; do
|
|
|
21ab4e |
b="B$i";
|
|
|
21ab4e |
mkdir -p ${!b}/glusterd;
|
|
|
21ab4e |
+ mkdir -p ${!b}/run;
|
|
|
21ab4e |
done
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
@@ -43,6 +44,7 @@ function define_glusterds() {
|
|
|
21ab4e |
b="B$i";
|
|
|
21ab4e |
h="H$i";
|
|
|
21ab4e |
wopt="management.working-directory=${!b}/glusterd";
|
|
|
21ab4e |
+ ropt="management.run-directory=${!b}/run/gluster";
|
|
|
21ab4e |
bopt="management.transport.socket.bind-address=${!h}";
|
|
|
21ab4e |
popt="--pid-file=${!b}/glusterd.pid";
|
|
|
21ab4e |
sopt="management.glusterd-sockfile=${!b}/glusterd/gd.sock"
|
|
|
21ab4e |
@@ -52,11 +54,11 @@ function define_glusterds() {
|
|
|
21ab4e |
logfile=`echo ${0##*/}`_glusterd$i.log
|
|
|
21ab4e |
lopt="--log-file=$logdir/$logfile"
|
|
|
21ab4e |
if [ "$2" == "-LDEBUG" ]; then
|
|
|
21ab4e |
- eval "glusterd_$i='glusterd -LDEBUG --xlator-option $wopt --xlator-option $bopt --xlator-option $sopt $lopt $popt'";
|
|
|
21ab4e |
- eval "glusterd$i='glusterd -LDEBUG --xlator-option $wopt --xlator-option $bopt --xlator-option $sopt $lopt $popt'";
|
|
|
21ab4e |
+ eval "glusterd_$i='glusterd -LDEBUG --xlator-option $wopt --xlator-option $bopt --xlator-option $ropt --xlator-option $sopt $lopt $popt'";
|
|
|
21ab4e |
+ eval "glusterd$i='glusterd -LDEBUG --xlator-option $wopt --xlator-option $bopt --xlator-option $ropt --xlator-option $sopt $lopt $popt'";
|
|
|
21ab4e |
else
|
|
|
21ab4e |
- eval "glusterd_$i='glusterd --xlator-option $wopt --xlator-option $bopt --xlator-option $sopt $lopt $popt'";
|
|
|
21ab4e |
- eval "glusterd$i='glusterd --xlator-option $wopt --xlator-option $bopt --xlator-option $sopt $lopt $popt'";
|
|
|
21ab4e |
+ eval "glusterd_$i='glusterd --xlator-option $wopt --xlator-option $bopt --xlator-option $ropt --xlator-option $sopt $lopt $popt'";
|
|
|
21ab4e |
+ eval "glusterd$i='glusterd --xlator-option $wopt --xlator-option $bopt --xlator-option $ropt --xlator-option $sopt $lopt $popt'";
|
|
|
21ab4e |
fi
|
|
|
21ab4e |
done
|
|
|
21ab4e |
}
|
|
|
21ab4e |
diff --git a/tests/env.rc.in b/tests/env.rc.in
|
|
|
21ab4e |
index acd8f06..0ca98ca 100644
|
|
|
21ab4e |
--- a/tests/env.rc.in
|
|
|
21ab4e |
+++ b/tests/env.rc.in
|
|
|
21ab4e |
@@ -4,6 +4,9 @@ exec_prefix=@exec_prefix@
|
|
|
21ab4e |
PATH=@sbindir@:$PATH
|
|
|
21ab4e |
export PATH
|
|
|
21ab4e |
|
|
|
21ab4e |
+GLUSTERD_PIDFILEDIR=@localstatedir@/run/gluster
|
|
|
21ab4e |
+export GLUSTERD_PIDFILEDIR
|
|
|
21ab4e |
+
|
|
|
21ab4e |
LD_LIBRARY_PATH=@libdir@:$LD_LIBRARY_PATH
|
|
|
21ab4e |
export LD_LIBRARY_PATH
|
|
|
21ab4e |
|
|
|
21ab4e |
diff --git a/tests/include.rc b/tests/include.rc
|
|
|
21ab4e |
index 3e61ce7..e8c380f 100644
|
|
|
21ab4e |
--- a/tests/include.rc
|
|
|
21ab4e |
+++ b/tests/include.rc
|
|
|
21ab4e |
@@ -561,6 +561,7 @@ function cleanup()
|
|
|
21ab4e |
# Complete cleanup time
|
|
|
21ab4e |
rm -rf "$B0/*" "/etc/glusterd/*";
|
|
|
21ab4e |
rm -rf $WORKDIRS
|
|
|
21ab4e |
+ find $GLUSTERD_PIDFILEDIR -name "*.pid" | xargs rm -rf
|
|
|
21ab4e |
leftover=""
|
|
|
21ab4e |
for d in $WORKDIRS ; do
|
|
|
21ab4e |
if test -d $d ; then
|
|
|
21ab4e |
diff --git a/tests/volume.rc b/tests/volume.rc
|
|
|
21ab4e |
index 495d8e5..5d6c96c 100644
|
|
|
21ab4e |
--- a/tests/volume.rc
|
|
|
21ab4e |
+++ b/tests/volume.rc
|
|
|
21ab4e |
@@ -102,7 +102,7 @@ function get_nfs_pid ()
|
|
|
21ab4e |
|
|
|
21ab4e |
function read_nfs_pidfile ()
|
|
|
21ab4e |
{
|
|
|
21ab4e |
- echo `cat $GLUSTERD_WORKDIR/nfs/run/nfs.pid`
|
|
|
21ab4e |
+ echo `cat $GLUSTERD_PIDFILEDIR/nfs/nfs.pid`
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
function cleanup_statedump {
|
|
|
21ab4e |
@@ -205,7 +205,7 @@ function ec_child_up_count_shd {
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
function get_shd_process_pid {
|
|
|
21ab4e |
- ps auxww | grep glusterfs | grep -E "glustershd/run/glustershd.pid" | awk '{print $2}' | head -1
|
|
|
21ab4e |
+ ps auxww | grep glusterfs | grep -E "glustershd/glustershd.pid" | awk '{print $2}' | head -1
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
function generate_shd_statedump {
|
|
|
21ab4e |
@@ -254,7 +254,7 @@ function get_brick_pidfile {
|
|
|
21ab4e |
local host=$2
|
|
|
21ab4e |
local brick=$3
|
|
|
21ab4e |
local brick_hiphenated=$(echo $brick | tr '/' '-')
|
|
|
21ab4e |
- echo $GLUSTERD_WORKDIR/vols/$vol/run/${host}${brick_hiphenated}.pid
|
|
|
21ab4e |
+ echo $GLUSTERD_PIDFILEDIR/vols/$vol/${host}${brick_hiphenated}.pid
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
function get_brick_pid {
|
|
|
21ab4e |
@@ -498,7 +498,7 @@ function volume_exists() {
|
|
|
21ab4e |
|
|
|
21ab4e |
function killall_gluster() {
|
|
|
21ab4e |
pkill gluster
|
|
|
21ab4e |
- find $GLUSTERD_WORKDIR -name '*.pid' | xargs rm -f
|
|
|
21ab4e |
+ find $GLUSTERD_PIDFILEDIR -name '*.pid' | xargs rm -f
|
|
|
21ab4e |
sleep 1
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapd-svc-helper.c b/xlators/mgmt/glusterd/src/glusterd-snapd-svc-helper.c
|
|
|
21ab4e |
index 826b4ca..b2e0682 100644
|
|
|
21ab4e |
--- a/xlators/mgmt/glusterd/src/glusterd-snapd-svc-helper.c
|
|
|
21ab4e |
+++ b/xlators/mgmt/glusterd/src/glusterd-snapd-svc-helper.c
|
|
|
21ab4e |
@@ -19,9 +19,8 @@ glusterd_svc_build_snapd_rundir (glusterd_volinfo_t *volinfo,
|
|
|
21ab4e |
char workdir[PATH_MAX] = {0,};
|
|
|
21ab4e |
glusterd_conf_t *priv = THIS->private;
|
|
|
21ab4e |
|
|
|
21ab4e |
- GLUSTERD_GET_VOLUME_DIR (workdir, volinfo, priv);
|
|
|
21ab4e |
-
|
|
|
21ab4e |
- snprintf (path, path_len, "%s/run", workdir);
|
|
|
21ab4e |
+ GLUSTERD_GET_VOLUME_PID_DIR (workdir, volinfo, priv);
|
|
|
21ab4e |
+ snprintf (path, path_len, "%s", workdir);
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
void
|
|
|
21ab4e |
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c
|
|
|
21ab4e |
index 4f9144c..dc55fff 100644
|
|
|
21ab4e |
--- a/xlators/mgmt/glusterd/src/glusterd-store.c
|
|
|
21ab4e |
+++ b/xlators/mgmt/glusterd/src/glusterd-store.c
|
|
|
21ab4e |
@@ -1063,6 +1063,19 @@ glusterd_store_voldirpath_set (glusterd_volinfo_t *volinfo, char *voldirpath,
|
|
|
21ab4e |
GLUSTERD_GET_VOLUME_DIR (voldirpath, volinfo, priv);
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
+static void
|
|
|
21ab4e |
+glusterd_store_piddirpath_set (glusterd_volinfo_t *volinfo, char *piddirpath,
|
|
|
21ab4e |
+ size_t len)
|
|
|
21ab4e |
+{
|
|
|
21ab4e |
+ glusterd_conf_t *priv = NULL;
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ GF_ASSERT (volinfo);
|
|
|
21ab4e |
+ priv = THIS->private;
|
|
|
21ab4e |
+ GF_ASSERT (priv);
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ GLUSTERD_GET_VOLUME_PID_DIR (piddirpath, volinfo, priv);
|
|
|
21ab4e |
+}
|
|
|
21ab4e |
+
|
|
|
21ab4e |
static int32_t
|
|
|
21ab4e |
glusterd_store_create_volume_dir (glusterd_volinfo_t *volinfo)
|
|
|
21ab4e |
{
|
|
|
21ab4e |
@@ -1079,6 +1092,23 @@ glusterd_store_create_volume_dir (glusterd_volinfo_t *volinfo)
|
|
|
21ab4e |
return ret;
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
+static int32_t
|
|
|
21ab4e |
+glusterd_store_create_volume_run_dir (glusterd_volinfo_t *volinfo)
|
|
|
21ab4e |
+{
|
|
|
21ab4e |
+ int32_t ret = -1;
|
|
|
21ab4e |
+ char piddirpath[PATH_MAX] = {0,};
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ GF_ASSERT (volinfo);
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ glusterd_store_piddirpath_set (volinfo, piddirpath,
|
|
|
21ab4e |
+ sizeof (piddirpath));
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ ret = gf_store_mkdir (piddirpath);
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ gf_msg_debug (THIS->name, 0, "Returning with %d", ret);
|
|
|
21ab4e |
+ return ret;
|
|
|
21ab4e |
+}
|
|
|
21ab4e |
+
|
|
|
21ab4e |
int32_t
|
|
|
21ab4e |
glusterd_store_create_snap_dir (glusterd_snap_t *snap)
|
|
|
21ab4e |
{
|
|
|
21ab4e |
@@ -1665,6 +1695,10 @@ glusterd_store_volinfo (glusterd_volinfo_t *volinfo, glusterd_volinfo_ver_ac_t a
|
|
|
21ab4e |
if (ret)
|
|
|
21ab4e |
goto out;
|
|
|
21ab4e |
|
|
|
21ab4e |
+ ret = glusterd_store_create_volume_run_dir (volinfo);
|
|
|
21ab4e |
+ if (ret)
|
|
|
21ab4e |
+ goto out;
|
|
|
21ab4e |
+
|
|
|
21ab4e |
ret = glusterd_store_create_vol_shandle_on_absence (volinfo);
|
|
|
21ab4e |
if (ret)
|
|
|
21ab4e |
goto out;
|
|
|
21ab4e |
diff --git a/xlators/mgmt/glusterd/src/glusterd-svc-mgmt.c b/xlators/mgmt/glusterd/src/glusterd-svc-mgmt.c
|
|
|
21ab4e |
index d6e57a4..9dcf503 100644
|
|
|
21ab4e |
--- a/xlators/mgmt/glusterd/src/glusterd-svc-mgmt.c
|
|
|
21ab4e |
+++ b/xlators/mgmt/glusterd/src/glusterd-svc-mgmt.c
|
|
|
21ab4e |
@@ -86,8 +86,9 @@ glusterd_svc_init_common (glusterd_svc_t *svc,
|
|
|
21ab4e |
goto out;
|
|
|
21ab4e |
|
|
|
21ab4e |
/* Initialize the process mgmt */
|
|
|
21ab4e |
- glusterd_svc_build_pidfile_path (svc_name, workdir, pidfile,
|
|
|
21ab4e |
- sizeof(pidfile));
|
|
|
21ab4e |
+ glusterd_svc_build_pidfile_path (svc_name, priv->rundir,
|
|
|
21ab4e |
+ pidfile, sizeof(pidfile));
|
|
|
21ab4e |
+
|
|
|
21ab4e |
glusterd_svc_build_volfile_path (svc_name, workdir, volfile,
|
|
|
21ab4e |
sizeof (volfile));
|
|
|
21ab4e |
|
|
|
21ab4e |
@@ -133,7 +134,7 @@ int glusterd_svc_init (glusterd_svc_t *svc, char *svc_name)
|
|
|
21ab4e |
priv = this->private;
|
|
|
21ab4e |
GF_ASSERT (priv);
|
|
|
21ab4e |
|
|
|
21ab4e |
- glusterd_svc_build_rundir (svc_name, priv->workdir, rundir,
|
|
|
21ab4e |
+ glusterd_svc_build_rundir (svc_name, priv->rundir, rundir,
|
|
|
21ab4e |
sizeof (rundir));
|
|
|
21ab4e |
ret = glusterd_svc_init_common (svc, svc_name, priv->workdir, rundir,
|
|
|
21ab4e |
DEFAULT_LOG_FILE_DIRECTORY, NULL);
|
|
|
21ab4e |
@@ -276,7 +277,7 @@ glusterd_svc_build_rundir (char *server, char *workdir, char *path, size_t len)
|
|
|
21ab4e |
GF_ASSERT (len == PATH_MAX);
|
|
|
21ab4e |
|
|
|
21ab4e |
glusterd_svc_build_svcdir (server, workdir, dir, sizeof (dir));
|
|
|
21ab4e |
- snprintf (path, len, "%s/run", dir);
|
|
|
21ab4e |
+ snprintf (path, len, "%s", dir);
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
int
|
|
|
21ab4e |
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
21ab4e |
index 407e5b8..02ba0d6 100644
|
|
|
21ab4e |
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
21ab4e |
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
21ab4e |
@@ -1807,7 +1807,7 @@ glusterd_set_brick_socket_filepath (glusterd_volinfo_t *volinfo,
|
|
|
21ab4e |
|
|
|
21ab4e |
priv = this->private;
|
|
|
21ab4e |
|
|
|
21ab4e |
- GLUSTERD_GET_VOLUME_DIR (volume_dir, volinfo, priv);
|
|
|
21ab4e |
+ GLUSTERD_GET_VOLUME_PID_DIR (volume_dir, volinfo, priv);
|
|
|
21ab4e |
GLUSTERD_REMOVE_SLASH_FROM_PATH (brickinfo->path, export_path);
|
|
|
21ab4e |
snprintf (sock_filepath, PATH_MAX, "%s/run/%s-%s",
|
|
|
21ab4e |
volume_dir, brickinfo->hostname, export_path);
|
|
|
21ab4e |
@@ -1866,7 +1866,6 @@ out:
|
|
|
21ab4e |
static int
|
|
|
21ab4e |
_mk_rundir_p (glusterd_volinfo_t *volinfo)
|
|
|
21ab4e |
{
|
|
|
21ab4e |
- char voldir[PATH_MAX] = {0,};
|
|
|
21ab4e |
char rundir[PATH_MAX] = {0,};
|
|
|
21ab4e |
glusterd_conf_t *priv = NULL;
|
|
|
21ab4e |
xlator_t *this = NULL;
|
|
|
21ab4e |
@@ -1874,8 +1873,7 @@ _mk_rundir_p (glusterd_volinfo_t *volinfo)
|
|
|
21ab4e |
|
|
|
21ab4e |
this = THIS;
|
|
|
21ab4e |
priv = this->private;
|
|
|
21ab4e |
- GLUSTERD_GET_VOLUME_DIR (voldir, volinfo, priv);
|
|
|
21ab4e |
- snprintf (rundir, sizeof (rundir)-1, "%s/run", voldir);
|
|
|
21ab4e |
+ GLUSTERD_GET_VOLUME_PID_DIR (rundir, volinfo, priv);
|
|
|
21ab4e |
ret = mkdir_p (rundir, 0777, _gf_true);
|
|
|
21ab4e |
if (ret)
|
|
|
21ab4e |
gf_msg (this->name, GF_LOG_ERROR, errno,
|
|
|
21ab4e |
@@ -4953,8 +4951,8 @@ glusterd_add_node_to_dict (char *server, dict_t *dict, int count,
|
|
|
21ab4e |
priv = this->private;
|
|
|
21ab4e |
GF_ASSERT (priv);
|
|
|
21ab4e |
|
|
|
21ab4e |
- glusterd_svc_build_pidfile_path (server, priv->workdir, pidfile,
|
|
|
21ab4e |
- sizeof (pidfile));
|
|
|
21ab4e |
+ glusterd_svc_build_pidfile_path (server, priv->rundir,
|
|
|
21ab4e |
+ pidfile, sizeof (pidfile));
|
|
|
21ab4e |
|
|
|
21ab4e |
if (strcmp(server, priv->shd_svc.name) == 0)
|
|
|
21ab4e |
svc = &(priv->shd_svc);
|
|
|
21ab4e |
@@ -8042,7 +8040,7 @@ glusterd_nfs_statedump (char *options, int option_cnt, char **op_errstr)
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
GLUSTERD_GET_NFS_DIR (path, conf);
|
|
|
21ab4e |
- GLUSTERD_GET_NFS_PIDFILE (pidfile_path, path);
|
|
|
21ab4e |
+ GLUSTERD_GET_NFS_PIDFILE (pidfile_path, path, conf);
|
|
|
21ab4e |
|
|
|
21ab4e |
pidfile = fopen (pidfile_path, "r");
|
|
|
21ab4e |
if (!pidfile) {
|
|
|
21ab4e |
@@ -8167,7 +8165,7 @@ glusterd_quotad_statedump (char *options, int option_cnt, char **op_errstr)
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
GLUSTERD_GET_QUOTAD_DIR (path, conf);
|
|
|
21ab4e |
- GLUSTERD_GET_QUOTAD_PIDFILE (pidfile_path, path);
|
|
|
21ab4e |
+ GLUSTERD_GET_QUOTAD_PIDFILE (pidfile_path, path, conf);
|
|
|
21ab4e |
|
|
|
21ab4e |
pidfile = fopen (pidfile_path, "r");
|
|
|
21ab4e |
if (!pidfile) {
|
|
|
21ab4e |
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c
|
|
|
21ab4e |
index e8292cd..34182b0 100644
|
|
|
21ab4e |
--- a/xlators/mgmt/glusterd/src/glusterd.c
|
|
|
21ab4e |
+++ b/xlators/mgmt/glusterd/src/glusterd.c
|
|
|
21ab4e |
@@ -1417,6 +1417,7 @@ init (xlator_t *this)
|
|
|
21ab4e |
struct stat buf = {0,};
|
|
|
21ab4e |
char storedir[PATH_MAX] = {0,};
|
|
|
21ab4e |
char workdir[PATH_MAX] = {0,};
|
|
|
21ab4e |
+ char rundir[PATH_MAX] = {0,};
|
|
|
21ab4e |
char cmd_log_filename[PATH_MAX] = {0,};
|
|
|
21ab4e |
int first_time = 0;
|
|
|
21ab4e |
char *mountbroker_root = NULL;
|
|
|
21ab4e |
@@ -1449,6 +1450,17 @@ init (xlator_t *this)
|
|
|
21ab4e |
}
|
|
|
21ab4e |
#endif
|
|
|
21ab4e |
|
|
|
21ab4e |
+ dir_data = dict_get (this->options, "run-directory");
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ if (!dir_data) {
|
|
|
21ab4e |
+ /* Use default working dir */
|
|
|
21ab4e |
+ strncpy (rundir, DEFAULT_VAR_RUN_DIRECTORY, PATH_MAX);
|
|
|
21ab4e |
+ } else {
|
|
|
21ab4e |
+ strncpy (rundir, dir_data->data, PATH_MAX);
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ dir_data = NULL;
|
|
|
21ab4e |
+
|
|
|
21ab4e |
dir_data = dict_get (this->options, "working-directory");
|
|
|
21ab4e |
|
|
|
21ab4e |
if (!dir_data) {
|
|
|
21ab4e |
@@ -1495,6 +1507,11 @@ init (xlator_t *this)
|
|
|
21ab4e |
GD_MSG_CURR_WORK_DIR_INFO, "Using %s as working directory",
|
|
|
21ab4e |
workdir);
|
|
|
21ab4e |
|
|
|
21ab4e |
+ setenv ("DEFAULT_VAR_RUN_DIRECTORY", rundir, 1);
|
|
|
21ab4e |
+ gf_msg (this->name, GF_LOG_INFO, 0,
|
|
|
21ab4e |
+ GD_MSG_CURR_WORK_DIR_INFO, "Using %s as pid file working "
|
|
|
21ab4e |
+ "directory", rundir);
|
|
|
21ab4e |
+
|
|
|
21ab4e |
ret = glusterd_find_correct_var_run_dir (this, var_run_dir);
|
|
|
21ab4e |
if (ret) {
|
|
|
21ab4e |
gf_msg (this->name, GF_LOG_CRITICAL, 0,
|
|
|
21ab4e |
@@ -1505,6 +1522,7 @@ init (xlator_t *this)
|
|
|
21ab4e |
|
|
|
21ab4e |
ret = glusterd_init_var_run_dirs (this, var_run_dir,
|
|
|
21ab4e |
GLUSTERD_DEFAULT_SNAPS_BRICK_DIR);
|
|
|
21ab4e |
+
|
|
|
21ab4e |
if (ret) {
|
|
|
21ab4e |
gf_msg (this->name, GF_LOG_CRITICAL, 0,
|
|
|
21ab4e |
GD_MSG_CREATE_DIR_FAILED, "Unable to create "
|
|
|
21ab4e |
@@ -1524,6 +1542,51 @@ init (xlator_t *this)
|
|
|
21ab4e |
exit (1);
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
+ ret = glusterd_init_var_run_dirs (this, rundir,
|
|
|
21ab4e |
+ GLUSTERD_BITD_RUN_DIR);
|
|
|
21ab4e |
+ if (ret) {
|
|
|
21ab4e |
+ gf_msg (this->name, GF_LOG_CRITICAL, 0,
|
|
|
21ab4e |
+ GD_MSG_CREATE_DIR_FAILED, "Unable to create "
|
|
|
21ab4e |
+ "bitd running directory");
|
|
|
21ab4e |
+ exit (1);
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ ret = glusterd_init_var_run_dirs (this, rundir,
|
|
|
21ab4e |
+ GLUSTERD_SCRUB_RUN_DIR);
|
|
|
21ab4e |
+ if (ret) {
|
|
|
21ab4e |
+ gf_msg (this->name, GF_LOG_CRITICAL, 0,
|
|
|
21ab4e |
+ GD_MSG_CREATE_DIR_FAILED, "Unable to create "
|
|
|
21ab4e |
+ "scrub running directory");
|
|
|
21ab4e |
+ exit (1);
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ ret = glusterd_init_var_run_dirs (this, rundir,
|
|
|
21ab4e |
+ GLUSTERD_GLUSTERSHD_RUN_DIR);
|
|
|
21ab4e |
+ if (ret) {
|
|
|
21ab4e |
+ gf_msg (this->name, GF_LOG_CRITICAL, 0,
|
|
|
21ab4e |
+ GD_MSG_CREATE_DIR_FAILED, "Unable to create "
|
|
|
21ab4e |
+ "glustershd running directory");
|
|
|
21ab4e |
+ exit (1);
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ ret = glusterd_init_var_run_dirs (this, rundir,
|
|
|
21ab4e |
+ GLUSTERD_NFS_RUN_DIR);
|
|
|
21ab4e |
+ if (ret) {
|
|
|
21ab4e |
+ gf_msg (this->name, GF_LOG_CRITICAL, 0,
|
|
|
21ab4e |
+ GD_MSG_CREATE_DIR_FAILED, "Unable to create "
|
|
|
21ab4e |
+ "nfs running directory");
|
|
|
21ab4e |
+ exit (1);
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ ret = glusterd_init_var_run_dirs (this, rundir,
|
|
|
21ab4e |
+ GLUSTERD_QUOTAD_RUN_DIR);
|
|
|
21ab4e |
+ if (ret) {
|
|
|
21ab4e |
+ gf_msg (this->name, GF_LOG_CRITICAL, 0,
|
|
|
21ab4e |
+ GD_MSG_CREATE_DIR_FAILED, "Unable to create "
|
|
|
21ab4e |
+ "quota running directory");
|
|
|
21ab4e |
+ exit (1);
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
+
|
|
|
21ab4e |
snprintf (cmd_log_filename, PATH_MAX, "%s/cmd_history.log",
|
|
|
21ab4e |
DEFAULT_LOG_FILE_DIRECTORY);
|
|
|
21ab4e |
ret = gf_cmd_log_init (cmd_log_filename);
|
|
|
21ab4e |
@@ -1547,6 +1610,19 @@ init (xlator_t *this)
|
|
|
21ab4e |
exit (1);
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
+ /*keeping individual volume pid file information in /var/run/gluster* */
|
|
|
21ab4e |
+ snprintf (storedir, PATH_MAX, "%s/vols", rundir);
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ ret = sys_mkdir (storedir, 0777);
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ if ((-1 == ret) && (errno != EEXIST)) {
|
|
|
21ab4e |
+ gf_msg (this->name, GF_LOG_CRITICAL, errno,
|
|
|
21ab4e |
+ GD_MSG_CREATE_DIR_FAILED,
|
|
|
21ab4e |
+ "Unable to create volume directory %s"
|
|
|
21ab4e |
+ " ,errno = %d", storedir, errno);
|
|
|
21ab4e |
+ exit (1);
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
+
|
|
|
21ab4e |
snprintf (storedir, PATH_MAX, "%s/snaps", workdir);
|
|
|
21ab4e |
|
|
|
21ab4e |
ret = sys_mkdir (storedir, 0777);
|
|
|
21ab4e |
@@ -1759,6 +1835,7 @@ init (xlator_t *this)
|
|
|
21ab4e |
conf->uds_rpc = uds_rpc;
|
|
|
21ab4e |
conf->gfs_mgmt = &gd_brick_prog;
|
|
|
21ab4e |
strncpy (conf->workdir, workdir, PATH_MAX);
|
|
|
21ab4e |
+ strncpy (conf->rundir, rundir, PATH_MAX);
|
|
|
21ab4e |
|
|
|
21ab4e |
synclock_init (&conf->big_lock, SYNC_LOCK_RECURSIVE);
|
|
|
21ab4e |
pthread_mutex_init (&conf->xprt_lock, NULL);
|
|
|
21ab4e |
diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h
|
|
|
21ab4e |
index 533f9a8..0beb6e1 100644
|
|
|
21ab4e |
--- a/xlators/mgmt/glusterd/src/glusterd.h
|
|
|
21ab4e |
+++ b/xlators/mgmt/glusterd/src/glusterd.h
|
|
|
21ab4e |
@@ -141,6 +141,7 @@ typedef struct {
|
|
|
21ab4e |
gf_boolean_t trace;
|
|
|
21ab4e |
uuid_t uuid;
|
|
|
21ab4e |
char workdir[PATH_MAX];
|
|
|
21ab4e |
+ char rundir[PATH_MAX];
|
|
|
21ab4e |
rpcsvc_t *rpc;
|
|
|
21ab4e |
glusterd_svc_t shd_svc;
|
|
|
21ab4e |
glusterd_svc_t nfs_svc;
|
|
|
21ab4e |
@@ -562,6 +563,11 @@ typedef enum {
|
|
|
21ab4e |
#define GLUSTERD_VOL_SNAP_DIR_PREFIX "snaps"
|
|
|
21ab4e |
|
|
|
21ab4e |
#define GLUSTERD_DEFAULT_SNAPS_BRICK_DIR "/gluster/snaps"
|
|
|
21ab4e |
+#define GLUSTERD_BITD_RUN_DIR "/bitd"
|
|
|
21ab4e |
+#define GLUSTERD_SCRUB_RUN_DIR "/scrub"
|
|
|
21ab4e |
+#define GLUSTERD_GLUSTERSHD_RUN_DIR "/glustershd"
|
|
|
21ab4e |
+#define GLUSTERD_NFS_RUN_DIR "/nfs"
|
|
|
21ab4e |
+#define GLUSTERD_QUOTAD_RUN_DIR "/quotad"
|
|
|
21ab4e |
#define GLUSTER_SHARED_STORAGE_BRICK_DIR GLUSTERD_DEFAULT_WORKDIR"/ss_brick"
|
|
|
21ab4e |
#define GLUSTERD_VAR_RUN_DIR "/var/run"
|
|
|
21ab4e |
#define GLUSTERD_RUN_DIR "/run"
|
|
|
21ab4e |
@@ -586,6 +592,19 @@ typedef ssize_t (*gd_serialize_t) (struct iovec outmsg, void *args);
|
|
|
21ab4e |
volinfo->volname); \
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
+#define GLUSTERD_GET_VOLUME_PID_DIR(path, volinfo, priv) \
|
|
|
21ab4e |
+do { \
|
|
|
21ab4e |
+ if (volinfo->is_snap_volume) { \
|
|
|
21ab4e |
+ snprintf (path, PATH_MAX, "%s/snaps/%s/%s", \
|
|
|
21ab4e |
+ priv->rundir, \
|
|
|
21ab4e |
+ volinfo->snapshot->snapname, volinfo->volname); \
|
|
|
21ab4e |
+ } else { \
|
|
|
21ab4e |
+ snprintf (path, PATH_MAX, "%s/vols/%s", \
|
|
|
21ab4e |
+ priv->rundir, \
|
|
|
21ab4e |
+ volinfo->volname); \
|
|
|
21ab4e |
+ } \
|
|
|
21ab4e |
+} while (0)
|
|
|
21ab4e |
+
|
|
|
21ab4e |
#define GLUSTERD_GET_SNAP_DIR(path, snap, priv) \
|
|
|
21ab4e |
snprintf (path, PATH_MAX, "%s/snaps/%s", priv->workdir, \
|
|
|
21ab4e |
snap->snapname);
|
|
|
21ab4e |
@@ -638,20 +657,20 @@ typedef ssize_t (*gd_serialize_t) (struct iovec outmsg, void *args);
|
|
|
21ab4e |
#define GLUSTERD_GET_BRICK_PIDFILE(pidfile,volinfo,brickinfo, priv) do { \
|
|
|
21ab4e |
char exp_path[PATH_MAX] = {0,}; \
|
|
|
21ab4e |
char volpath[PATH_MAX] = {0,}; \
|
|
|
21ab4e |
- GLUSTERD_GET_VOLUME_DIR (volpath, volinfo, priv); \
|
|
|
21ab4e |
+ GLUSTERD_GET_VOLUME_PID_DIR (volpath, volinfo, priv); \
|
|
|
21ab4e |
GLUSTERD_REMOVE_SLASH_FROM_PATH (brickinfo->path, exp_path); \
|
|
|
21ab4e |
- snprintf (pidfile, PATH_MAX, "%s/run/%s-%s.pid", \
|
|
|
21ab4e |
- volpath, brickinfo->hostname, exp_path); \
|
|
|
21ab4e |
+ snprintf (pidfile, PATH_MAX, "%s/%s-%s.pid", \
|
|
|
21ab4e |
+ volpath, brickinfo->hostname, exp_path); \
|
|
|
21ab4e |
} while (0)
|
|
|
21ab4e |
|
|
|
21ab4e |
-#define GLUSTERD_GET_NFS_PIDFILE(pidfile,nfspath) { \
|
|
|
21ab4e |
- snprintf (pidfile, PATH_MAX, "%s/run/nfs.pid", \
|
|
|
21ab4e |
- nfspath); \
|
|
|
21ab4e |
+#define GLUSTERD_GET_NFS_PIDFILE(pidfile, nfspath, priv) { \
|
|
|
21ab4e |
+ snprintf (pidfile, PATH_MAX, "%s/nfs/nfs.pid", \
|
|
|
21ab4e |
+ priv->rundir); \
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
-#define GLUSTERD_GET_QUOTAD_PIDFILE(pidfile,quotadpath) { \
|
|
|
21ab4e |
- snprintf (pidfile, PATH_MAX, "%s/run/quotad.pid", \
|
|
|
21ab4e |
- quotadpath); \
|
|
|
21ab4e |
+#define GLUSTERD_GET_QUOTAD_PIDFILE(pidfile, quotadpath, priv) { \
|
|
|
21ab4e |
+ snprintf (pidfile, PATH_MAX, "%s/quotad/quotad.pid", \
|
|
|
21ab4e |
+ priv->rundir); \
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
#define GLUSTERD_GET_QUOTA_CRAWL_PIDDIR(piddir, volinfo, type) do { \
|
|
|
21ab4e |
--
|
|
|
21ab4e |
1.8.3.1
|
|
|
21ab4e |
|