summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAshish Pandey <aspandey@redhat.com>2019-01-30 14:24:14 +0530
committerShyamsundar Ranganathan <srangana@redhat.com>2019-03-13 01:48:26 +0000
commit3bcf210a5a9b922ea78b31ef0de8eaf97ff4dcb4 (patch)
tree85c2d03d35b61254603001eab4cc495004179f1b
parentbda2feeaf2917996c59c0c2188bfa1a17d91895f (diff)
rpm: add thin-arbiter packagev6.0rc1
Discussion on thin arbiter volume - https://github.com/gluster/glusterfs/issues/352#issuecomment-350981148 Main idea of having this rpm package is to deploy thin-arbiter without glusterd and other commands on a node, and all we need on that tie-breaker node is to run a single glusterfs command. Also note that, no other glusterfs installation needs thin-arbiter.so. Make sure RPM contains sample vol file, which can work by default, and a script to configure that volfile, along with translator image. Change-Id: Ibace758373d8a991b6a19b2ecc60c93b2f8fc489 updates: bz#1672818 Signed-off-by: Amar Tumballi <amarts@redhat.com> Signed-off-by: Ashish Pandey <aspandey@redhat.com> (cherry picked from commit ca9bef7f1538beb570fcb190ff94f86f0b8ba38a)
-rw-r--r--configure.ac1
-rw-r--r--extras/Makefile.am8
-rw-r--r--extras/systemd/Makefile.am10
-rw-r--r--extras/systemd/gluster-ta-volume.service.in13
-rw-r--r--extras/thin-arbiter/gluster-ta-volume.service13
-rwxr-xr-xextras/thin-arbiter/setup-thin-arbiter.sh197
-rw-r--r--glusterfs.spec.in39
-rw-r--r--xlators/features/thin-arbiter/src/Makefile.am2
8 files changed, 220 insertions, 63 deletions
diff --git a/configure.ac b/configure.ac
index 7ae98ca..2f341de 100644
--- a/configure.ac
+++ b/configure.ac
@@ -200,6 +200,7 @@ AC_CONFIG_FILES([Makefile
extras/systemd/glusterd.service
extras/systemd/glustereventsd.service
extras/systemd/glusterfssharedstorage.service
+ extras/systemd/gluster-ta-volume.service
extras/run-gluster.tmpfiles
extras/benchmarking/Makefile
extras/hook-scripts/Makefile
diff --git a/extras/Makefile.am b/extras/Makefile.am
index de062f3..ff5ca9b 100644
--- a/extras/Makefile.am
+++ b/extras/Makefile.am
@@ -22,12 +22,13 @@ conf_DATA = glusterfs-logrotate gluster-rsyslog-7.2.conf gluster-rsyslog-5.8.con
endif
voldir = $(sysconfdir)/glusterfs
+vol_DATA = thin-arbiter/thin-arbiter.vol
if WITH_SERVER
-vol_DATA = glusterd.vol
+vol_DATA += glusterd.vol
endif
scriptsdir = $(datadir)/glusterfs/scripts
-scripts_SCRIPTS =
+scripts_SCRIPTS = thin-arbiter/setup-thin-arbiter.sh
if WITH_SERVER
scripts_SCRIPTS += post-upgrade-script-for-quota.sh \
pre-upgrade-script-for-quota.sh stop-all-gluster-processes.sh
@@ -47,7 +48,8 @@ EXTRA_DIST = glusterfs-logrotate gluster-rsyslog-7.2.conf gluster-rsyslog-5.8.co
pre-upgrade-script-for-quota.sh command-completion/gluster.bash \
command-completion/Makefile command-completion/README \
stop-all-gluster-processes.sh clang-checker.sh mount-shared-storage.sh \
- control-cpu-load.sh control-mem.sh group-distributed-virt
+ control-cpu-load.sh control-mem.sh group-distributed-virt \
+ thin-arbiter/thin-arbiter.vol thin-arbiter/setup-thin-arbiter.sh
if WITH_SERVER
install-data-local:
diff --git a/extras/systemd/Makefile.am b/extras/systemd/Makefile.am
index d4a3d0b..61446a9 100644
--- a/extras/systemd/Makefile.am
+++ b/extras/systemd/Makefile.am
@@ -1,10 +1,14 @@
-CLEANFILES = glusterd.service glustereventsd.service glusterfssharedstorage.service
-EXTRA_DIST = glusterd.service.in glustereventsd.service.in glusterfssharedstorage.service.in
+CLEANFILES = glusterd.service glustereventsd.service glusterfssharedstorage.service gluster-ta-volume.service
+EXTRA_DIST = glusterd.service.in glustereventsd.service.in glusterfssharedstorage.service.in gluster-ta-volume.service.in
+
+if USE_SYSTEMD
+systemd_DATA = gluster-ta-volume.service
+endif
if WITH_SERVER
if USE_SYSTEMD
# systemddir is already defined through configure.ac
-systemd_DATA = glusterd.service glusterfssharedstorage.service
+systemd_DATA += glusterd.service glusterfssharedstorage.service
if BUILD_EVENTS
systemd_DATA += glustereventsd.service
diff --git a/extras/systemd/gluster-ta-volume.service.in b/extras/systemd/gluster-ta-volume.service.in
new file mode 100644
index 0000000..f262aac
--- /dev/null
+++ b/extras/systemd/gluster-ta-volume.service.in
@@ -0,0 +1,13 @@
+[Unit]
+Description=GlusterFS, Thin-arbiter process to maintain quorum for replica volume
+After=network.target
+
+[Service]
+Environment="LOG_LEVEL=WARNING"
+ExecStart=@prefix@/sbin/glusterfsd -N --volfile-id ta-vol -f @GLUSTERD_WORKDIR@/thin-arbiter/thin-arbiter.vol --brick-port 24007 --xlator-option ta-vol-server.transport.socket.listen-port=24007
+Restart=always
+KillMode=process
+SuccessExitStatus=15
+
+[Install]
+WantedBy=multi-user.target
diff --git a/extras/thin-arbiter/gluster-ta-volume.service b/extras/thin-arbiter/gluster-ta-volume.service
deleted file mode 100644
index 19be175..0000000
--- a/extras/thin-arbiter/gluster-ta-volume.service
+++ /dev/null
@@ -1,13 +0,0 @@
-[Unit]
-Description = Thin-arbiter process to maintain quorum for replica volume
-After = network.target
-
-[Service]
-Environment = "LOG_LEVEL=WARNING"
-ExecStart = /usr/local/sbin/glusterfsd -N --volfile-id ta-vol -f /var/lib/glusterd/thin-arbiter/thin-arbiter.vol --brick-port 24007 --xlator-option ta-vol-server.transport.socket.listen-port=24007
-Restart = always
-KillMode=process
-SuccessExitStatus=15
-
-[Install]
-WantedBy = multi-user.target
diff --git a/extras/thin-arbiter/setup-thin-arbiter.sh b/extras/thin-arbiter/setup-thin-arbiter.sh
index 32fe7fc..1c77cf0 100755
--- a/extras/thin-arbiter/setup-thin-arbiter.sh
+++ b/extras/thin-arbiter/setup-thin-arbiter.sh
@@ -1,17 +1,61 @@
-#! /bin/bash
+#!/bin/bash
+# Copyright (c) 2018-2019 Red Hat, Inc. <http://www.redhat.com>
+# This file is part of GlusterFS.
+#
+# This file is licensed to you under your choice of the GNU Lesser
+# General Public License, version 3 or any later version (LGPLv3 or
+# later), or the GNU General Public License, version 2 (GPLv2), in all
+# cases as published by the Free Software Foundation.
+
+
+# This tool has been developed to setup thin-arbiter process on a node.
+# Seting up a thin arbiter process involves following files -
+# 1 - thin-arbiter.vol
+# Thin-arbiter (TA) process will use the graph in this file to load the
+# required translators.
+# 2 - gluster-ta-volume.service (generated by gluster-ta-volume.service.in)
+# TA process would be running as systemd service.
+#
+# TA process uses a location to save TA id files for every subvolume.
+# This location can be taken as input from user. Once provided and the
+# TA process is started on a node, it can not be changed using this
+# script or by any other mean. The same location should be used in
+# the gluster CLI when creating thin-arbiter volumes.
+
volloc="/var/lib/glusterd/thin-arbiter"
mkdir -p $volloc
-cp -f extras/thin-arbiter/thin-arbiter.vol $volloc/thin-arbiter.vol
+if [ -f /etc/glusterfs/thin-arbiter.vol ]; then
+ volfile=/etc/glusterfs/thin-arbiter.vol
+else
+ volfile=extras/thin-arbiter/thin-arbiter.vol
+fi
+
tafile="$volloc/thin-arbiter.vol"
+
+help () {
+ echo " "
+ echo ' This tool helps to setup thin-arbiter (TA) process on a node.
+ TA process uses a location to save TA id files for every subvolume.
+ This location can be taken as input from user. Once provided and the
+ TA process is started on a node, it can not be changed using this script
+ or by any other mean. The same location should be used in gluster CLI
+ when creating thin-arbiter volumes.
+
+ usage: setup-thin-arbiter.sh [-s] [-h]
+ options:
+ -s - Setup thin-arbiter file path and start process
+ -h - Show this help message and exit
+'
+}
+
volfile_set_brick_path () {
while read -r line
do
dir=`echo "$line" | cut -d' ' -f 2`
- if [ "$dir" = "directory" ]
- then
+ if [ "$dir" = "directory" ]; then
bpath=`echo "$line" | cut -d' ' -f 3`
sed -i -- 's?'$bpath'?'$1'?g' $tafile
return
@@ -19,50 +63,121 @@ volfile_set_brick_path () {
done < $tafile
}
-tapath="/mnt/thin-arbiter"
-echo "Volume file to be used to start thin-arbiter process is :"
-echo "$tafile"
-echo " "
-echo "Default thin-arbiter path is : $tapath"
-echo -n "Do you want to change path for thin arbiter volumes. (y/N): "
-echo " "
-read moveon
-
-if [ "${moveon}" = 'N' ] || [ "${moveon}" = 'n' ]; then
- echo "Default brick path, $tapath, has been set"
- echo "for all thin arbiter volumes using this node"
+check_ta_proc () {
+ pro=`ps aux | grep thin-arbiter.vol | grep "volfile-id"`
+ if [ "${pro}" = '' ]; then
+ echo ""
+ else
+ curr_loc=`cat $volloc/thin-arbiter.vol | grep option | grep directory`
+ loc=`echo "${curr_loc##* }"`
+ echo "******************************************************"
+ echo "Error:"
+ echo "Thin-arbiter process is running with thin-arbiter path = $loc"
+ echo "Can not change TA path on this host now."
+ echo "$pro"
+ echo "******************************************************"
+ exit 1
+ fi
+}
+
+getpath () {
+ check_ta_proc
+ echo "******************************************************"
+ echo "User will be required to enter a path/folder for arbiter volume."
+ echo "Please note that this path will be used for ALL VOLUMES using this"
+ echo "node to host thin-arbiter. After setting, if a volume"
+ echo "has been created using this host and path then path for"
+ echo "thin-arbiter can not be changed "
+ echo "******************************************************"
echo " "
-else
- echo -n "Enter brick path for thin arbiter volumes: "
- read tapath
- echo "Entered brick path : $tapath "
- echo "Please note that this brick path will be used for ALL"
- echo "VOLUMES using this node to host thin-arbiter brick"
+ while true;
+ do
+ echo -n "Enter brick path for thin arbiter volumes: "
+ echo " "
+ read tapath
+ if [ "${tapath}" = '' ]; then
+ echo "Please enter valid path"
+ continue
+ else
+ echo "Entered brick path : $tapath "
+ echo "Please note that this brick path will be used for ALL"
+ echo "VOLUMES using this node to host thin-arbiter brick"
+ echo -n "Want to continue? (y/N): "
+ echo " "
+ read cont
+
+ if [ "${cont}" = 'N' ] || [ "${cont}" = 'n' ]; then
+ exit 0
+ else
+ break
+ fi
+ fi
+ done
+}
+
+setup () {
+ getpath
+ mkdir -p $tapath/.glusterfs/indices
+ if [ -d $tapath/.glusterfs/indices ]; then
+ echo " "
+ else
+ echo "Could not create $tapath/.glusterfs/indices directory, check provided ta path."
+ exit 1
+ fi
+
+ cp -f --backup --suffix=_old $volfile $volloc/thin-arbiter.vol
+ volfile_set_brick_path "$tapath"
+
+ echo "Directory path to be used for thin-arbiter volume is: $tapath"
echo " "
-fi
+ echo "========================================================"
-mkdir -p $tapath/.glusterfs/indices
-volfile_set_brick_path "$tapath"
+ if [ -f /usr/lib/systemd/system/gluster-ta-volume.service ]; then
+ echo "Starting thin-arbiter process"
+ else
+ cp ../systemd/gluster-ta-volume.service /etc/systemd/system/
+ echo "Starting thin-arbiter process"
+ chmod 0644 /etc/systemd/system/gluster-ta-volume.service
+ fi
-echo "Directory path to be used for thin-arbiter volume is: $tapath"
-echo " "
+ systemctl daemon-reload
+ systemctl enable gluster-ta-volume
+ systemctl stop gluster-ta-volume
+ systemctl start gluster-ta-volume
-echo "========================================================"
+ if [ $? == 0 ]; then
+ echo "thin-arbiter process has been setup and running"
+ else
+ echo "Failed to setup thin arbiter"
+ exit 1
+ fi
-echo "Installing and starting service for thin-arbiter process"
+}
-cp extras/thin-arbiter/gluster-ta-volume.service /etc/systemd/system/
+main()
+{
-chmod 0777 /etc/systemd/system/gluster-ta-volume.service
+ if [ "$#" -ne 1 ]; then
+ help
+ exit 0
+ fi
-systemctl daemon-reload
-systemctl enable gluster-ta-volume
-systemctl stop gluster-ta-volume
-systemctl start gluster-ta-volume
+ while getopts "sh" opt; do
+ case $opt in
+ h)
+ help
+ exit 0
+ ;;
+ s)
+ setup
+ exit 0
+ ;;
+ *)
+ help
+ exit 0
+ ;;
+ esac
+ done
+}
-if [ $? == 0 ]
-then
- echo "thin-arbiter process is setup and running"
-else
- echo "Failed to setup thin arbiter"
-fi
+main "$@"
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
index 20abd35..c655f16 100644
--- a/glusterfs.spec.in
+++ b/glusterfs.spec.in
@@ -177,6 +177,7 @@
# can't seem to make a generic macro that works
%global glusterd_svcfile %{_unitdir}/glusterd.service
%global glusterfsd_svcfile %{_unitdir}/glusterfsd.service
+%global glusterta_svcfile %{_unitdir}/gluster-ta-volume.service
%global glustereventsd_svcfile %{_unitdir}/glustereventsd.service
%global glusterfssharedstorage_svcfile %{_unitdir}/glusterfssharedstorage.service
%else
@@ -639,6 +640,18 @@ is in user space and easily manageable.
This package provides the glusterfs server daemon.
%endif
+%package thin-arbiter
+Summary: GlusterFS thin-arbiter module
+Requires: %{name}%{?_isa} = %{version}-%{release}
+Requires: %{name}-server%{?_isa} = %{version}-%{release}
+
+%description thin-arbiter
+This package provides a tie-breaker functionality to GlusterFS
+replicate volume. It includes translators required to provide the
+functionality, and also few other scripts required for getting the setup done.
+
+This package provides the glusterfs thin-arbiter translator.
+
%package client-xlators
Summary: GlusterFS client-side translators
@@ -978,6 +991,14 @@ fi
exit 0
%endif
+%preun thin-arbiter
+if [ $1 -eq 0 ]; then
+ if [ -f %glusterta_svcfile ]; then
+ %service_stop gluster-ta-volume
+ %systemd_preun gluster-ta-volume
+ fi
+fi
+
##-----------------------------------------------------------------------------
## All %%postun should be placed here and keep them sorted
##
@@ -1134,6 +1155,19 @@ exit 0
%ghost %attr(0600,-,-) %{_sharedstatedir}/glusterd/nfs/run/nfs.pid
%endif
+%files thin-arbiter
+%dir %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator
+%dir %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features
+ %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/thin-arbiter.so
+%dir %{_datadir}/glusterfs/scripts
+ %{_datadir}/glusterfs/scripts/setup-thin-arbiter.sh
+%config %{_sysconfdir}/glusterfs/thin-arbiter.vol
+
+%if ( 0%{?_with_systemd:1} )
+%{_unitdir}/gluster-ta-volume.service
+%endif
+
+
%if ( 0%{!?_without_georeplication:1} )
%files geo-replication
%config(noreplace) %{_sysconfdir}/logrotate.d/glusterfs-georep
@@ -1212,6 +1246,7 @@ exit 0
%doc extras/clear_xattrs.sh
# sysconf
%config(noreplace) %{_sysconfdir}/glusterfs
+%exclude %{_sysconfdir}/glusterfs/thin-arbiter.vol
%exclude %{_sysconfdir}/glusterfs/eventsconfig.json
%exclude %{_sharedstatedir}/glusterd/nfs/nfs-server.vol
%exclude %{_sharedstatedir}/glusterd/nfs/run/nfs.pid
@@ -1248,7 +1283,6 @@ exit 0
%dir %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator
%dir %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features
%{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/arbiter.so
- %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/thin-arbiter.so
%{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/bit-rot.so
%{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/bitrot-stub.so
%{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/sdfs.so
@@ -1389,6 +1423,9 @@ exit 0
* Mon Mar 4 2019 Kaleb S. KEITHLEY <kkeithle@redhat.com>
- s390x has RDMA, since around Fedora 27 and in RHEL7 since June 2016.
+* Tue Feb 26 2019 Ashish Pandey <aspandey@redhat.com>
+- Add thin-arbiter package
+
* Sun Feb 24 2019 Aravinda VK <avishwan@redhat.com>
- Renamed events package to gfevents
diff --git a/xlators/features/thin-arbiter/src/Makefile.am b/xlators/features/thin-arbiter/src/Makefile.am
index 7fd31a6..a3c133e 100644
--- a/xlators/features/thin-arbiter/src/Makefile.am
+++ b/xlators/features/thin-arbiter/src/Makefile.am
@@ -1,6 +1,4 @@
-if WITH_SERVER
xlator_LTLIBRARIES = thin-arbiter.la
-endif
xlatordir = $(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator/features