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:56 UTC

git commit: updated refs/heads/4.5 to c15ed74

Repository: cloudstack
Updated Branches:
  refs/heads/4.5 a43fba64d -> c15ed74f6


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/c15ed74f
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/c15ed74f
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/c15ed74f

Branch: refs/heads/4.5
Commit: c15ed74f63559dca7692cfcfe695e195c3401454
Parents: a43fba6
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:41:46 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/c15ed74f/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