You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ya...@apache.org on 2014/11/05 01:41:30 UTC

git commit: updated refs/heads/master to 4b3217f

Repository: cloudstack
Updated Branches:
  refs/heads/master 683965210 -> 4b3217fe5


CLOUDSTACK-7841: Gracefully reload haproxy config

The old way would disconnect all the existing connections through haproxy when
reload the config.

This new way would ensure that all the existing connections would still alive
after reload the config.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/4b3217fe
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/4b3217fe
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/4b3217fe

Branch: refs/heads/master
Commit: 4b3217fe57f2aa4f7e6b967588158c26a7a9634a
Parents: 6839652
Author: Sheng Yang <sh...@citrix.com>
Authored: Tue Nov 4 16:26:23 2014 -0800
Committer: Sheng Yang <sh...@citrix.com>
Committed: Tue Nov 4 16:40:47 2014 -0800

----------------------------------------------------------------------
 systemvm/patches/debian/config/root/reconfigLB.sh | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4b3217fe/systemvm/patches/debian/config/root/reconfigLB.sh
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/root/reconfigLB.sh b/systemvm/patches/debian/config/root/reconfigLB.sh
index 70a2912..e68cc3d 100755
--- a/systemvm/patches/debian/config/root/reconfigLB.sh
+++ b/systemvm/patches/debian/config/root/reconfigLB.sh
@@ -23,23 +23,16 @@ new_config=$1
 
 # save previous state
   mv /etc/haproxy/haproxy.cfg /etc/haproxy/haproxy.cfg.old
-  mv /var/run/haproxy.pid /var/run/haproxy.pid.old
 
   mv $new_config /etc/haproxy/haproxy.cfg
-  kill -TTOU $(cat /var/run/haproxy.pid.old)
-  sleep 2
-  if haproxy -D -p /var/run/haproxy.pid -f /etc/haproxy/haproxy.cfg; then
+  if haproxy -p /var/run/haproxy.pid -f /etc/haproxy/haproxy.cfg -sf $(cat /var/run/haproxy.pid); then
     logger -t cloud "New haproxy instance successfully loaded, stopping previous one."
-    kill -KILL $(cat /var/run/haproxy.pid.old)
-    rm -f /var/run/haproxy.pid.old
     ret=0
   else
     logger -t cloud "New instance failed to start, resuming previous one."
-    kill -TTIN $(cat /var/run/haproxy.pid.old)
-    rm -f /var/run/haproxy.pid
-    mv /var/run/haproxy.pid.old /var/run/haproxy.pid
     mv /etc/haproxy/haproxy.cfg $new_config
     mv /etc/haproxy/haproxy.cfg.old /etc/haproxy/haproxy.cfg
+    haproxy -p /var/run/haproxy.pid -f /etc/haproxy/haproxy.cfg -sf $(cat /var/run/haproxy.pid)
     ret=1
   fi