256ebe
From 1fb89973551937f34f24b45e07072a6ce6c30ff9 Mon Sep 17 00:00:00 2001
256ebe
From: Jiffin Tony Thottan <jthottan@redhat.com>
256ebe
Date: Mon, 16 Oct 2017 14:18:31 +0530
256ebe
Subject: [PATCH 053/124] Revert "packaging: (ganesha) remove glusterfs-ganesha
256ebe
 subpackage and related files)"
256ebe
256ebe
This reverts commit 0cf2963f12a8b540a7042605d8c79f638fdf6cee.
256ebe
256ebe
Label: DOWNSTREAM ONLY
256ebe
256ebe
Change-Id: Id6e7585021bd4dd78a59580cfa4838bdd4e539a0
256ebe
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
256ebe
Reviewed-on: https://code.engineering.redhat.com/gerrit/167102
256ebe
Reviewed-by: Soumya Koduri <skoduri@redhat.com>
256ebe
Tested-by: RHGS Build Bot <nigelb@redhat.com>
256ebe
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
256ebe
---
256ebe
 configure.ac                                       |   3 +
256ebe
 extras/Makefile.am                                 |   3 +-
256ebe
 extras/ganesha/Makefile.am                         |   2 +
256ebe
 extras/ganesha/config/Makefile.am                  |   4 +
256ebe
 extras/ganesha/config/ganesha-ha.conf.sample       |  19 ++++
256ebe
 extras/ganesha/scripts/Makefile.am                 |   4 +
256ebe
 extras/ganesha/scripts/create-export-ganesha.sh    |  91 +++++++++++++++
256ebe
 extras/ganesha/scripts/dbus-send.sh                |  60 ++++++++++
256ebe
 extras/ganesha/scripts/generate-epoch.py           |  48 ++++++++
256ebe
 extras/hook-scripts/start/post/Makefile.am         |   2 +-
256ebe
 extras/hook-scripts/start/post/S31ganesha-start.sh | 122 +++++++++++++++++++++
256ebe
 glusterfs.spec.in                                  |  44 +++++++-
256ebe
 12 files changed, 396 insertions(+), 6 deletions(-)
256ebe
 create mode 100644 extras/ganesha/Makefile.am
256ebe
 create mode 100644 extras/ganesha/config/Makefile.am
256ebe
 create mode 100644 extras/ganesha/config/ganesha-ha.conf.sample
256ebe
 create mode 100644 extras/ganesha/scripts/Makefile.am
256ebe
 create mode 100755 extras/ganesha/scripts/create-export-ganesha.sh
256ebe
 create mode 100755 extras/ganesha/scripts/dbus-send.sh
256ebe
 create mode 100755 extras/ganesha/scripts/generate-epoch.py
256ebe
 create mode 100755 extras/hook-scripts/start/post/S31ganesha-start.sh
256ebe
256ebe
diff --git a/configure.ac b/configure.ac
256ebe
index 0d06f5a..125ae29 100644
256ebe
--- a/configure.ac
256ebe
+++ b/configure.ac
256ebe
@@ -196,6 +196,9 @@ AC_CONFIG_FILES([Makefile
256ebe
                 extras/init.d/glustereventsd-Debian
256ebe
                 extras/init.d/glustereventsd-Redhat
256ebe
                 extras/init.d/glustereventsd-FreeBSD
256ebe
+                extras/ganesha/Makefile
256ebe
+                extras/ganesha/config/Makefile
256ebe
+                extras/ganesha/scripts/Makefile
256ebe
                 extras/systemd/Makefile
256ebe
                 extras/systemd/glusterd.service
256ebe
                 extras/systemd/glustereventsd.service
256ebe
diff --git a/extras/Makefile.am b/extras/Makefile.am
256ebe
index ff5ca9b..983f014 100644
256ebe
--- a/extras/Makefile.am
256ebe
+++ b/extras/Makefile.am
256ebe
@@ -11,7 +11,8 @@ EditorModedir = $(docdir)
256ebe
 EditorMode_DATA = glusterfs-mode.el glusterfs.vim
256ebe
 
256ebe
 SUBDIRS = init.d systemd benchmarking hook-scripts $(OCF_SUBDIR) LinuxRPM \
256ebe
-          $(GEOREP_EXTRAS_SUBDIR) snap_scheduler firewalld cliutils python
256ebe
+          $(GEOREP_EXTRAS_SUBDIR) snap_scheduler firewalld cliutils python \
256ebe
+		  ganesha
256ebe
 
256ebe
 confdir = $(sysconfdir)/glusterfs
256ebe
 if WITH_SERVER
256ebe
diff --git a/extras/ganesha/Makefile.am b/extras/ganesha/Makefile.am
256ebe
new file mode 100644
256ebe
index 0000000..542de68
256ebe
--- /dev/null
256ebe
+++ b/extras/ganesha/Makefile.am
256ebe
@@ -0,0 +1,2 @@
256ebe
+SUBDIRS = scripts config
256ebe
+CLEANFILES =
256ebe
diff --git a/extras/ganesha/config/Makefile.am b/extras/ganesha/config/Makefile.am
256ebe
new file mode 100644
256ebe
index 0000000..c729273
256ebe
--- /dev/null
256ebe
+++ b/extras/ganesha/config/Makefile.am
256ebe
@@ -0,0 +1,4 @@
256ebe
+EXTRA_DIST= ganesha-ha.conf.sample
256ebe
+
256ebe
+confdir = $(sysconfdir)/ganesha
256ebe
+conf_DATA = ganesha-ha.conf.sample
256ebe
diff --git a/extras/ganesha/config/ganesha-ha.conf.sample b/extras/ganesha/config/ganesha-ha.conf.sample
256ebe
new file mode 100644
256ebe
index 0000000..c22892b
256ebe
--- /dev/null
256ebe
+++ b/extras/ganesha/config/ganesha-ha.conf.sample
256ebe
@@ -0,0 +1,19 @@
256ebe
+# Name of the HA cluster created.
256ebe
+# must be unique within the subnet
256ebe
+HA_NAME="ganesha-ha-360"
256ebe
+#
256ebe
+# N.B. you may use short names or long names; you may not use IP addrs.
256ebe
+# Once you select one, stay with it as it will be mildly unpleasant to
256ebe
+# clean up if you switch later on. Ensure that all names - short and/or
256ebe
+# long - are in DNS or /etc/hosts on all machines in the cluster.
256ebe
+#
256ebe
+# The subset of nodes of the Gluster Trusted Pool that form the ganesha
256ebe
+# HA cluster. Hostname is specified.
256ebe
+HA_CLUSTER_NODES="server1,server2,..."
256ebe
+#HA_CLUSTER_NODES="server1.lab.redhat.com,server2.lab.redhat.com,..."
256ebe
+#
256ebe
+# Virtual IPs for each of the nodes specified above.
256ebe
+VIP_server1="10.0.2.1"
256ebe
+VIP_server2="10.0.2.2"
256ebe
+#VIP_server1_lab_redhat_com="10.0.2.1"
256ebe
+#VIP_server2_lab_redhat_com="10.0.2.2"
256ebe
diff --git a/extras/ganesha/scripts/Makefile.am b/extras/ganesha/scripts/Makefile.am
256ebe
new file mode 100644
256ebe
index 0000000..00a2c45
256ebe
--- /dev/null
256ebe
+++ b/extras/ganesha/scripts/Makefile.am
256ebe
@@ -0,0 +1,4 @@
256ebe
+EXTRA_DIST= create-export-ganesha.sh generate-epoch.py dbus-send.sh
256ebe
+
256ebe
+scriptsdir = $(libexecdir)/ganesha
256ebe
+scripts_SCRIPTS = create-export-ganesha.sh dbus-send.sh generate-epoch.py
256ebe
diff --git a/extras/ganesha/scripts/create-export-ganesha.sh b/extras/ganesha/scripts/create-export-ganesha.sh
256ebe
new file mode 100755
256ebe
index 0000000..1ffba42
256ebe
--- /dev/null
256ebe
+++ b/extras/ganesha/scripts/create-export-ganesha.sh
256ebe
@@ -0,0 +1,91 @@
256ebe
+#!/bin/bash
256ebe
+
256ebe
+#This script is called by glusterd when the user
256ebe
+#tries to export a volume via NFS-Ganesha.
256ebe
+#An export file specific to a volume
256ebe
+#is created in GANESHA_DIR/exports.
256ebe
+
256ebe
+# Try loading the config from any of the distro
256ebe
+# specific configuration locations
256ebe
+if [ -f /etc/sysconfig/ganesha ]
256ebe
+        then
256ebe
+        . /etc/sysconfig/ganesha
256ebe
+fi
256ebe
+if [ -f /etc/conf.d/ganesha ]
256ebe
+        then
256ebe
+        . /etc/conf.d/ganesha
256ebe
+fi
256ebe
+if [ -f /etc/default/ganesha ]
256ebe
+        then
256ebe
+        . /etc/default/ganesha
256ebe
+fi
256ebe
+
256ebe
+GANESHA_DIR=${1%/}
256ebe
+OPTION=$2
256ebe
+VOL=$3
256ebe
+CONF=$GANESHA_DIR"/ganesha.conf"
256ebe
+declare -i EXPORT_ID
256ebe
+
256ebe
+function check_cmd_status()
256ebe
+{
256ebe
+        if [ "$1" != "0" ]
256ebe
+                 then
256ebe
+                 rm -rf $GANESHA_DIR/exports/export.$VOL.conf
256ebe
+                 sed -i /$VOL.conf/d $CONF
256ebe
+                 exit 1
256ebe
+        fi
256ebe
+}
256ebe
+
256ebe
+
256ebe
+if [ ! -d "$GANESHA_DIR/exports" ];
256ebe
+        then
256ebe
+        mkdir $GANESHA_DIR/exports
256ebe
+        check_cmd_status `echo $?`
256ebe
+fi
256ebe
+
256ebe
+function write_conf()
256ebe
+{
256ebe
+echo -e "# WARNING : Using Gluster CLI will overwrite manual
256ebe
+# changes made to this file. To avoid it, edit the
256ebe
+# file and run ganesha-ha.sh --refresh-config."
256ebe
+
256ebe
+echo "EXPORT{"
256ebe
+echo "      Export_Id = 2;"
256ebe
+echo "      Path = \"/$VOL\";"
256ebe
+echo "      FSAL {"
256ebe
+echo "           name = "GLUSTER";"
256ebe
+echo "           hostname=\"localhost\";"
256ebe
+echo  "          volume=\"$VOL\";"
256ebe
+echo "           }"
256ebe
+echo "      Access_type = RW;"
256ebe
+echo "      Disable_ACL = true;"
256ebe
+echo '      Squash="No_root_squash";'
256ebe
+echo "      Pseudo=\"/$VOL\";"
256ebe
+echo '      Protocols = "3", "4" ;'
256ebe
+echo '      Transports = "UDP","TCP";'
256ebe
+echo '      SecType = "sys";'
256ebe
+echo "     }"
256ebe
+}
256ebe
+if [ "$OPTION" = "on" ];
256ebe
+then
256ebe
+        if ! (cat $CONF | grep  $VOL.conf\"$ )
256ebe
+        then
256ebe
+                write_conf $@ > $GANESHA_DIR/exports/export.$VOL.conf
256ebe
+                echo "%include \"$GANESHA_DIR/exports/export.$VOL.conf\"" >> $CONF
256ebe
+                count=`ls -l $GANESHA_DIR/exports/*.conf | wc -l`
256ebe
+                if [ "$count" = "1" ] ; then
256ebe
+                        EXPORT_ID=2
256ebe
+                else
256ebe
+                        EXPORT_ID=`cat $GANESHA_DIR/.export_added`
256ebe
+                        check_cmd_status `echo $?`
256ebe
+                        EXPORT_ID=EXPORT_ID+1
256ebe
+                        sed -i s/Export_Id.*/"Export_Id= $EXPORT_ID ;"/ \
256ebe
+                        $GANESHA_DIR/exports/export.$VOL.conf
256ebe
+                        check_cmd_status `echo $?`
256ebe
+                fi
256ebe
+                echo $EXPORT_ID > $GANESHA_DIR/.export_added
256ebe
+        fi
256ebe
+else
256ebe
+        rm -rf $GANESHA_DIR/exports/export.$VOL.conf
256ebe
+        sed -i /$VOL.conf/d $CONF
256ebe
+fi
256ebe
diff --git a/extras/ganesha/scripts/dbus-send.sh b/extras/ganesha/scripts/dbus-send.sh
256ebe
new file mode 100755
256ebe
index 0000000..ec8d948
256ebe
--- /dev/null
256ebe
+++ b/extras/ganesha/scripts/dbus-send.sh
256ebe
@@ -0,0 +1,60 @@
256ebe
+#!/bin/bash
256ebe
+
256ebe
+# Try loading the config from any of the distro
256ebe
+# specific configuration locations
256ebe
+if [ -f /etc/sysconfig/ganesha ]
256ebe
+        then
256ebe
+        . /etc/sysconfig/ganesha
256ebe
+fi
256ebe
+if [ -f /etc/conf.d/ganesha ]
256ebe
+        then
256ebe
+        . /etc/conf.d/ganesha
256ebe
+fi
256ebe
+if [ -f /etc/default/ganesha ]
256ebe
+        then
256ebe
+        . /etc/default/ganesha
256ebe
+fi
256ebe
+
256ebe
+GANESHA_DIR=${1%/}
256ebe
+OPTION=$2
256ebe
+VOL=$3
256ebe
+CONF=$GANESHA_DIR"/ganesha.conf"
256ebe
+
256ebe
+function check_cmd_status()
256ebe
+{
256ebe
+        if [ "$1" != "0" ]
256ebe
+        then
256ebe
+                logger "dynamic export failed on node :${hostname -s}"
256ebe
+        fi
256ebe
+}
256ebe
+
256ebe
+#This function keeps track of export IDs and increments it with every new entry
256ebe
+function dynamic_export_add()
256ebe
+{
256ebe
+        dbus-send  --system \
256ebe
+--dest=org.ganesha.nfsd  /org/ganesha/nfsd/ExportMgr \
256ebe
+org.ganesha.nfsd.exportmgr.AddExport  string:$GANESHA_DIR/exports/export.$VOL.conf \
256ebe
+string:"EXPORT(Path=/$VOL)"
256ebe
+        check_cmd_status `echo $?`
256ebe
+}
256ebe
+
256ebe
+#This function removes an export dynamically(uses the export_id of the export)
256ebe
+function dynamic_export_remove()
256ebe
+{
256ebe
+        removed_id=`cat $GANESHA_DIR/exports/export.$VOL.conf |\
256ebe
+grep Export_Id | awk -F"[=,;]" '{print$2}'| tr -d '[[:space:]]'`
256ebe
+        dbus-send --print-reply --system \
256ebe
+--dest=org.ganesha.nfsd /org/ganesha/nfsd/ExportMgr \
256ebe
+org.ganesha.nfsd.exportmgr.RemoveExport uint16:$removed_id
256ebe
+        check_cmd_status `echo $?`
256ebe
+}
256ebe
+
256ebe
+if [ "$OPTION" = "on" ];
256ebe
+then
256ebe
+        dynamic_export_add $@
256ebe
+fi
256ebe
+
256ebe
+if [ "$OPTION" = "off" ];
256ebe
+then
256ebe
+        dynamic_export_remove $@
256ebe
+fi
256ebe
diff --git a/extras/ganesha/scripts/generate-epoch.py b/extras/ganesha/scripts/generate-epoch.py
256ebe
new file mode 100755
256ebe
index 0000000..5db5e56
256ebe
--- /dev/null
256ebe
+++ b/extras/ganesha/scripts/generate-epoch.py
256ebe
@@ -0,0 +1,48 @@
256ebe
+#!/usr/bin/python
256ebe
+#
256ebe
+# Copyright (c) 2016 Red Hat, Inc. <http://www.redhat.com>
256ebe
+# This file is part of GlusterFS.
256ebe
+#
256ebe
+# This file is licensed to you under your choice of the GNU Lesser
256ebe
+# General Public License, version 3 or any later version (LGPLv3 or
256ebe
+# later), or the GNU General Public License, version 2 (GPLv2), in all
256ebe
+# cases as published by the Free Software Foundation.
256ebe
+#
256ebe
+# Generates unique epoch value on each gluster node to be used by
256ebe
+# nfs-ganesha service on that node.
256ebe
+#
256ebe
+# Configure 'EPOCH_EXEC' option to this script path in
256ebe
+# '/etc/sysconfig/ganesha' file used by nfs-ganesha service.
256ebe
+#
256ebe
+# Construct epoch as follows -
256ebe
+#        first 32-bit contains the now() time
256ebe
+#        rest 32-bit value contains the local glusterd node uuid
256ebe
+
256ebe
+import time
256ebe
+import binascii
256ebe
+
256ebe
+# Calculate the now() time into a 64-bit integer value
256ebe
+def epoch_now():
256ebe
+        epoch_time = int(time.mktime(time.localtime())) << 32
256ebe
+        return epoch_time
256ebe
+
256ebe
+# Read glusterd UUID and extract first 32-bit of it
256ebe
+def epoch_uuid():
256ebe
+        file_name = '/var/lib/glusterd/glusterd.info'
256ebe
+
256ebe
+        for line in open(file_name):
256ebe
+                if "UUID" in line:
256ebe
+                        glusterd_uuid = line.split('=')[1].strip()
256ebe
+
256ebe
+        uuid_bin = binascii.unhexlify(glusterd_uuid.replace("-",""))
256ebe
+
256ebe
+        epoch_uuid = int(uuid_bin.encode('hex'), 32) & 0xFFFF0000
256ebe
+        return epoch_uuid
256ebe
+
256ebe
+# Construct epoch as follows -
256ebe
+#        first 32-bit contains the now() time
256ebe
+#        rest 32-bit value contains the local glusterd node uuid
256ebe
+epoch = (epoch_now() | epoch_uuid())
256ebe
+print str(epoch)
256ebe
+
256ebe
+exit(0)
256ebe
diff --git a/extras/hook-scripts/start/post/Makefile.am b/extras/hook-scripts/start/post/Makefile.am
256ebe
index e32546d..792019d 100644
256ebe
--- a/extras/hook-scripts/start/post/Makefile.am
256ebe
+++ b/extras/hook-scripts/start/post/Makefile.am
256ebe
@@ -1,4 +1,4 @@
256ebe
-EXTRA_DIST = S29CTDBsetup.sh S30samba-start.sh
256ebe
+EXTRA_DIST = S29CTDBsetup.sh S30samba-start.sh S31ganesha-start.sh
256ebe
 
256ebe
 hookdir = $(GLUSTERD_WORKDIR)/hooks/1/start/post/
256ebe
 if WITH_SERVER
256ebe
diff --git a/extras/hook-scripts/start/post/S31ganesha-start.sh b/extras/hook-scripts/start/post/S31ganesha-start.sh
256ebe
new file mode 100755
256ebe
index 0000000..90ba6bc
256ebe
--- /dev/null
256ebe
+++ b/extras/hook-scripts/start/post/S31ganesha-start.sh
256ebe
@@ -0,0 +1,122 @@
256ebe
+#!/bin/bash
256ebe
+PROGNAME="Sganesha-start"
256ebe
+OPTSPEC="volname:,gd-workdir:"
256ebe
+VOL=
256ebe
+declare -i EXPORT_ID
256ebe
+ganesha_key="ganesha.enable"
256ebe
+GANESHA_DIR="/var/run/gluster/shared_storage/nfs-ganesha"
256ebe
+CONF1="$GANESHA_DIR/ganesha.conf"
256ebe
+GLUSTERD_WORKDIR=
256ebe
+
256ebe
+function parse_args ()
256ebe
+{
256ebe
+        ARGS=$(getopt -l $OPTSPEC  -o "o" -name $PROGNAME $@)
256ebe
+        eval set -- "$ARGS"
256ebe
+
256ebe
+        while true; do
256ebe
+            case $1 in
256ebe
+                --volname)
256ebe
+                    shift
256ebe
+                    VOL=$1
256ebe
+                    ;;
256ebe
+                --gd-workdir)
256ebe
+                    shift
256ebe
+                    GLUSTERD_WORKDIR=$1
256ebe
+                    ;;
256ebe
+                *)
256ebe
+                    shift
256ebe
+                    break
256ebe
+                    ;;
256ebe
+            esac
256ebe
+            shift
256ebe
+        done
256ebe
+}
256ebe
+
256ebe
+
256ebe
+
256ebe
+#This function generates a new export entry as export.volume_name.conf
256ebe
+function write_conf()
256ebe
+{
256ebe
+echo -e "# WARNING : Using Gluster CLI will overwrite manual
256ebe
+# changes made to this file. To avoid it, edit the
256ebe
+# file, copy it over to all the NFS-Ganesha nodes
256ebe
+# and run ganesha-ha.sh --refresh-config."
256ebe
+
256ebe
+echo "EXPORT{"
256ebe
+echo "      Export_Id = 2;"
256ebe
+echo "      Path = \"/$VOL\";"
256ebe
+echo "      FSAL {"
256ebe
+echo "           name = \"GLUSTER\";"
256ebe
+echo "           hostname=\"localhost\";"
256ebe
+echo "           volume=\"$VOL\";"
256ebe
+echo "           }"
256ebe
+echo "      Access_type = RW;"
256ebe
+echo "      Disable_ACL = true;"
256ebe
+echo "      Squash=\"No_root_squash\";"
256ebe
+echo "      Pseudo=\"/$VOL\";"
256ebe
+echo "      Protocols = \"3\", \"4\" ;"
256ebe
+echo "      Transports = \"UDP\",\"TCP\";"
256ebe
+echo "      SecType = \"sys\";"
256ebe
+echo "}"
256ebe
+}
256ebe
+
256ebe
+#It adds the export dynamically by sending dbus signals
256ebe
+function export_add()
256ebe
+{
256ebe
+        dbus-send --print-reply --system --dest=org.ganesha.nfsd \
256ebe
+/org/ganesha/nfsd/ExportMgr org.ganesha.nfsd.exportmgr.AddExport \
256ebe
+string:$GANESHA_DIR/exports/export.$VOL.conf string:"EXPORT(Export_Id=$EXPORT_ID)"
256ebe
+
256ebe
+}
256ebe
+
256ebe
+# based on src/scripts/ganeshactl/Ganesha/export_mgr.py
256ebe
+function is_exported()
256ebe
+{
256ebe
+        local volume="${1}"
256ebe
+
256ebe
+        dbus-send --type=method_call --print-reply --system \
256ebe
+                  --dest=org.ganesha.nfsd /org/ganesha/nfsd/ExportMgr \
256ebe
+                  org.ganesha.nfsd.exportmgr.ShowExports \
256ebe
+            | grep -w -q "/${volume}"
256ebe
+
256ebe
+        return $?
256ebe
+}
256ebe
+
256ebe
+# Check the info file (contains the volume options) to see if Ganesha is
256ebe
+# enabled for this volume.
256ebe
+function ganesha_enabled()
256ebe
+{
256ebe
+        local volume="${1}"
256ebe
+        local info_file="${GLUSTERD_WORKDIR}/vols/${VOL}/info"
256ebe
+        local enabled="off"
256ebe
+
256ebe
+        enabled=$(grep -w ${ganesha_key} ${info_file} | cut -d"=" -f2)
256ebe
+
256ebe
+        [ "${enabled}" == "on" ]
256ebe
+
256ebe
+        return $?
256ebe
+}
256ebe
+
256ebe
+parse_args $@
256ebe
+
256ebe
+if ganesha_enabled ${VOL} && ! is_exported ${VOL}
256ebe
+then
256ebe
+        if [ ! -e ${GANESHA_DIR}/exports/export.${VOL}.conf ]
256ebe
+        then
256ebe
+                #Remove export entry from nfs-ganesha.conf
256ebe
+                sed -i /$VOL.conf/d  $CONF1
256ebe
+                write_conf ${VOL} > ${GANESHA_DIR}/exports/export.${VOL}.conf
256ebe
+                EXPORT_ID=`cat $GANESHA_DIR/.export_added`
256ebe
+                EXPORT_ID=EXPORT_ID+1
256ebe
+                echo $EXPORT_ID > $GANESHA_DIR/.export_added
256ebe
+                sed -i s/Export_Id.*/"Export_Id=$EXPORT_ID;"/ \
256ebe
+                        $GANESHA_DIR/exports/export.$VOL.conf
256ebe
+                echo "%include \"$GANESHA_DIR/exports/export.$VOL.conf\"" >> $CONF1
256ebe
+        else
256ebe
+                EXPORT_ID=$(grep ^[[:space:]]*Export_Id $GANESHA_DIR/exports/export.$VOL.conf |\
256ebe
+                          awk -F"[=,;]" '{print $2}' | tr -d '[[:space:]]')
256ebe
+        fi
256ebe
+        export_add $VOL
256ebe
+fi
256ebe
+
256ebe
+exit 0
256ebe
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
256ebe
index 0d57b49..dd7438c 100644
256ebe
--- a/glusterfs.spec.in
256ebe
+++ b/glusterfs.spec.in
256ebe
@@ -299,7 +299,6 @@ Obsoletes:        hekafs
256ebe
 Obsoletes:        %{name}-common < %{version}-%{release}
256ebe
 Obsoletes:        %{name}-core < %{version}-%{release}
256ebe
 Obsoletes:        %{name}-ufo
256ebe
-Obsoletes:        %{name}-ganesha
256ebe
 %if ( 0%{!?_with_gnfs:1} )
256ebe
 Obsoletes:        %{name}-gnfs
256ebe
 %endif
256ebe
@@ -455,6 +454,30 @@ is in user space and easily manageable.
256ebe
 This package provides support to FUSE based clients and inlcudes the
256ebe
 glusterfs(d) binary.
256ebe
 
256ebe
+%if ( 0%{!?_without_server:1} )
256ebe
+%package ganesha
256ebe
+Summary:          NFS-Ganesha configuration
256ebe
+Group:            Applications/File
256ebe
+
256ebe
+Requires:         %{name}-server%{?_isa} = %{version}-%{release}
256ebe
+Requires:         nfs-ganesha-gluster, pcs, dbus
256ebe
+%if ( 0%{?rhel} && 0%{?rhel} == 6 )
256ebe
+Requires:         cman, pacemaker, corosync
256ebe
+%endif
256ebe
+
256ebe
+%description ganesha
256ebe
+GlusterFS is a distributed file-system capable of scaling to several
256ebe
+petabytes. It aggregates various storage bricks over Infiniband RDMA
256ebe
+or TCP/IP interconnect into one large parallel network file
256ebe
+system. GlusterFS is one of the most sophisticated file systems in
256ebe
+terms of features and extensibility.  It borrows a powerful concept
256ebe
+called Translators from GNU Hurd kernel. Much of the code in GlusterFS
256ebe
+is in user space and easily manageable.
256ebe
+
256ebe
+This package provides the configuration and related files for using
256ebe
+NFS-Ganesha as the NFS server using GlusterFS
256ebe
+%endif
256ebe
+
256ebe
 %if ( 0%{!?_without_georeplication:1} )
256ebe
 %package geo-replication
256ebe
 Summary:          GlusterFS Geo-replication
256ebe
@@ -1111,6 +1134,12 @@ exit 0
256ebe
 %endif
256ebe
 %endif
256ebe
 
256ebe
+%if ( 0%{?_without_server:1} )
256ebe
+#exclude ganesha related files
256ebe
+%exclude %{_sysconfdir}/ganesha/*
256ebe
+%exclude %{_libexecdir}/ganesha/*
256ebe
+%endif
256ebe
+
256ebe
 %files api
256ebe
 %exclude %{_libdir}/*.so
256ebe
 # libgfapi files
256ebe
@@ -1273,6 +1302,12 @@ exit 0
256ebe
 %exclude %{_datadir}/glusterfs/tests/vagrant
256ebe
 %endif
256ebe
 
256ebe
+%if ( 0%{!?_without_server:1} )
256ebe
+%files ganesha
256ebe
+%{_sysconfdir}/ganesha/*
256ebe
+%{_libexecdir}/ganesha/*
256ebe
+%endif
256ebe
+
256ebe
 %if ( 0%{!?_without_ocf:1} )
256ebe
 %files resource-agents
256ebe
 # /usr/lib is the standard for OCF, also on x86_64
256ebe
@@ -1396,6 +1431,7 @@ exit 0
256ebe
        %dir %attr(0755,-,-) %{_sharedstatedir}/glusterd/hooks/1/start/post
256ebe
             %attr(0755,-,-) %{_sharedstatedir}/glusterd/hooks/1/start/post/S29CTDBsetup.sh
256ebe
             %attr(0755,-,-) %{_sharedstatedir}/glusterd/hooks/1/start/post/S30samba-start.sh
256ebe
+            %attr(0755,-,-) %{_sharedstatedir}/glusterd/hooks/1/start/post/S31ganesha-start.sh
256ebe
 %ghost %dir %attr(0755,-,-) %{_sharedstatedir}/glusterd/hooks/1/start/pre
256ebe
        %dir %attr(0755,-,-) %{_sharedstatedir}/glusterd/hooks/1/stop
256ebe
 %ghost %dir %attr(0755,-,-) %{_sharedstatedir}/glusterd/hooks/1/stop/post
256ebe
@@ -1868,6 +1904,9 @@ fi
256ebe
 %endif
256ebe
 
256ebe
 %changelog
256ebe
+* Fri Apr 5 2019 Jiffin Tony Thottan <jthottan@redhat.com>
256ebe
+- Adding ganesha bits back in gluster repository
256ebe
+
256ebe
 * Wed Mar 6 2019 Kaleb S. KEITHLEY <kkeithle@redhat.com>
256ebe
 - remove unneeded ldconfig in scriptlets
256ebe
 -  reported by Igor Gnatenko in Fedora
256ebe
@@ -1960,9 +1999,6 @@ fi
256ebe
 * Thu Feb 16 2017 Niels de Vos <ndevos@redhat.com>
256ebe
 - Obsolete and Provide python-gluster for upgrading from glusterfs < 3.10
256ebe
 
256ebe
-* Tue Feb 7 2017 Kaleb S. KEITHLEY <kkeithle@redhat.com>
256ebe
-- remove ganesha (#1418417)
256ebe
-
256ebe
 * Wed Feb 1 2017 Poornima G <pgurusid@redhat.com>
256ebe
 - Install /var/lib/glusterd/groups/metadata-cache by default
256ebe
 
256ebe
-- 
256ebe
1.8.3.1
256ebe