e3c68b
From 8a3035bf612943694a3cd1c6a857bd009e84f55d Mon Sep 17 00:00:00 2001
e3c68b
From: Milind Changire <mchangir@redhat.com>
e3c68b
Date: Tue, 10 Oct 2017 09:58:24 +0530
e3c68b
Subject: [PATCH 19/52] build: launch glusterd upgrade after all new bits are
e3c68b
 installed
e3c68b
e3c68b
Problem:
e3c68b
glusterd upgrade mode needs new bits from glusterfs-rdma which
e3c68b
optional and causes the dependency graph to break since it is
e3c68b
not tied into glusterfs-server requirements
e3c68b
e3c68b
Solution:
e3c68b
Run glusterd upgrade mode after all new bits are installed
e3c68b
i.e. in %posttrans server section
e3c68b
e3c68b
Label: DOWNSTREAM ONLY
e3c68b
e3c68b
Change-Id: I356e02d0bf0eaaef43c20ce07b388262f63093a4
e3c68b
Signed-off-by: Milind Changire <mchangir@redhat.com>
e3c68b
Reviewed-on: https://code.engineering.redhat.com/gerrit/120094
e3c68b
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
e3c68b
Tested-by: RHGS Build Bot <nigelb@redhat.com>
e3c68b
Reviewed-by: Raghavendra Talur <rtalur@redhat.com>
e3c68b
---
e3c68b
 glusterfs.spec.in | 51 +++++++++++++++++++++++++++++----------------------
e3c68b
 1 file changed, 29 insertions(+), 22 deletions(-)
e3c68b
e3c68b
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
e3c68b
index 3a98822..208a82d 100644
e3c68b
--- a/glusterfs.spec.in
e3c68b
+++ b/glusterfs.spec.in
e3c68b
@@ -946,28 +946,6 @@ fi
e3c68b
     %firewalld_reload
e3c68b
 %endif
e3c68b
 
e3c68b
-pidof -c -o %PPID -x glusterd &> /dev/null
e3c68b
-if [ $? -eq 0 ]; then
e3c68b
-    kill -9 `pgrep -f gsyncd.py` &> /dev/null
e3c68b
-
e3c68b
-    killall --wait glusterd &> /dev/null
e3c68b
-    glusterd --xlator-option *.upgrade=on -N
e3c68b
-
e3c68b
-    #Cleaning leftover glusterd socket file which is created by glusterd in
e3c68b
-    #rpm_script_t context.
e3c68b
-    rm -f %{_rundir}/glusterd.socket
e3c68b
-
e3c68b
-    # glusterd _was_ running, we killed it, it exited after *.upgrade=on,
e3c68b
-    # so start it again
e3c68b
-    %service_start glusterd
e3c68b
-else
e3c68b
-    glusterd --xlator-option *.upgrade=on -N
e3c68b
-
e3c68b
-    #Cleaning leftover glusterd socket file which is created by glusterd in
e3c68b
-    #rpm_script_t context.
e3c68b
-    rm -f %{_rundir}/glusterd.socket
e3c68b
-fi
e3c68b
-exit 0
e3c68b
 %endif
e3c68b
 
e3c68b
 ##-----------------------------------------------------------------------------
e3c68b
@@ -2027,6 +2005,35 @@ os.remove(tmpname)
e3c68b
 if not (ok == 0) then
e3c68b
    error("Detected running glusterfs processes", ok)
e3c68b
 end
e3c68b
+
e3c68b
+%posttrans server
e3c68b
+pidof -c -o %PPID -x glusterd &> /dev/null
e3c68b
+if [ $? -eq 0 ]; then
e3c68b
+    kill -9 `pgrep -f gsyncd.py` &> /dev/null
e3c68b
+
e3c68b
+    killall --wait -SIGTERM glusterd &> /dev/null
e3c68b
+
e3c68b
+    if [ "$?" != "0" ]; then
e3c68b
+        echo "killall failed while killing glusterd"
e3c68b
+    fi
e3c68b
+
e3c68b
+    glusterd --xlator-option *.upgrade=on -N
e3c68b
+
e3c68b
+    #Cleaning leftover glusterd socket file which is created by glusterd in
e3c68b
+    #rpm_script_t context.
e3c68b
+    rm -rf /var/run/glusterd.socket
e3c68b
+
e3c68b
+    # glusterd _was_ running, we killed it, it exited after *.upgrade=on,
e3c68b
+    # so start it again
e3c68b
+    %service_start glusterd
e3c68b
+else
e3c68b
+    glusterd --xlator-option *.upgrade=on -N
e3c68b
+
e3c68b
+    #Cleaning leftover glusterd socket file which is created by glusterd in
e3c68b
+    #rpm_script_t context.
e3c68b
+    rm -rf /var/run/glusterd.socket
e3c68b
+fi
e3c68b
+
e3c68b
 %endif
e3c68b
 
e3c68b
 %changelog
e3c68b
-- 
e3c68b
1.8.3.1
e3c68b