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