d1681e
From cac41ae2729cffa23a348c4de14486043ef08163 Mon Sep 17 00:00:00 2001
d1681e
From: "Bala.FA" <barumuga@redhat.com>
d1681e
Date: Sat, 11 Nov 2017 10:32:42 +0530
d1681e
Subject: [PATCH 08/74] build: add RHGS specific changes
cb8e9e
cb8e9e
Label: DOWNSTREAM ONLY
cb8e9e
cb8e9e
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1074947
cb8e9e
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1097782
cb8e9e
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1115267
cb8e9e
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1221743
cb8e9e
Change-Id: I08333334745adf2350e772c6454ffcfe9c08cb89
cb8e9e
Reviewed-on: https://code.engineering.redhat.com/gerrit/24983
cb8e9e
Reviewed-on: https://code.engineering.redhat.com/gerrit/25451
cb8e9e
Reviewed-on: https://code.engineering.redhat.com/gerrit/25518
cb8e9e
Reviewed-on: https://code.engineering.redhat.com/gerrit/25983
cb8e9e
Signed-off-by: Bala.FA <barumuga@redhat.com>
12a457
Reviewed-on: https://code.engineering.redhat.com/gerrit/60134
12a457
Tested-by: Milind Changire <mchangir@redhat.com>
cb8e9e
---
d1681e
 glusterfs.spec.in | 605 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
d1681e
 1 file changed, 597 insertions(+), 8 deletions(-)
cb8e9e
cb8e9e
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
d1681e
index 3be99b6..8458e8a 100644
cb8e9e
--- a/glusterfs.spec.in
cb8e9e
+++ b/glusterfs.spec.in
d1681e
@@ -80,6 +80,23 @@
12a457
 %global _without_tiering --disable-tiering
cb8e9e
 %endif
cb8e9e
 
cb8e9e
+# if you wish not to build server rpms, compile like this.
cb8e9e
+# rpmbuild -ta @PACKAGE_NAME@-@PACKAGE_VERSION@.tar.gz --without server
cb8e9e
+
cb8e9e
+%global _build_server 1
cb8e9e
+%if "%{?_without_server}"
cb8e9e
+%global _build_server 0
cb8e9e
+%endif
cb8e9e
+
cb8e9e
+%if ( "%{?dist}" == ".el6rhs" ) || ( "%{?dist}" == ".el7rhs" ) || ( "%{?dist}" == ".el7rhgs" )
cb8e9e
+%global _build_server 1
cb8e9e
+%else
cb8e9e
+%global _build_server 0
cb8e9e
+%endif
cb8e9e
+
cb8e9e
+%global _without_extra_xlators 1
cb8e9e
+%global _without_regression_tests 1
cb8e9e
+
cb8e9e
 ##-----------------------------------------------------------------------------
12a457
 ## All %%global definitions should be placed here and keep them sorted
cb8e9e
 ##
d1681e
@@ -178,7 +195,8 @@ Release:          0.1%{?prereltag:.%{prereltag}}%{?dist}
cb8e9e
 %else
cb8e9e
 Name:             @PACKAGE_NAME@
cb8e9e
 Version:          @PACKAGE_VERSION@
cb8e9e
-Release:          0.@PACKAGE_RELEASE@%{?dist}
cb8e9e
+Release:          @PACKAGE_RELEASE@%{?dist}
cb8e9e
+ExclusiveArch:    x86_64 aarch64
cb8e9e
 %endif
cb8e9e
 License:          GPLv2 or LGPLv3+
cb8e9e
 Group:            System Environment/Base
d1681e
@@ -320,7 +338,9 @@ Summary:          Development Libraries
cb8e9e
 Group:            Development/Libraries
12a457
 Requires:         %{name}%{?_isa} = %{version}-%{release}
cb8e9e
 # Needed for the Glupy examples to work
12a457
-Requires:         %{name}-extra-xlators%{?_isa} = %{version}-%{release}
cb8e9e
+%if ( 0%{!?_without_extra_xlators:1} )
12a457
+Requires:         %{name}-extra-xlators = %{version}-%{release}
cb8e9e
+%endif
cb8e9e
 
cb8e9e
 %description devel
cb8e9e
 GlusterFS is a distributed file-system capable of scaling to several
d1681e
@@ -333,6 +353,7 @@ is in user space and easily manageable.
cb8e9e
 
cb8e9e
 This package provides the development libraries and include files.
cb8e9e
 
cb8e9e
+%if ( 0%{!?_without_extra_xlators:1} )
cb8e9e
 %package extra-xlators
cb8e9e
 Summary:          Extra Gluster filesystem Translators
cb8e9e
 Group:            Applications/File
d1681e
@@ -355,6 +376,7 @@ is in user space and easily manageable.
cb8e9e
 
cb8e9e
 This package provides extra filesystem Translators, such as Glupy,
cb8e9e
 for GlusterFS.
cb8e9e
+%endif
cb8e9e
 
cb8e9e
 %package fuse
cb8e9e
 Summary:          Fuse client
d1681e
@@ -381,6 +403,31 @@ is in user space and easily manageable.
cb8e9e
 This package provides support to FUSE based clients and inlcudes the
cb8e9e
 glusterfs(d) binary.
cb8e9e
 
cb8e9e
+%if ( 0%{?_build_server} )
d1681e
+%package ganesha
d1681e
+Summary:          NFS-Ganesha configuration
d1681e
+Group:            Applications/File
d1681e
+
d1681e
+Requires:         %{name}-server%{?_isa} = %{version}-%{release}
d1681e
+Requires:         nfs-ganesha-gluster, pcs, dbus
d1681e
+%if ( 0%{?rhel} && 0%{?rhel} == 6 )
d1681e
+Requires:         cman, pacemaker, corosync
cb8e9e
+%endif
d1681e
+
d1681e
+%description ganesha
d1681e
+GlusterFS is a distributed file-system capable of scaling to several
d1681e
+petabytes. It aggregates various storage bricks over Infiniband RDMA
d1681e
+or TCP/IP interconnect into one large parallel network file
d1681e
+system. GlusterFS is one of the most sophisticated file systems in
d1681e
+terms of features and extensibility.  It borrows a powerful concept
d1681e
+called Translators from GNU Hurd kernel. Much of the code in GlusterFS
d1681e
+is in user space and easily manageable.
d1681e
+
d1681e
+This package provides the configuration and related files for using
d1681e
+NFS-Ganesha as the NFS server using GlusterFS
d1681e
+%endif
d1681e
+
cb8e9e
+%if ( 0%{?_build_server} )
cb8e9e
 %if ( 0%{!?_without_georeplication:1} )
cb8e9e
 %package geo-replication
cb8e9e
 Summary:          GlusterFS Geo-replication
d1681e
@@ -406,6 +453,7 @@ is in userspace and easily manageable.
cb8e9e
 
cb8e9e
 This package provides support to geo-replication.
cb8e9e
 %endif
cb8e9e
+%endif
cb8e9e
 
d1681e
 %if ( 0%{?_with_gnfs:1} )
d1681e
 %package gnfs
d1681e
@@ -498,6 +546,8 @@ is in user space and easily manageable.
cb8e9e
 This package provides support to ib-verbs library.
cb8e9e
 %endif
cb8e9e
 
cb8e9e
+%if ( 0%{?_build_server} )
cb8e9e
+%if ( 0%{!?_without_regression_tests:1} )
cb8e9e
 %package regression-tests
cb8e9e
 Summary:          Development Tools
cb8e9e
 Group:            Development/Tools
d1681e
@@ -513,7 +563,10 @@ Requires:         nfs-utils xfsprogs yajl psmisc bc
cb8e9e
 %description regression-tests
cb8e9e
 The Gluster Test Framework, is a suite of scripts used for
cb8e9e
 regression testing of Gluster.
cb8e9e
+%endif
cb8e9e
+%endif
cb8e9e
 
cb8e9e
+%if ( 0%{?_build_server} )
cb8e9e
 %if ( 0%{!?_without_ocf:1} )
cb8e9e
 %package resource-agents
cb8e9e
 Summary:          OCF Resource Agents for GlusterFS
d1681e
@@ -546,7 +599,9 @@ This package provides the resource agents which plug glusterd into
cb8e9e
 Open Cluster Framework (OCF) compliant cluster resource managers,
cb8e9e
 like Pacemaker.
cb8e9e
 %endif
cb8e9e
+%endif
cb8e9e
 
cb8e9e
+%if ( 0%{?_build_server} )
cb8e9e
 %package server
cb8e9e
 Summary:          Clustered file-system server
cb8e9e
 Group:            System Environment/Daemons
d1681e
@@ -602,6 +657,7 @@ called Translators from GNU Hurd kernel. Much of the code in GlusterFS
cb8e9e
 is in user space and easily manageable.
cb8e9e
 
cb8e9e
 This package provides the glusterfs server daemon.
cb8e9e
+%endif
cb8e9e
 
cb8e9e
 %package client-xlators
cb8e9e
 Summary:          GlusterFS client-side translators
d1681e
@@ -618,6 +674,7 @@ is in user space and easily manageable.
d1681e
 
d1681e
 This package provides the translators needed on any GlusterFS client.
d1681e
 
d1681e
+%if ( 0%{?_build_server} )
d1681e
 %if ( 0%{!?_without_events:1} )
d1681e
 %package events
d1681e
 Summary:          GlusterFS Events
d1681e
@@ -641,6 +698,7 @@ Requires:         python-argparse
d1681e
 GlusterFS Events
d1681e
 
d1681e
 %endif
d1681e
+%endif
d1681e
 
d1681e
 %prep
d1681e
 %setup -q -n %{name}-%{version}%{?prereltag}
d1681e
@@ -822,10 +880,12 @@ exit 0
d1681e
 %post api
d1681e
 /sbin/ldconfig
d1681e
 
d1681e
+%if ( 0%{?_build_server} )
d1681e
 %if ( 0%{!?_without_events:1} )
d1681e
 %post events
d1681e
 %_init_restart glustereventsd
d1681e
 %endif
d1681e
+%endif
d1681e
 
d1681e
 %if ( 0%{?rhel} == 5 )
d1681e
 %post fuse
d1681e
@@ -833,6 +893,7 @@ modprobe fuse
12a457
 exit 0
cb8e9e
 %endif
cb8e9e
 
cb8e9e
+%if ( 0%{?_build_server} )
cb8e9e
 %if ( 0%{!?_without_georeplication:1} )
cb8e9e
 %post geo-replication
12a457
 if [ $1 -ge 1 ]; then
d1681e
@@ -840,10 +901,12 @@ if [ $1 -ge 1 ]; then
cb8e9e
 fi
12a457
 exit 0
cb8e9e
 %endif
cb8e9e
+%endif
cb8e9e
 
3604df
 %post libs
3604df
 /sbin/ldconfig
cb8e9e
 
cb8e9e
+%if ( 0%{?_build_server} )
cb8e9e
 %post server
cb8e9e
 # Legacy server
cb8e9e
 %_init_enable glusterd
d1681e
@@ -914,7 +977,7 @@ else
cb8e9e
     #rpm_script_t context.
d1681e
     rm -f %{_rundir}/glusterd.socket
cb8e9e
 fi
12a457
-exit 0
cb8e9e
+%endif
cb8e9e
 
cb8e9e
 ##-----------------------------------------------------------------------------
d1681e
 ## All %%pre should be placed here and keep them sorted
d1681e
@@ -928,6 +991,7 @@ exit 0
d1681e
 ##-----------------------------------------------------------------------------
12a457
 ## All %%preun should be placed here and keep them sorted
cb8e9e
 ##
cb8e9e
+%if ( 0%{?_build_server} )
d1681e
 %if ( 0%{!?_without_events:1} )
d1681e
 %preun events
cb8e9e
 if [ $1 -eq 0 ]; then
d1681e
@@ -956,7 +1020,7 @@ if [ $1 -ge 1 ]; then
cb8e9e
     fi
cb8e9e
     %_init_restart glusterd
cb8e9e
 fi
12a457
-exit 0
cb8e9e
+%endif
cb8e9e
 
cb8e9e
 ##-----------------------------------------------------------------------------
12a457
 ## All %%postun should be placed here and keep them sorted
d1681e
@@ -986,6 +1050,73 @@ exit 0
12a457
 ## All %%files should be placed here and keep them grouped
cb8e9e
 ##
cb8e9e
 %files
cb8e9e
+# exclude extra-xlators files
cb8e9e
+%if ( ! 0%{!?_without_extra_xlators:1} )
cb8e9e
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/encryption/rot-13.so
cb8e9e
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/glupy.so
cb8e9e
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/quiesce.so
d1681e
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/selinux.so
cb8e9e
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/testing/features/template.so
cb8e9e
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/testing/performance/symlink-cache.so
cb8e9e
+%exclude %{python_sitelib}/*
cb8e9e
+%endif
cb8e9e
+# exclude regression-tests files
cb8e9e
+%if ( ! 0%{!?_without_regression_tests:1} )
cb8e9e
+%exclude %{_prefix}/share/glusterfs/run-tests.sh
cb8e9e
+%exclude %{_prefix}/share/glusterfs/tests/*
cb8e9e
+%endif
cb8e9e
+%if ( ! 0%{?_build_server} )
cb8e9e
+# exclude ganesha files
cb8e9e
+%exclude %{_prefix}/lib/ocf/*
cb8e9e
+# exclude geo-replication files
cb8e9e
+%exclude %{_sysconfdir}/logrotate.d/glusterfs-georep
cb8e9e
+%exclude %{_libexecdir}/glusterfs/*
cb8e9e
+%exclude %{_sbindir}/gfind_missing_files
cb8e9e
+%exclude %{_datadir}/glusterfs/scripts/get-gfid.sh
cb8e9e
+%exclude %{_datadir}/glusterfs/scripts/slave-upgrade.sh
cb8e9e
+%exclude %{_datadir}/glusterfs/scripts/gsync-upgrade.sh
cb8e9e
+%exclude %{_datadir}/glusterfs/scripts/generate-gfid-file.sh
cb8e9e
+%exclude %{_datadir}/glusterfs/scripts/gsync-sync-gfid
cb8e9e
+%exclude %{_sharedstatedir}/glusterd/*
cb8e9e
+# exclude server files
cb8e9e
+%exclude %{_sysconfdir}/glusterfs
cb8e9e
+%exclude %{_sysconfdir}/glusterfs/glusterd.vol
cb8e9e
+%exclude %{_sysconfdir}/glusterfs/glusterfs-georep-logrotate
cb8e9e
+%exclude %{_sysconfdir}/glusterfs/glusterfs-logrotate
cb8e9e
+%exclude %{_sysconfdir}/glusterfs/gluster-rsyslog-5.8.conf
cb8e9e
+%exclude %{_sysconfdir}/glusterfs/gluster-rsyslog-7.2.conf
cb8e9e
+%exclude %{_sysconfdir}/glusterfs/group-virt.example
cb8e9e
+%exclude %{_sysconfdir}/glusterfs/logger.conf.example
cb8e9e
+%exclude %_init_glusterd
cb8e9e
+%exclude %{_sysconfdir}/sysconfig/glusterd
cb8e9e
+%exclude %{_bindir}/glusterfind
cb8e9e
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/arbiter.so
cb8e9e
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/bit-rot.so
cb8e9e
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/bitrot-stub.so
cb8e9e
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/changetimerecorder.so
cb8e9e
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/index.so
3604df
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/leases.so
cb8e9e
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/locks.so
cb8e9e
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/posix*
cb8e9e
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/snapview-server.so
cb8e9e
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/marker.so
cb8e9e
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/quota*
cb8e9e
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/trash.so
cb8e9e
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/upcall.so
cb8e9e
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/mgmt*
3604df
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/performance/decompounder.so
cb8e9e
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/protocol/server*
cb8e9e
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/storage*
cb8e9e
+%exclude %{_libdir}/libgfdb.so.*
cb8e9e
+%exclude %{_sbindir}/gcron.py
cb8e9e
+%exclude %{_sbindir}/glfsheal
cb8e9e
+%exclude %{_sbindir}/glusterd
cb8e9e
+%exclude %{_sbindir}/snap_scheduler.py
cb8e9e
+%exclude %{_datadir}/glusterfs/scripts/stop-all-gluster-processes.sh
cb8e9e
+%if 0%{?_tmpfilesdir:1}
cb8e9e
+%exclude %{_tmpfilesdir}/gluster.conf
cb8e9e
+%endif
cb8e9e
+%endif
cb8e9e
 %doc ChangeLog COPYING-GPLV2 COPYING-LGPLV3 INSTALL README.md THANKS
12a457
 %{_mandir}/man8/*gluster*.8*
12a457
 %exclude %{_mandir}/man8/gluster.8*
d1681e
@@ -1044,6 +1175,11 @@ exit 0
d1681e
 %if 0%{?_tmpfilesdir:1}
d1681e
 %{_tmpfilesdir}/gluster.conf
d1681e
 %endif
d1681e
+%if ( ! 0%{?_build_server} )
d1681e
+%{_libdir}/pkgconfig/libgfchangelog.pc
d1681e
+%{_libdir}/pkgconfig/libgfdb.pc
d1681e
+%{_sbindir}/gluster-setgfid2path
d1681e
+%endif
d1681e
 
d1681e
 %files api
d1681e
 %exclude %{_libdir}/*.so
d1681e
@@ -1078,9 +1214,11 @@ exit 0
d1681e
      %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/glupy/debug-trace.*
d1681e
      %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/glupy/helloworld.*
d1681e
      %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/glupy/negative.*
d1681e
-%{_libdir}/pkgconfig/libgfchangelog.pc
d1681e
-%if ( 0%{!?_without_tiering:1} )
d1681e
-%{_libdir}/pkgconfig/libgfdb.pc
d1681e
+%if ( 0%{?_build_server} )
d1681e
+%exclude %{_libdir}/pkgconfig/libgfchangelog.pc
d1681e
+%exclude %{_libdir}/pkgconfig/libgfdb.pc
d1681e
+%exclude %{_sbindir}/gluster-setgfid2path
d1681e
+%exclude %{_mandir}/man8/gluster-setgfid2path.8*
d1681e
 %endif
d1681e
 
d1681e
 %files client-xlators
d1681e
@@ -1090,6 +1228,7 @@ exit 0
d1681e
 %dir %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/protocol
d1681e
      %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/protocol/client.so
cb8e9e
 
12a457
++%if ( 0%{!?_without_extra_xlators:1} )
cb8e9e
 %files extra-xlators
d1681e
 %dir %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator
d1681e
 %dir %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/encryption
d1681e
@@ -1106,6 +1245,11 @@ exit 0
d1681e
 %dir %{python2_sitelib}/gluster
d1681e
 %dir %{python2_sitelib}/gluster/glupy
d1681e
      %{python2_sitelib}/gluster/glupy/*
3604df
+# Don't expect a .egg-info file on EL5
3604df
+%if ( ! ( 0%{?rhel} && 0%{?rhel} < 6 ) )
3604df
+%{python_sitelib}/glusterfs_glupy*.egg-info
3604df
+%endif
cb8e9e
+%endif
cb8e9e
 
cb8e9e
 %files fuse
cb8e9e
 # glusterfs is a symlink to glusterfsd, -server depends on -fuse.
d1681e
@@ -1125,6 +1269,7 @@ exit 0
cb8e9e
 %endif
cb8e9e
 %endif
cb8e9e
 
cb8e9e
+%if ( 0%{?_build_server} )
d1681e
 %if ( 0%{?_with_gnfs:1} )
d1681e
 %files gnfs
d1681e
 %dir %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator
d1681e
@@ -1135,7 +1280,13 @@ exit 0
d1681e
 %ghost %dir %attr(0755,-,-) %{_sharedstatedir}/glusterd/nfs/run
d1681e
 %ghost      %attr(0600,-,-) %{_sharedstatedir}/glusterd/nfs/run/nfs.pid
d1681e
 %endif
d1681e
+%endif
d1681e
+
d1681e
+%if ( 0%{?_build_server} )
d1681e
+%files ganesha
cb8e9e
+%endif
cb8e9e
 
cb8e9e
+%if ( 0%{?_build_server} )
cb8e9e
 %if ( 0%{!?_without_georeplication:1} )
cb8e9e
 %files geo-replication
cb8e9e
 %config(noreplace) %{_sysconfdir}/logrotate.d/glusterfs-georep
d1681e
@@ -1172,6 +1323,7 @@ exit 0
d1681e
      %{_datadir}/glusterfs/scripts/gsync-sync-gfid
d1681e
      %{_datadir}/glusterfs/scripts/schedule_georep.py*
cb8e9e
 %endif
cb8e9e
+%endif
cb8e9e
 
cb8e9e
 %files libs
cb8e9e
 %{_libdir}/*.so.*
d1681e
@@ -1194,19 +1346,26 @@ exit 0
d1681e
      %{_libdir}/glusterfs/%{version}%{?prereltag}/rpc-transport/rdma*
cb8e9e
 %endif
cb8e9e
 
cb8e9e
+%if ( 0%{?_build_server} )
cb8e9e
 %files regression-tests
d1681e
 %dir %{_datadir}/glusterfs
d1681e
      %{_datadir}/glusterfs/run-tests.sh
d1681e
      %{_datadir}/glusterfs/tests
d1681e
 %exclude %{_datadir}/glusterfs/tests/vagrant
d1681e
+%exclude %{_datadir}/share/glusterfs/tests/basic/rpm.t
cb8e9e
+%endif
cb8e9e
 
cb8e9e
+%if ( 0%{?_build_server} )
cb8e9e
 %if ( 0%{!?_without_ocf:1} )
cb8e9e
 %files resource-agents
cb8e9e
 # /usr/lib is the standard for OCF, also on x86_64
cb8e9e
 %{_prefix}/lib/ocf/resource.d/glusterfs
cb8e9e
 %endif
cb8e9e
+%endif
cb8e9e
 
cb8e9e
+%if ( 0%{?_build_server} )
cb8e9e
 %files server
cb8e9e
+%exclude %{_sharedstatedir}/glusterd/hooks/1/gsync-create/post/S56glusterd-geo-rep-create-post.sh
cb8e9e
 %doc extras/clear_xattrs.sh
3604df
 # sysconf
cb8e9e
 %config(noreplace) %{_sysconfdir}/glusterfs
d1681e
@@ -1277,7 +1436,6 @@ exit 0
3604df
 %{_sbindir}/gcron.py
d1681e
 %{_sbindir}/conf.py
3604df
 
3604df
-<<<<<<< 2944c7b6656a36a79551f9f9f24ab7a10467f13a
3604df
 # /var/lib/glusterd, e.g. hookscripts, etc.
3604df
 %ghost      %attr(0644,-,-) %config(noreplace) %{_sharedstatedir}/glusterd/glusterd.info
3604df
        %dir %attr(0755,-,-) %{_sharedstatedir}/glusterd
d1681e
@@ -1354,8 +1512,438 @@ exit 0
12a457
 %if ( 0%{?_with_firewalld:1} )
3604df
 %{_prefix}/lib/firewalld/services/glusterfs.xml
12a457
 %endif
cb8e9e
+%endif
cb8e9e
+
cb8e9e
+
cb8e9e
+##-----------------------------------------------------------------------------
cb8e9e
+## All %pretrans should be placed here and keep them sorted
cb8e9e
+##
cb8e9e
+%if 0%{?_build_server}
cb8e9e
+%pretrans -p <lua>
cb8e9e
+if not posix.access("/bin/bash", "x") then
cb8e9e
+    -- initial installation, no shell, no running glusterfsd
cb8e9e
+    return 0
cb8e9e
+end
cb8e9e
+
cb8e9e
+-- TODO: move this completely to a lua script
cb8e9e
+-- For now, we write a temporary bash script and execute that.
cb8e9e
+
cb8e9e
+script = [[#!/bin/sh
cb8e9e
+pidof -c -o %PPID -x glusterfsd &>/dev/null
cb8e9e
+
cb8e9e
+if [ $? -eq 0 ]; then
cb8e9e
+   pushd . > /dev/null 2>&1
cb8e9e
+   for volume in /var/lib/glusterd/vols/*; do cd $volume;
cb8e9e
+       vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
cb8e9e
+       volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
cb8e9e
+       if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
cb8e9e
+          echo "ERROR: Distribute volumes detected. In-service rolling upgrade requires distribute volume(s) to be stopped."
cb8e9e
+          echo "ERROR: Please stop distribute volume(s) before proceeding... exiting!"
cb8e9e
+          exit 1;
cb8e9e
+       fi
cb8e9e
+   done
cb8e9e
+
cb8e9e
+   popd > /dev/null 2>&1
cb8e9e
+   echo "WARNING: Updating glusterfs requires its processes to be killed. This action does NOT incur downtime."
cb8e9e
+   echo "WARNING: Ensure to wait for the upgraded server to finish healing before proceeding."
cb8e9e
+   echo "WARNING: Refer upgrade section of install guide for more details"
cb8e9e
+   echo "Please run # service glusterd stop; pkill glusterfs; pkill glusterfsd; pkill gsyncd.py;"
cb8e9e
+   exit 1;
cb8e9e
+fi
cb8e9e
+]]
cb8e9e
+
cb8e9e
+-- rpm in RHEL5 does not have os.tmpname()
cb8e9e
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
cb8e9e
+tmpname = "/tmp/glusterfs_pretrans_" .. os.date("%s")
cb8e9e
+tmpfile = io.open(tmpname, "w")
cb8e9e
+tmpfile:write(script)
cb8e9e
+tmpfile:close()
cb8e9e
+ok, how, val = os.execute("/bin/bash " .. tmpname)
cb8e9e
+os.remove(tmpname)
cb8e9e
+if not (ok == 0) then
cb8e9e
+   error("Detected running glusterfs processes", ok)
cb8e9e
+end
cb8e9e
+
cb8e9e
+
cb8e9e
+
cb8e9e
+%pretrans api -p <lua>
cb8e9e
+if not posix.access("/bin/bash", "x") then
cb8e9e
+    -- initial installation, no shell, no running glusterfsd
cb8e9e
+    return 0
cb8e9e
+end
cb8e9e
+
cb8e9e
+-- TODO: move this completely to a lua script
cb8e9e
+-- For now, we write a temporary bash script and execute that.
cb8e9e
+
cb8e9e
+script = [[#!/bin/sh
cb8e9e
+pidof -c -o %PPID -x glusterfsd &>/dev/null
cb8e9e
+
cb8e9e
+if [ $? -eq 0 ]; then
cb8e9e
+   pushd . > /dev/null 2>&1
cb8e9e
+   for volume in /var/lib/glusterd/vols/*; do cd $volume;
cb8e9e
+       vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
cb8e9e
+       volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
cb8e9e
+       if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
cb8e9e
+          exit 1;
cb8e9e
+       fi
cb8e9e
+   done
cb8e9e
+
cb8e9e
+   popd > /dev/null 2>&1
cb8e9e
+   exit 1;
cb8e9e
+fi
cb8e9e
+]]
12a457
+
cb8e9e
+-- rpm in RHEL5 does not have os.tmpname()
cb8e9e
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
cb8e9e
+tmpname = "/tmp/glusterfs-api_pretrans_" .. os.date("%s")
cb8e9e
+tmpfile = io.open(tmpname, "w")
cb8e9e
+tmpfile:write(script)
cb8e9e
+tmpfile:close()
cb8e9e
+ok, how, val = os.execute("/bin/bash " .. tmpname)
cb8e9e
+os.remove(tmpname)
cb8e9e
+if not (ok == 0) then
cb8e9e
+   error("Detected running glusterfs processes", ok)
cb8e9e
+end
cb8e9e
+
cb8e9e
+
cb8e9e
+
cb8e9e
+%pretrans api-devel -p <lua>
cb8e9e
+if not posix.access("/bin/bash", "x") then
cb8e9e
+    -- initial installation, no shell, no running glusterfsd
cb8e9e
+    return 0
cb8e9e
+end
cb8e9e
+
cb8e9e
+-- TODO: move this completely to a lua script
cb8e9e
+-- For now, we write a temporary bash script and execute that.
cb8e9e
+
cb8e9e
+script = [[#!/bin/sh
cb8e9e
+pidof -c -o %PPID -x glusterfsd &>/dev/null
cb8e9e
+
cb8e9e
+if [ $? -eq 0 ]; then
cb8e9e
+   pushd . > /dev/null 2>&1
cb8e9e
+   for volume in /var/lib/glusterd/vols/*; do cd $volume;
cb8e9e
+       vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
cb8e9e
+       volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
cb8e9e
+       if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
cb8e9e
+          exit 1;
cb8e9e
+       fi
cb8e9e
+   done
cb8e9e
+
cb8e9e
+   popd > /dev/null 2>&1
cb8e9e
+   exit 1;
cb8e9e
+fi
cb8e9e
+]]
cb8e9e
+
cb8e9e
+-- rpm in RHEL5 does not have os.tmpname()
cb8e9e
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
cb8e9e
+tmpname = "/tmp/glusterfs-api-devel_pretrans_" .. os.date("%s")
cb8e9e
+tmpfile = io.open(tmpname, "w")
cb8e9e
+tmpfile:write(script)
cb8e9e
+tmpfile:close()
cb8e9e
+ok, how, val = os.execute("/bin/bash " .. tmpname)
cb8e9e
+os.remove(tmpname)
cb8e9e
+if not (ok == 0) then
cb8e9e
+   error("Detected running glusterfs processes", ok)
cb8e9e
+end
cb8e9e
+
cb8e9e
+
cb8e9e
+
cb8e9e
+%pretrans devel -p <lua>
cb8e9e
+if not posix.access("/bin/bash", "x") then
cb8e9e
+    -- initial installation, no shell, no running glusterfsd
cb8e9e
+    return 0
cb8e9e
+end
cb8e9e
+
cb8e9e
+-- TODO: move this completely to a lua script
cb8e9e
+-- For now, we write a temporary bash script and execute that.
cb8e9e
+
cb8e9e
+script = [[#!/bin/sh
cb8e9e
+pidof -c -o %PPID -x glusterfsd &>/dev/null
cb8e9e
+
cb8e9e
+if [ $? -eq 0 ]; then
cb8e9e
+   pushd . > /dev/null 2>&1
cb8e9e
+   for volume in /var/lib/glusterd/vols/*; do cd $volume;
cb8e9e
+       vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
cb8e9e
+       volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
cb8e9e
+       if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
cb8e9e
+          exit 1;
cb8e9e
+       fi
cb8e9e
+   done
cb8e9e
+
cb8e9e
+   popd > /dev/null 2>&1
cb8e9e
+   exit 1;
cb8e9e
+fi
cb8e9e
+]]
cb8e9e
+
cb8e9e
+-- rpm in RHEL5 does not have os.tmpname()
cb8e9e
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
cb8e9e
+tmpname = "/tmp/glusterfs-devel_pretrans_" .. os.date("%s")
cb8e9e
+tmpfile = io.open(tmpname, "w")
cb8e9e
+tmpfile:write(script)
cb8e9e
+tmpfile:close()
cb8e9e
+ok, how, val = os.execute("/bin/bash " .. tmpname)
cb8e9e
+os.remove(tmpname)
cb8e9e
+if not (ok == 0) then
cb8e9e
+   error("Detected running glusterfs processes", ok)
cb8e9e
+end
cb8e9e
+
cb8e9e
+
cb8e9e
+
cb8e9e
+%pretrans fuse -p <lua>
cb8e9e
+if not posix.access("/bin/bash", "x") then
cb8e9e
+    -- initial installation, no shell, no running glusterfsd
cb8e9e
+    return 0
cb8e9e
+end
cb8e9e
+
cb8e9e
+-- TODO: move this completely to a lua script
cb8e9e
+-- For now, we write a temporary bash script and execute that.
cb8e9e
+
cb8e9e
+script = [[#!/bin/sh
cb8e9e
+pidof -c -o %PPID -x glusterfsd &>/dev/null
cb8e9e
+
cb8e9e
+if [ $? -eq 0 ]; then
cb8e9e
+   pushd . > /dev/null 2>&1
cb8e9e
+   for volume in /var/lib/glusterd/vols/*; do cd $volume;
cb8e9e
+       vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
cb8e9e
+       volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
cb8e9e
+       if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
cb8e9e
+          exit 1;
cb8e9e
+       fi
cb8e9e
+   done
cb8e9e
+
cb8e9e
+   popd > /dev/null 2>&1
cb8e9e
+   exit 1;
cb8e9e
+fi
cb8e9e
+]]
cb8e9e
+
cb8e9e
+-- rpm in RHEL5 does not have os.tmpname()
cb8e9e
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
cb8e9e
+tmpname = "/tmp/glusterfs-fuse_pretrans_" .. os.date("%s")
cb8e9e
+tmpfile = io.open(tmpname, "w")
cb8e9e
+tmpfile:write(script)
cb8e9e
+tmpfile:close()
cb8e9e
+ok, how, val = os.execute("/bin/bash " .. tmpname)
cb8e9e
+os.remove(tmpname)
cb8e9e
+if not (ok == 0) then
cb8e9e
+   error("Detected running glusterfs processes", ok)
cb8e9e
+end
cb8e9e
+
cb8e9e
+
cb8e9e
+
cb8e9e
+%if 0%{?_can_georeplicate}
cb8e9e
+%if ( 0%{!?_without_georeplication:1} )
cb8e9e
+%pretrans geo-replication -p <lua>
cb8e9e
+if not posix.access("/bin/bash", "x") then
cb8e9e
+    -- initial installation, no shell, no running glusterfsd
cb8e9e
+    return 0
cb8e9e
+end
cb8e9e
+
cb8e9e
+-- TODO: move this completely to a lua script
cb8e9e
+-- For now, we write a temporary bash script and execute that.
cb8e9e
+
cb8e9e
+script = [[#!/bin/sh
cb8e9e
+pidof -c -o %PPID -x glusterfsd &>/dev/null
cb8e9e
+
cb8e9e
+if [ $? -eq 0 ]; then
cb8e9e
+   pushd . > /dev/null 2>&1
cb8e9e
+   for volume in /var/lib/glusterd/vols/*; do cd $volume;
cb8e9e
+       vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
cb8e9e
+       volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
cb8e9e
+       if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
cb8e9e
+          exit 1;
cb8e9e
+       fi
cb8e9e
+   done
cb8e9e
+
cb8e9e
+   popd > /dev/null 2>&1
cb8e9e
+   exit 1;
cb8e9e
+fi
cb8e9e
+]]
cb8e9e
+
cb8e9e
+-- rpm in RHEL5 does not have os.tmpname()
cb8e9e
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
cb8e9e
+tmpname = "/tmp/glusterfs-geo-replication_pretrans_" .. os.date("%s")
cb8e9e
+tmpfile = io.open(tmpname, "w")
cb8e9e
+tmpfile:write(script)
cb8e9e
+tmpfile:close()
cb8e9e
+ok, how, val = os.execute("/bin/bash " .. tmpname)
cb8e9e
+os.remove(tmpname)
cb8e9e
+if not (ok == 0) then
cb8e9e
+   error("Detected running glusterfs processes", ok)
cb8e9e
+end
cb8e9e
+%endif
cb8e9e
+%endif
cb8e9e
+
cb8e9e
+
cb8e9e
+
cb8e9e
+%pretrans libs -p <lua>
cb8e9e
+if not posix.access("/bin/bash", "x") then
cb8e9e
+    -- initial installation, no shell, no running glusterfsd
cb8e9e
+    return 0
cb8e9e
+end
cb8e9e
+
cb8e9e
+-- TODO: move this completely to a lua script
cb8e9e
+-- For now, we write a temporary bash script and execute that.
cb8e9e
+
cb8e9e
+script = [[#!/bin/sh
cb8e9e
+pidof -c -o %PPID -x glusterfsd &>/dev/null
cb8e9e
+
cb8e9e
+if [ $? -eq 0 ]; then
cb8e9e
+   pushd . > /dev/null 2>&1
cb8e9e
+   for volume in /var/lib/glusterd/vols/*; do cd $volume;
cb8e9e
+       vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
cb8e9e
+       volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
cb8e9e
+       if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
cb8e9e
+          exit 1;
cb8e9e
+       fi
cb8e9e
+   done
cb8e9e
+
cb8e9e
+   popd > /dev/null 2>&1
cb8e9e
+   exit 1;
cb8e9e
+fi
cb8e9e
+]]
cb8e9e
+
cb8e9e
+-- rpm in RHEL5 does not have os.tmpname()
cb8e9e
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
cb8e9e
+tmpname = "/tmp/glusterfs-libs_pretrans_" .. os.date("%s")
cb8e9e
+tmpfile = io.open(tmpname, "w")
cb8e9e
+tmpfile:write(script)
cb8e9e
+tmpfile:close()
cb8e9e
+ok, how, val = os.execute("/bin/bash " .. tmpname)
cb8e9e
+os.remove(tmpname)
cb8e9e
+if not (ok == 0) then
cb8e9e
+   error("Detected running glusterfs processes", ok)
cb8e9e
+end
cb8e9e
+
cb8e9e
+
cb8e9e
+
cb8e9e
+%if ( 0%{!?_without_rdma:1} )
cb8e9e
+%pretrans rdma -p <lua>
cb8e9e
+if not posix.access("/bin/bash", "x") then
cb8e9e
+    -- initial installation, no shell, no running glusterfsd
cb8e9e
+    return 0
cb8e9e
+end
cb8e9e
+
cb8e9e
+-- TODO: move this completely to a lua script
cb8e9e
+-- For now, we write a temporary bash script and execute that.
cb8e9e
+
cb8e9e
+script = [[#!/bin/sh
cb8e9e
+pidof -c -o %PPID -x glusterfsd &>/dev/null
cb8e9e
+
cb8e9e
+if [ $? -eq 0 ]; then
cb8e9e
+   pushd . > /dev/null 2>&1
cb8e9e
+   for volume in /var/lib/glusterd/vols/*; do cd $volume;
cb8e9e
+       vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
cb8e9e
+       volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
cb8e9e
+       if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
cb8e9e
+          exit 1;
cb8e9e
+       fi
cb8e9e
+   done
cb8e9e
+
cb8e9e
+   popd > /dev/null 2>&1
cb8e9e
+   exit 1;
cb8e9e
+fi
cb8e9e
+]]
cb8e9e
+
cb8e9e
+-- rpm in RHEL5 does not have os.tmpname()
cb8e9e
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
cb8e9e
+tmpname = "/tmp/glusterfs-rdma_pretrans_" .. os.date("%s")
cb8e9e
+tmpfile = io.open(tmpname, "w")
cb8e9e
+tmpfile:write(script)
cb8e9e
+tmpfile:close()
cb8e9e
+ok, how, val = os.execute("/bin/bash " .. tmpname)
cb8e9e
+os.remove(tmpname)
cb8e9e
+if not (ok == 0) then
cb8e9e
+   error("Detected running glusterfs processes", ok)
cb8e9e
+end
cb8e9e
+%endif
cb8e9e
+
cb8e9e
+
cb8e9e
+
cb8e9e
+%if ( 0%{!?_without_ocf:1} )
cb8e9e
+%pretrans resource-agents -p <lua>
cb8e9e
+if not posix.access("/bin/bash", "x") then
cb8e9e
+    -- initial installation, no shell, no running glusterfsd
cb8e9e
+    return 0
cb8e9e
+end
cb8e9e
+
cb8e9e
+-- TODO: move this completely to a lua script
cb8e9e
+-- For now, we write a temporary bash script and execute that.
cb8e9e
+
cb8e9e
+script = [[#!/bin/sh
cb8e9e
+pidof -c -o %PPID -x glusterfsd &>/dev/null
cb8e9e
+
cb8e9e
+if [ $? -eq 0 ]; then
cb8e9e
+   pushd . > /dev/null 2>&1
cb8e9e
+   for volume in /var/lib/glusterd/vols/*; do cd $volume;
cb8e9e
+       vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
cb8e9e
+       volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
cb8e9e
+       if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
cb8e9e
+          exit 1;
cb8e9e
+       fi
cb8e9e
+   done
cb8e9e
+
cb8e9e
+   popd > /dev/null 2>&1
cb8e9e
+   exit 1;
cb8e9e
+fi
cb8e9e
+]]
cb8e9e
+
cb8e9e
+-- rpm in RHEL5 does not have os.tmpname()
cb8e9e
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
cb8e9e
+tmpname = "/tmp/glusterfs-resource-agents_pretrans_" .. os.date("%s")
cb8e9e
+tmpfile = io.open(tmpname, "w")
cb8e9e
+tmpfile:write(script)
cb8e9e
+tmpfile:close()
cb8e9e
+ok, how, val = os.execute("/bin/bash " .. tmpname)
cb8e9e
+os.remove(tmpname)
cb8e9e
+if not (ok == 0) then
cb8e9e
+   error("Detected running glusterfs processes", ok)
cb8e9e
+end
cb8e9e
+%endif
cb8e9e
+
cb8e9e
+
cb8e9e
+
cb8e9e
+%pretrans server -p <lua>
cb8e9e
+if not posix.access("/bin/bash", "x") then
cb8e9e
+    -- initial installation, no shell, no running glusterfsd
cb8e9e
+    return 0
cb8e9e
+end
cb8e9e
+
cb8e9e
+-- TODO: move this completely to a lua script
cb8e9e
+-- For now, we write a temporary bash script and execute that.
cb8e9e
+
cb8e9e
+script = [[#!/bin/sh
cb8e9e
+pidof -c -o %PPID -x glusterfsd &>/dev/null
cb8e9e
+
cb8e9e
+if [ $? -eq 0 ]; then
cb8e9e
+   pushd . > /dev/null 2>&1
cb8e9e
+   for volume in /var/lib/glusterd/vols/*; do cd $volume;
cb8e9e
+       vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
cb8e9e
+       volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
cb8e9e
+       if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
cb8e9e
+          exit 1;
cb8e9e
+       fi
cb8e9e
+   done
cb8e9e
+
cb8e9e
+   popd > /dev/null 2>&1
cb8e9e
+   exit 1;
cb8e9e
+fi
cb8e9e
+]]
cb8e9e
+
cb8e9e
+-- rpm in RHEL5 does not have os.tmpname()
cb8e9e
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
cb8e9e
+tmpname = "/tmp/glusterfs-server_pretrans_" .. os.date("%s")
cb8e9e
+tmpfile = io.open(tmpname, "w")
cb8e9e
+tmpfile:write(script)
cb8e9e
+tmpfile:close()
cb8e9e
+ok, how, val = os.execute("/bin/bash " .. tmpname)
cb8e9e
+os.remove(tmpname)
cb8e9e
+if not (ok == 0) then
cb8e9e
+   error("Detected running glusterfs processes", ok)
cb8e9e
+end
cb8e9e
+%endif
cb8e9e
 
d1681e
 # Events
d1681e
+%if ( 0%{?_build_server} )
d1681e
 %if ( 0%{!?_without_events:1} )
d1681e
 %files events
d1681e
 %config(noreplace) %{_sysconfdir}/glusterfs/eventsconfig.json
d1681e
@@ -1373,6 +1961,7 @@ exit 0
d1681e
 %{_sysconfdir}/init.d/glustereventsd
d1681e
 %endif
d1681e
 %endif
d1681e
+%endif
d1681e
 
cb8e9e
 %changelog
d1681e
 * Tue Aug 22 2017 Kaleb S. KEITHLEY <kkeithle@redhat.com>
cb8e9e
-- 
d1681e
1.8.3.1
cb8e9e