7f4c2a
From ff8624a0f0f953c853f6fbffede02cae2e04bf45 Mon Sep 17 00:00:00 2001
7f4c2a
From: "Bala.FA" <barumuga@redhat.com>
7f4c2a
Date: Fri, 28 Feb 2014 15:28:44 +0530
7f4c2a
Subject: [PATCH 17/18] build: add RHGS specific changes
7f4c2a
7f4c2a
Label: DOWNSTREAM ONLY
7f4c2a
7f4c2a
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1074947
7f4c2a
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1097782
7f4c2a
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1115267
7f4c2a
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1221743
7f4c2a
Change-Id: I08333334745adf2350e772c6454ffcfe9c08cb89
7f4c2a
Reviewed-on: https://code.engineering.redhat.com/gerrit/24983
7f4c2a
Reviewed-on: https://code.engineering.redhat.com/gerrit/25451
7f4c2a
Reviewed-on: https://code.engineering.redhat.com/gerrit/25518
7f4c2a
Reviewed-on: https://code.engineering.redhat.com/gerrit/25983
7f4c2a
Signed-off-by: Bala.FA <barumuga@redhat.com>
7f4c2a
---
7f4c2a
 glusterfs.spec.in | 565 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
7f4c2a
 1 file changed, 562 insertions(+), 3 deletions(-)
7f4c2a
7f4c2a
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
7f4c2a
index d60a618..dc87e83 100644
7f4c2a
--- a/glusterfs.spec.in
7f4c2a
+++ b/glusterfs.spec.in
7f4c2a
@@ -72,6 +72,23 @@
7f4c2a
 %define _without_qemu_block --disable-qemu-block
7f4c2a
 %endif
7f4c2a
 
7f4c2a
+# if you wish not to build server rpms, compile like this.
7f4c2a
+# rpmbuild -ta @PACKAGE_NAME@-@PACKAGE_VERSION@.tar.gz --without server
7f4c2a
+
7f4c2a
+%global _build_server 1
7f4c2a
+%if "%{?_without_server}"
7f4c2a
+%global _build_server 0
7f4c2a
+%endif
7f4c2a
+
7f4c2a
+%if ( "%{?dist}" == ".el6rhs" ) || ( "%{?dist}" == ".el7rhs" ) || ( "%{?dist}" == ".el7rhgs" )
7f4c2a
+%global _build_server 1
7f4c2a
+%else
7f4c2a
+%global _build_server 0
7f4c2a
+%endif
7f4c2a
+
7f4c2a
+%global _without_extra_xlators 1
7f4c2a
+%global _without_regression_tests 1
7f4c2a
+
7f4c2a
 ##-----------------------------------------------------------------------------
7f4c2a
 ## All %global definitions should be placed here and keep them sorted
7f4c2a
 ##
7f4c2a
@@ -161,8 +178,8 @@ Vendor:           Fedora Project
7f4c2a
 %else
7f4c2a
 Name:             @PACKAGE_NAME@
7f4c2a
 Version:          @PACKAGE_VERSION@
7f4c2a
-Release:          0.@PACKAGE_RELEASE@%{?dist}
7f4c2a
-Vendor:           glusterfs.org
7f4c2a
+Release:          @PACKAGE_RELEASE@%{?dist}
7f4c2a
+ExclusiveArch:    x86_64 aarch64
7f4c2a
 %endif
7f4c2a
 License:          GPLv2 or LGPLv3+
7f4c2a
 Group:            System Environment/Base
7f4c2a
@@ -292,7 +309,9 @@ Summary:          Development Libraries
7f4c2a
 Group:            Development/Libraries
7f4c2a
 Requires:         %{name} = %{version}-%{release}
7f4c2a
 # Needed for the Glupy examples to work
7f4c2a
+%if ( 0%{!?_without_extra_xlators:1} )
7f4c2a
 Requires:         %{name}-extra-xlators = %{version}-%{release}
7f4c2a
+%endif
7f4c2a
 
7f4c2a
 %description devel
7f4c2a
 GlusterFS is a distributed file-system capable of scaling to several
7f4c2a
@@ -305,6 +324,7 @@ is in user space and easily manageable.
7f4c2a
 
7f4c2a
 This package provides the development libraries and include files.
7f4c2a
 
7f4c2a
+%if ( 0%{!?_without_extra_xlators:1} )
7f4c2a
 %package extra-xlators
7f4c2a
 Summary:          Extra Gluster filesystem Translators
7f4c2a
 Group:            Applications/File
7f4c2a
@@ -324,6 +344,7 @@ is in user space and easily manageable.
7f4c2a
 
7f4c2a
 This package provides extra filesystem Translators, such as Glupy,
7f4c2a
 for GlusterFS.
7f4c2a
+%endif
7f4c2a
 
7f4c2a
 %package fuse
7f4c2a
 Summary:          Fuse client
7f4c2a
@@ -349,6 +370,7 @@ is in user space and easily manageable.
7f4c2a
 This package provides support to FUSE based clients and inlcudes the
7f4c2a
 glusterfs(d) binary.
7f4c2a
 
7f4c2a
+%if ( 0%{?_build_server} )
7f4c2a
 %package ganesha
7f4c2a
 Summary:          NFS-Ganesha configuration
7f4c2a
 Group:            Applications/File
7f4c2a
@@ -368,7 +390,9 @@ is in user space and easily manageable.
7f4c2a
 
7f4c2a
 This package provides the configuration and related files for using
7f4c2a
 NFS-Ganesha as the NFS server using GlusterFS
7f4c2a
+%endif
7f4c2a
 
7f4c2a
+%if ( 0%{?_build_server} )
7f4c2a
 %if ( 0%{!?_without_georeplication:1} )
7f4c2a
 %package geo-replication
7f4c2a
 Summary:          GlusterFS Geo-replication
7f4c2a
@@ -388,6 +412,7 @@ is in userspace and easily manageable.
7f4c2a
 
7f4c2a
 This package provides support to geo-replication.
7f4c2a
 %endif
7f4c2a
+%endif
7f4c2a
 
7f4c2a
 %package libs
7f4c2a
 Summary:          GlusterFS common libraries
7f4c2a
@@ -450,6 +475,8 @@ is in user space and easily manageable.
7f4c2a
 This package provides support to ib-verbs library.
7f4c2a
 %endif
7f4c2a
 
7f4c2a
+%if ( 0%{?_build_server} )
7f4c2a
+%if ( 0%{!?_without_regression_tests:1} )
7f4c2a
 %package regression-tests
7f4c2a
 Summary:          Development Tools
7f4c2a
 Group:            Development/Tools
7f4c2a
@@ -465,7 +492,10 @@ Requires:         nfs-utils xfsprogs yajl
7f4c2a
 %description regression-tests
7f4c2a
 The Gluster Test Framework, is a suite of scripts used for
7f4c2a
 regression testing of Gluster.
7f4c2a
+%endif
7f4c2a
+%endif
7f4c2a
 
7f4c2a
+%if ( 0%{?_build_server} )
7f4c2a
 %if ( 0%{!?_without_ocf:1} )
7f4c2a
 %package resource-agents
7f4c2a
 Summary:          OCF Resource Agents for GlusterFS
7f4c2a
@@ -498,7 +528,9 @@ This package provides the resource agents which plug glusterd into
7f4c2a
 Open Cluster Framework (OCF) compliant cluster resource managers,
7f4c2a
 like Pacemaker.
7f4c2a
 %endif
7f4c2a
+%endif
7f4c2a
 
7f4c2a
+%if ( 0%{?_build_server} )
7f4c2a
 %package server
7f4c2a
 Summary:          Clustered file-system server
7f4c2a
 Group:            System Environment/Daemons
7f4c2a
@@ -547,6 +579,7 @@ called Translators from GNU Hurd kernel. Much of the code in GlusterFS
7f4c2a
 is in user space and easily manageable.
7f4c2a
 
7f4c2a
 This package provides the glusterfs server daemon.
7f4c2a
+%endif
7f4c2a
 
7f4c2a
 %package client-xlators
7f4c2a
 Summary:          GlusterFS client-side translators
7f4c2a
@@ -569,7 +602,7 @@ This package provides the translators needed on any GlusterFS client.
7f4c2a
 %build
7f4c2a
 # For whatever reason, install-sh is sometimes missing. When this gets fixed,
7f4c2a
 # there is no need to run ./autogen or have a BuildRequires for automake.
7f4c2a
-[ -e 'install-sh' -o -e 'install.sh' ] || ./autogen.sh
7f4c2a
+./autogen.sh
7f4c2a
 %configure \
7f4c2a
         %{?_with_tmpfilesdir} \
7f4c2a
         %{?_without_rdma} \
7f4c2a
@@ -774,6 +807,7 @@ rm -rf %{buildroot}
7f4c2a
 modprobe fuse
7f4c2a
 %endif
7f4c2a
 
7f4c2a
+%if ( 0%{?_build_server} )
7f4c2a
 %if ( 0%{!?_without_georeplication:1} )
7f4c2a
 %post geo-replication
7f4c2a
 #restart glusterd.
7f4c2a
@@ -781,14 +815,19 @@ if [ $1 -ge 1 ]; then
7f4c2a
     %_init_restart glusterd
7f4c2a
 fi
7f4c2a
 %endif
7f4c2a
+%endif
7f4c2a
 
7f4c2a
 %post libs
7f4c2a
 /sbin/ldconfig
7f4c2a
 
7f4c2a
+%if ( 0%{?_build_server} )
7f4c2a
 %post server
7f4c2a
 # Legacy server
7f4c2a
 %_init_enable glusterd
7f4c2a
+# fix bz#1110715
7f4c2a
+if [ -f %_init_glusterfsd ]; then
7f4c2a
 %_init_enable glusterfsd
7f4c2a
+fi
7f4c2a
 # ".cmd_log_history" is renamed to "cmd_history.log" in GlusterFS-3.7 .
7f4c2a
 # While upgrading glusterfs-server package form GlusterFS version <= 3.6 to
7f4c2a
 # GlusterFS version 3.7, ".cmd_log_history" should be renamed to
7f4c2a
@@ -848,10 +887,12 @@ else
7f4c2a
     #rpm_script_t context.
7f4c2a
     rm -rf /var/run/glusterd.socket
7f4c2a
 fi
7f4c2a
+%endif
7f4c2a
 
7f4c2a
 ##-----------------------------------------------------------------------------
7f4c2a
 ## All %preun should be placed here and keep them sorted
7f4c2a
 ##
7f4c2a
+%if ( 0%{?_build_server} )
7f4c2a
 %preun server
7f4c2a
 if [ $1 -eq 0 ]; then
7f4c2a
     if [ -f %_init_glusterfsd ]; then
7f4c2a
@@ -869,6 +910,7 @@ if [ $1 -ge 1 ]; then
7f4c2a
     fi
7f4c2a
     %_init_restart glusterd
7f4c2a
 fi
7f4c2a
+%endif
7f4c2a
 
7f4c2a
 ##-----------------------------------------------------------------------------
7f4c2a
 ## All %postun should be placed here and keep them sorted
7f4c2a
@@ -891,6 +933,80 @@ fi
7f4c2a
 ## All files should be placed here and keep them grouped
7f4c2a
 ##
7f4c2a
 %files
7f4c2a
+# exclude extra-xlators files
7f4c2a
+%if ( ! 0%{!?_without_extra_xlators:1} )
7f4c2a
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/encryption/rot-13.so
7f4c2a
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/glupy.so
7f4c2a
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/mac-compat.so
7f4c2a
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/prot_client.so
7f4c2a
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/prot_dht.so
7f4c2a
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/prot_server.so
7f4c2a
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/quiesce.so
7f4c2a
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/testing/features/template.so
7f4c2a
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/testing/performance/symlink-cache.so
7f4c2a
+%exclude %{python_sitelib}/*
7f4c2a
+%endif
7f4c2a
+# exclude regression-tests files
7f4c2a
+%if ( ! 0%{!?_without_regression_tests:1} )
7f4c2a
+%exclude %{_prefix}/share/glusterfs/run-tests.sh
7f4c2a
+%exclude %{_prefix}/share/glusterfs/tests/*
7f4c2a
+%endif
7f4c2a
+%if ( ! 0%{?_build_server} )
7f4c2a
+# exclude ganesha files
7f4c2a
+%exclude %{_sysconfdir}/ganesha/*
7f4c2a
+%exclude %{_libexecdir}/ganesha/*
7f4c2a
+%exclude %{_prefix}/lib/ocf/*
7f4c2a
+# exclude geo-replication files
7f4c2a
+%exclude %{_sysconfdir}/logrotate.d/glusterfs-georep
7f4c2a
+%exclude %{_libexecdir}/glusterfs/*
7f4c2a
+%exclude %{_sbindir}/gfind_missing_files
7f4c2a
+%exclude %{_datadir}/glusterfs/scripts/get-gfid.sh
7f4c2a
+%exclude %{_datadir}/glusterfs/scripts/slave-upgrade.sh
7f4c2a
+%exclude %{_datadir}/glusterfs/scripts/gsync-upgrade.sh
7f4c2a
+%exclude %{_datadir}/glusterfs/scripts/generate-gfid-file.sh
7f4c2a
+%exclude %{_datadir}/glusterfs/scripts/gsync-sync-gfid
7f4c2a
+%exclude %{_sharedstatedir}/glusterd/*
7f4c2a
+# exclude server files
7f4c2a
+%exclude %{_sysconfdir}/glusterfs
7f4c2a
+%exclude %{_sysconfdir}/glusterfs/glusterd.vol
7f4c2a
+%exclude %{_sysconfdir}/glusterfs/glusterfs-georep-logrotate
7f4c2a
+%exclude %{_sysconfdir}/glusterfs/glusterfs-logrotate
7f4c2a
+%exclude %{_sysconfdir}/glusterfs/gluster-rsyslog-5.8.conf
7f4c2a
+%exclude %{_sysconfdir}/glusterfs/gluster-rsyslog-7.2.conf
7f4c2a
+%exclude %{_sysconfdir}/glusterfs/group-virt.example
7f4c2a
+%exclude %{_sysconfdir}/glusterfs/logger.conf.example
7f4c2a
+%exclude %_init_glusterd
7f4c2a
+%exclude %{_sysconfdir}/sysconfig/glusterd
7f4c2a
+%exclude %{_bindir}/glusterfind
7f4c2a
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/cluster/pump.so
7f4c2a
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/arbiter.so
7f4c2a
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/bit-rot.so
7f4c2a
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/bitrot-stub.so
7f4c2a
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/changetimerecorder.so
7f4c2a
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/index.so
7f4c2a
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/locks.so
7f4c2a
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/posix*
7f4c2a
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/snapview-server.so
7f4c2a
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/marker.so
7f4c2a
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/quota*
7f4c2a
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/trash.so
7f4c2a
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/upcall.so
7f4c2a
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/mgmt*
7f4c2a
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/nfs*
7f4c2a
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/protocol/server*
7f4c2a
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/storage*
7f4c2a
+%exclude %{_libdir}/libgfdb.so.*
7f4c2a
+%exclude %{_sbindir}/gcron.py
7f4c2a
+%exclude %{_sbindir}/glfsheal
7f4c2a
+%exclude %{_sbindir}/glusterd
7f4c2a
+%exclude %{_sbindir}/snap_scheduler.py
7f4c2a
+%exclude %{_datadir}/glusterfs/scripts/stop-all-gluster-processes.sh
7f4c2a
+#/usr/share/doc/glusterfs-server-3.7.0beta2/clear_xattrs.sh
7f4c2a
+%exclude %{_localstatedir}/run/gluster
7f4c2a
+%if 0%{?_tmpfilesdir:1}
7f4c2a
+%exclude %{_tmpfilesdir}/gluster.conf
7f4c2a
+%endif
7f4c2a
+%endif
7f4c2a
 %doc ChangeLog COPYING-GPLV2 COPYING-LGPLV3 INSTALL README.md THANKS
7f4c2a
 %if ( 0%{!?_without_syslog:1} )
7f4c2a
 %if ( 0%{?fedora} ) || ( 0%{?rhel} && 0%{?rhel} >= 6 )
7f4c2a
@@ -975,6 +1091,7 @@ fi
7f4c2a
 %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/qemu-block.so
7f4c2a
 %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/protocol/client.so
7f4c2a
 
7f4c2a
+%if ( 0%{!?_without_extra_xlators:1} )
7f4c2a
 %files extra-xlators
7f4c2a
 %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/encryption/rot-13.so
7f4c2a
 %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/glupy.so
7f4c2a
@@ -991,6 +1108,7 @@ fi
7f4c2a
 %if ( ! ( 0%{?rhel} && 0%{?rhel} < 6 ) )
7f4c2a
 %{python_sitelib}/glusterfs_glupy*.egg-info
7f4c2a
 %endif
7f4c2a
+%endif
7f4c2a
 
7f4c2a
 %files fuse
7f4c2a
 # glusterfs is a symlink to glusterfsd, -server depends on -fuse.
7f4c2a
@@ -1008,11 +1126,14 @@ fi
7f4c2a
 %endif
7f4c2a
 %endif
7f4c2a
 
7f4c2a
+%if ( 0%{?_build_server} )
7f4c2a
 %files ganesha
7f4c2a
 %{_sysconfdir}/ganesha/*
7f4c2a
 %attr(0755,-,-) %{_libexecdir}/ganesha/*
7f4c2a
 %attr(0755,-,-) %{_prefix}/lib/ocf/resource.d/heartbeat/*
7f4c2a
+%endif
7f4c2a
 
7f4c2a
+%if ( 0%{?_build_server} )
7f4c2a
 %if ( 0%{!?_without_georeplication:1} )
7f4c2a
 %files geo-replication
7f4c2a
 %config(noreplace) %{_sysconfdir}/logrotate.d/glusterfs-georep
7f4c2a
@@ -1035,6 +1156,7 @@ fi
7f4c2a
 %exclude %{_libexecdir}/glusterfs/gfind_missing_files/gfid_to_path.pyo
7f4c2a
 %exclude %{_libexecdir}/glusterfs/gfind_missing_files/gfid_to_path.pyc
7f4c2a
 %endif
7f4c2a
+%endif
7f4c2a
 
7f4c2a
 %files libs
7f4c2a
 %{_libdir}/*.so.*
7f4c2a
@@ -1052,18 +1174,26 @@ fi
7f4c2a
 %{_libdir}/glusterfs/%{version}%{?prereltag}/rpc-transport/rdma*
7f4c2a
 %endif
7f4c2a
 
7f4c2a
+%if ( 0%{?_build_server} )
7f4c2a
+%if ( 0%{!?_without_regression_tests:1} )
7f4c2a
 %files regression-tests
7f4c2a
 %{_prefix}/share/glusterfs/run-tests.sh
7f4c2a
 %{_prefix}/share/glusterfs/tests
7f4c2a
 %exclude %{_prefix}/share/glusterfs/tests/basic/rpm.t
7f4c2a
+%endif
7f4c2a
+%endif
7f4c2a
 
7f4c2a
+%if ( 0%{?_build_server} )
7f4c2a
 %if ( 0%{!?_without_ocf:1} )
7f4c2a
 %files resource-agents
7f4c2a
 # /usr/lib is the standard for OCF, also on x86_64
7f4c2a
 %{_prefix}/lib/ocf/resource.d/glusterfs
7f4c2a
 %endif
7f4c2a
+%endif
7f4c2a
 
7f4c2a
+%if ( 0%{?_build_server} )
7f4c2a
 %files server
7f4c2a
+%exclude %{_sharedstatedir}/glusterd/hooks/1/gsync-create/post/S56glusterd-geo-rep-create-post.sh
7f4c2a
 %doc extras/clear_xattrs.sh
7f4c2a
 %config(noreplace) %{_sysconfdir}/sysconfig/glusterd
7f4c2a
 %config(noreplace) %{_sysconfdir}/glusterfs
7f4c2a
@@ -1071,6 +1201,7 @@ fi
7f4c2a
 %if 0%{?_tmpfilesdir:1}
7f4c2a
 %{_tmpfilesdir}/gluster.conf
7f4c2a
 %endif
7f4c2a
+%dir %{_sharedstatedir}/glusterd
7f4c2a
 %{_sharedstatedir}/glusterd/*
7f4c2a
 %dir %{_sharedstatedir}/glusterd/groups
7f4c2a
 %config(noreplace) %{_sharedstatedir}/glusterd/groups/virt
7f4c2a
@@ -1147,7 +1278,435 @@ fi
7f4c2a
 %{_libexecdir}/glusterfs/glusterfind
7f4c2a
 %{_bindir}/glusterfind
7f4c2a
 %{_libexecdir}/glusterfs/peer_add_secret_pub
7f4c2a
+%endif
7f4c2a
+
7f4c2a
+
7f4c2a
+##-----------------------------------------------------------------------------
7f4c2a
+## All %pretrans should be placed here and keep them sorted
7f4c2a
+##
7f4c2a
+%if 0%{?_build_server}
7f4c2a
+%pretrans -p <lua>
7f4c2a
+if not posix.access("/bin/bash", "x") then
7f4c2a
+    -- initial installation, no shell, no running glusterfsd
7f4c2a
+    return 0
7f4c2a
+end
7f4c2a
+
7f4c2a
+-- TODO: move this completely to a lua script
7f4c2a
+-- For now, we write a temporary bash script and execute that.
7f4c2a
+
7f4c2a
+script = [[#!/bin/sh
7f4c2a
+pidof -c -o %PPID -x glusterfsd &>/dev/null
7f4c2a
+
7f4c2a
+if [ $? -eq 0 ]; then
7f4c2a
+   pushd . > /dev/null 2>&1
7f4c2a
+   for volume in /var/lib/glusterd/vols/*; do cd $volume;
7f4c2a
+       vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
7f4c2a
+       volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
7f4c2a
+       if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
7f4c2a
+          echo "ERROR: Distribute volumes detected. In-service rolling upgrade requires distribute volume(s) to be stopped."
7f4c2a
+          echo "ERROR: Please stop distribute volume(s) before proceeding... exiting!"
7f4c2a
+          exit 1;
7f4c2a
+       fi
7f4c2a
+   done
7f4c2a
+
7f4c2a
+   popd > /dev/null 2>&1
7f4c2a
+   echo "WARNING: Updating glusterfs requires its processes to be killed. This action does NOT incur downtime."
7f4c2a
+   echo "WARNING: Ensure to wait for the upgraded server to finish healing before proceeding."
7f4c2a
+   echo "WARNING: Refer upgrade section of install guide for more details"
7f4c2a
+   echo "Please run # service glusterd stop; pkill glusterfs; pkill glusterfsd; pkill gsyncd.py;"
7f4c2a
+   exit 1;
7f4c2a
+fi
7f4c2a
+]]
7f4c2a
+
7f4c2a
+-- rpm in RHEL5 does not have os.tmpname()
7f4c2a
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
7f4c2a
+tmpname = "/tmp/glusterfs_pretrans_" .. os.date("%s")
7f4c2a
+tmpfile = io.open(tmpname, "w")
7f4c2a
+tmpfile:write(script)
7f4c2a
+tmpfile:close()
7f4c2a
+ok, how, val = os.execute("/bin/bash " .. tmpname)
7f4c2a
+os.remove(tmpname)
7f4c2a
+if not (ok == 0) then
7f4c2a
+   error("Detected running glusterfs processes", ok)
7f4c2a
+end
7f4c2a
+
7f4c2a
+
7f4c2a
+
7f4c2a
+%pretrans api -p <lua>
7f4c2a
+if not posix.access("/bin/bash", "x") then
7f4c2a
+    -- initial installation, no shell, no running glusterfsd
7f4c2a
+    return 0
7f4c2a
+end
7f4c2a
+
7f4c2a
+-- TODO: move this completely to a lua script
7f4c2a
+-- For now, we write a temporary bash script and execute that.
7f4c2a
+
7f4c2a
+script = [[#!/bin/sh
7f4c2a
+pidof -c -o %PPID -x glusterfsd &>/dev/null
7f4c2a
+
7f4c2a
+if [ $? -eq 0 ]; then
7f4c2a
+   pushd . > /dev/null 2>&1
7f4c2a
+   for volume in /var/lib/glusterd/vols/*; do cd $volume;
7f4c2a
+       vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
7f4c2a
+       volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
7f4c2a
+       if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
7f4c2a
+          exit 1;
7f4c2a
+       fi
7f4c2a
+   done
7f4c2a
+
7f4c2a
+   popd > /dev/null 2>&1
7f4c2a
+   exit 1;
7f4c2a
+fi
7f4c2a
+]]
7f4c2a
 
7f4c2a
+-- rpm in RHEL5 does not have os.tmpname()
7f4c2a
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
7f4c2a
+tmpname = "/tmp/glusterfs-api_pretrans_" .. os.date("%s")
7f4c2a
+tmpfile = io.open(tmpname, "w")
7f4c2a
+tmpfile:write(script)
7f4c2a
+tmpfile:close()
7f4c2a
+ok, how, val = os.execute("/bin/bash " .. tmpname)
7f4c2a
+os.remove(tmpname)
7f4c2a
+if not (ok == 0) then
7f4c2a
+   error("Detected running glusterfs processes", ok)
7f4c2a
+end
7f4c2a
+
7f4c2a
+
7f4c2a
+
7f4c2a
+%pretrans api-devel -p <lua>
7f4c2a
+if not posix.access("/bin/bash", "x") then
7f4c2a
+    -- initial installation, no shell, no running glusterfsd
7f4c2a
+    return 0
7f4c2a
+end
7f4c2a
+
7f4c2a
+-- TODO: move this completely to a lua script
7f4c2a
+-- For now, we write a temporary bash script and execute that.
7f4c2a
+
7f4c2a
+script = [[#!/bin/sh
7f4c2a
+pidof -c -o %PPID -x glusterfsd &>/dev/null
7f4c2a
+
7f4c2a
+if [ $? -eq 0 ]; then
7f4c2a
+   pushd . > /dev/null 2>&1
7f4c2a
+   for volume in /var/lib/glusterd/vols/*; do cd $volume;
7f4c2a
+       vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
7f4c2a
+       volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
7f4c2a
+       if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
7f4c2a
+          exit 1;
7f4c2a
+       fi
7f4c2a
+   done
7f4c2a
+
7f4c2a
+   popd > /dev/null 2>&1
7f4c2a
+   exit 1;
7f4c2a
+fi
7f4c2a
+]]
7f4c2a
+
7f4c2a
+-- rpm in RHEL5 does not have os.tmpname()
7f4c2a
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
7f4c2a
+tmpname = "/tmp/glusterfs-api-devel_pretrans_" .. os.date("%s")
7f4c2a
+tmpfile = io.open(tmpname, "w")
7f4c2a
+tmpfile:write(script)
7f4c2a
+tmpfile:close()
7f4c2a
+ok, how, val = os.execute("/bin/bash " .. tmpname)
7f4c2a
+os.remove(tmpname)
7f4c2a
+if not (ok == 0) then
7f4c2a
+   error("Detected running glusterfs processes", ok)
7f4c2a
+end
7f4c2a
+
7f4c2a
+
7f4c2a
+
7f4c2a
+%pretrans devel -p <lua>
7f4c2a
+if not posix.access("/bin/bash", "x") then
7f4c2a
+    -- initial installation, no shell, no running glusterfsd
7f4c2a
+    return 0
7f4c2a
+end
7f4c2a
+
7f4c2a
+-- TODO: move this completely to a lua script
7f4c2a
+-- For now, we write a temporary bash script and execute that.
7f4c2a
+
7f4c2a
+script = [[#!/bin/sh
7f4c2a
+pidof -c -o %PPID -x glusterfsd &>/dev/null
7f4c2a
+
7f4c2a
+if [ $? -eq 0 ]; then
7f4c2a
+   pushd . > /dev/null 2>&1
7f4c2a
+   for volume in /var/lib/glusterd/vols/*; do cd $volume;
7f4c2a
+       vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
7f4c2a
+       volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
7f4c2a
+       if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
7f4c2a
+          exit 1;
7f4c2a
+       fi
7f4c2a
+   done
7f4c2a
+
7f4c2a
+   popd > /dev/null 2>&1
7f4c2a
+   exit 1;
7f4c2a
+fi
7f4c2a
+]]
7f4c2a
+
7f4c2a
+-- rpm in RHEL5 does not have os.tmpname()
7f4c2a
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
7f4c2a
+tmpname = "/tmp/glusterfs-devel_pretrans_" .. os.date("%s")
7f4c2a
+tmpfile = io.open(tmpname, "w")
7f4c2a
+tmpfile:write(script)
7f4c2a
+tmpfile:close()
7f4c2a
+ok, how, val = os.execute("/bin/bash " .. tmpname)
7f4c2a
+os.remove(tmpname)
7f4c2a
+if not (ok == 0) then
7f4c2a
+   error("Detected running glusterfs processes", ok)
7f4c2a
+end
7f4c2a
+
7f4c2a
+
7f4c2a
+
7f4c2a
+%pretrans fuse -p <lua>
7f4c2a
+if not posix.access("/bin/bash", "x") then
7f4c2a
+    -- initial installation, no shell, no running glusterfsd
7f4c2a
+    return 0
7f4c2a
+end
7f4c2a
+
7f4c2a
+-- TODO: move this completely to a lua script
7f4c2a
+-- For now, we write a temporary bash script and execute that.
7f4c2a
+
7f4c2a
+script = [[#!/bin/sh
7f4c2a
+pidof -c -o %PPID -x glusterfsd &>/dev/null
7f4c2a
+
7f4c2a
+if [ $? -eq 0 ]; then
7f4c2a
+   pushd . > /dev/null 2>&1
7f4c2a
+   for volume in /var/lib/glusterd/vols/*; do cd $volume;
7f4c2a
+       vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
7f4c2a
+       volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
7f4c2a
+       if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
7f4c2a
+          exit 1;
7f4c2a
+       fi
7f4c2a
+   done
7f4c2a
+
7f4c2a
+   popd > /dev/null 2>&1
7f4c2a
+   exit 1;
7f4c2a
+fi
7f4c2a
+]]
7f4c2a
+
7f4c2a
+-- rpm in RHEL5 does not have os.tmpname()
7f4c2a
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
7f4c2a
+tmpname = "/tmp/glusterfs-fuse_pretrans_" .. os.date("%s")
7f4c2a
+tmpfile = io.open(tmpname, "w")
7f4c2a
+tmpfile:write(script)
7f4c2a
+tmpfile:close()
7f4c2a
+ok, how, val = os.execute("/bin/bash " .. tmpname)
7f4c2a
+os.remove(tmpname)
7f4c2a
+if not (ok == 0) then
7f4c2a
+   error("Detected running glusterfs processes", ok)
7f4c2a
+end
7f4c2a
+
7f4c2a
+
7f4c2a
+
7f4c2a
+%if 0%{?_can_georeplicate}
7f4c2a
+%if ( 0%{!?_without_georeplication:1} )
7f4c2a
+%pretrans geo-replication -p <lua>
7f4c2a
+if not posix.access("/bin/bash", "x") then
7f4c2a
+    -- initial installation, no shell, no running glusterfsd
7f4c2a
+    return 0
7f4c2a
+end
7f4c2a
+
7f4c2a
+-- TODO: move this completely to a lua script
7f4c2a
+-- For now, we write a temporary bash script and execute that.
7f4c2a
+
7f4c2a
+script = [[#!/bin/sh
7f4c2a
+pidof -c -o %PPID -x glusterfsd &>/dev/null
7f4c2a
+
7f4c2a
+if [ $? -eq 0 ]; then
7f4c2a
+   pushd . > /dev/null 2>&1
7f4c2a
+   for volume in /var/lib/glusterd/vols/*; do cd $volume;
7f4c2a
+       vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
7f4c2a
+       volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
7f4c2a
+       if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
7f4c2a
+          exit 1;
7f4c2a
+       fi
7f4c2a
+   done
7f4c2a
+
7f4c2a
+   popd > /dev/null 2>&1
7f4c2a
+   exit 1;
7f4c2a
+fi
7f4c2a
+]]
7f4c2a
+
7f4c2a
+-- rpm in RHEL5 does not have os.tmpname()
7f4c2a
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
7f4c2a
+tmpname = "/tmp/glusterfs-geo-replication_pretrans_" .. os.date("%s")
7f4c2a
+tmpfile = io.open(tmpname, "w")
7f4c2a
+tmpfile:write(script)
7f4c2a
+tmpfile:close()
7f4c2a
+ok, how, val = os.execute("/bin/bash " .. tmpname)
7f4c2a
+os.remove(tmpname)
7f4c2a
+if not (ok == 0) then
7f4c2a
+   error("Detected running glusterfs processes", ok)
7f4c2a
+end
7f4c2a
+%endif
7f4c2a
+%endif
7f4c2a
+
7f4c2a
+
7f4c2a
+
7f4c2a
+%pretrans libs -p <lua>
7f4c2a
+if not posix.access("/bin/bash", "x") then
7f4c2a
+    -- initial installation, no shell, no running glusterfsd
7f4c2a
+    return 0
7f4c2a
+end
7f4c2a
+
7f4c2a
+-- TODO: move this completely to a lua script
7f4c2a
+-- For now, we write a temporary bash script and execute that.
7f4c2a
+
7f4c2a
+script = [[#!/bin/sh
7f4c2a
+pidof -c -o %PPID -x glusterfsd &>/dev/null
7f4c2a
+
7f4c2a
+if [ $? -eq 0 ]; then
7f4c2a
+   pushd . > /dev/null 2>&1
7f4c2a
+   for volume in /var/lib/glusterd/vols/*; do cd $volume;
7f4c2a
+       vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
7f4c2a
+       volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
7f4c2a
+       if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
7f4c2a
+          exit 1;
7f4c2a
+       fi
7f4c2a
+   done
7f4c2a
+
7f4c2a
+   popd > /dev/null 2>&1
7f4c2a
+   exit 1;
7f4c2a
+fi
7f4c2a
+]]
7f4c2a
+
7f4c2a
+-- rpm in RHEL5 does not have os.tmpname()
7f4c2a
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
7f4c2a
+tmpname = "/tmp/glusterfs-libs_pretrans_" .. os.date("%s")
7f4c2a
+tmpfile = io.open(tmpname, "w")
7f4c2a
+tmpfile:write(script)
7f4c2a
+tmpfile:close()
7f4c2a
+ok, how, val = os.execute("/bin/bash " .. tmpname)
7f4c2a
+os.remove(tmpname)
7f4c2a
+if not (ok == 0) then
7f4c2a
+   error("Detected running glusterfs processes", ok)
7f4c2a
+end
7f4c2a
+
7f4c2a
+
7f4c2a
+
7f4c2a
+%if ( 0%{!?_without_rdma:1} )
7f4c2a
+%pretrans rdma -p <lua>
7f4c2a
+if not posix.access("/bin/bash", "x") then
7f4c2a
+    -- initial installation, no shell, no running glusterfsd
7f4c2a
+    return 0
7f4c2a
+end
7f4c2a
+
7f4c2a
+-- TODO: move this completely to a lua script
7f4c2a
+-- For now, we write a temporary bash script and execute that.
7f4c2a
+
7f4c2a
+script = [[#!/bin/sh
7f4c2a
+pidof -c -o %PPID -x glusterfsd &>/dev/null
7f4c2a
+
7f4c2a
+if [ $? -eq 0 ]; then
7f4c2a
+   pushd . > /dev/null 2>&1
7f4c2a
+   for volume in /var/lib/glusterd/vols/*; do cd $volume;
7f4c2a
+       vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
7f4c2a
+       volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
7f4c2a
+       if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
7f4c2a
+          exit 1;
7f4c2a
+       fi
7f4c2a
+   done
7f4c2a
+
7f4c2a
+   popd > /dev/null 2>&1
7f4c2a
+   exit 1;
7f4c2a
+fi
7f4c2a
+]]
7f4c2a
+
7f4c2a
+-- rpm in RHEL5 does not have os.tmpname()
7f4c2a
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
7f4c2a
+tmpname = "/tmp/glusterfs-rdma_pretrans_" .. os.date("%s")
7f4c2a
+tmpfile = io.open(tmpname, "w")
7f4c2a
+tmpfile:write(script)
7f4c2a
+tmpfile:close()
7f4c2a
+ok, how, val = os.execute("/bin/bash " .. tmpname)
7f4c2a
+os.remove(tmpname)
7f4c2a
+if not (ok == 0) then
7f4c2a
+   error("Detected running glusterfs processes", ok)
7f4c2a
+end
7f4c2a
+%endif
7f4c2a
+
7f4c2a
+
7f4c2a
+
7f4c2a
+%if ( 0%{!?_without_ocf:1} )
7f4c2a
+%pretrans resource-agents -p <lua>
7f4c2a
+if not posix.access("/bin/bash", "x") then
7f4c2a
+    -- initial installation, no shell, no running glusterfsd
7f4c2a
+    return 0
7f4c2a
+end
7f4c2a
+
7f4c2a
+-- TODO: move this completely to a lua script
7f4c2a
+-- For now, we write a temporary bash script and execute that.
7f4c2a
+
7f4c2a
+script = [[#!/bin/sh
7f4c2a
+pidof -c -o %PPID -x glusterfsd &>/dev/null
7f4c2a
+
7f4c2a
+if [ $? -eq 0 ]; then
7f4c2a
+   pushd . > /dev/null 2>&1
7f4c2a
+   for volume in /var/lib/glusterd/vols/*; do cd $volume;
7f4c2a
+       vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
7f4c2a
+       volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
7f4c2a
+       if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
7f4c2a
+          exit 1;
7f4c2a
+       fi
7f4c2a
+   done
7f4c2a
+
7f4c2a
+   popd > /dev/null 2>&1
7f4c2a
+   exit 1;
7f4c2a
+fi
7f4c2a
+]]
7f4c2a
+
7f4c2a
+-- rpm in RHEL5 does not have os.tmpname()
7f4c2a
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
7f4c2a
+tmpname = "/tmp/glusterfs-resource-agents_pretrans_" .. os.date("%s")
7f4c2a
+tmpfile = io.open(tmpname, "w")
7f4c2a
+tmpfile:write(script)
7f4c2a
+tmpfile:close()
7f4c2a
+ok, how, val = os.execute("/bin/bash " .. tmpname)
7f4c2a
+os.remove(tmpname)
7f4c2a
+if not (ok == 0) then
7f4c2a
+   error("Detected running glusterfs processes", ok)
7f4c2a
+end
7f4c2a
+%endif
7f4c2a
+
7f4c2a
+
7f4c2a
+
7f4c2a
+%pretrans server -p <lua>
7f4c2a
+if not posix.access("/bin/bash", "x") then
7f4c2a
+    -- initial installation, no shell, no running glusterfsd
7f4c2a
+    return 0
7f4c2a
+end
7f4c2a
+
7f4c2a
+-- TODO: move this completely to a lua script
7f4c2a
+-- For now, we write a temporary bash script and execute that.
7f4c2a
+
7f4c2a
+script = [[#!/bin/sh
7f4c2a
+pidof -c -o %PPID -x glusterfsd &>/dev/null
7f4c2a
+
7f4c2a
+if [ $? -eq 0 ]; then
7f4c2a
+   pushd . > /dev/null 2>&1
7f4c2a
+   for volume in /var/lib/glusterd/vols/*; do cd $volume;
7f4c2a
+       vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
7f4c2a
+       volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
7f4c2a
+       if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
7f4c2a
+          exit 1;
7f4c2a
+       fi
7f4c2a
+   done
7f4c2a
+
7f4c2a
+   popd > /dev/null 2>&1
7f4c2a
+   exit 1;
7f4c2a
+fi
7f4c2a
+]]
7f4c2a
+
7f4c2a
+-- rpm in RHEL5 does not have os.tmpname()
7f4c2a
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
7f4c2a
+tmpname = "/tmp/glusterfs-server_pretrans_" .. os.date("%s")
7f4c2a
+tmpfile = io.open(tmpname, "w")
7f4c2a
+tmpfile:write(script)
7f4c2a
+tmpfile:close()
7f4c2a
+ok, how, val = os.execute("/bin/bash " .. tmpname)
7f4c2a
+os.remove(tmpname)
7f4c2a
+if not (ok == 0) then
7f4c2a
+   error("Detected running glusterfs processes", ok)
7f4c2a
+end
7f4c2a
+%endif
7f4c2a
 
7f4c2a
 %changelog
7f4c2a
 * Sun May 31 2015 Milind Changire <mchangir@redhat.com>
7f4c2a
-- 
7f4c2a
1.9.3
7f4c2a