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 2012/09/27 01:28:51 UTC

[1/2] git commit: CS-16400: Fix LB service using port 8080

Updated Branches:
  refs/heads/master f0e928461 -> 0c6dcb477


CS-16400: Fix LB service using port 8080

Also added license header for passwd_server_ip

Ported from:

commit 1072ec7ae36911ed794c182a1146025a0e969ea9
Author: Sheng Yang <sh...@citrix.com>
Date:   Wed Sep 12 11:15:33 2012 -0700

    CS-16318: Update the fix with some tweak

    1. The old fix run cloud-passwd-srvr twice because cloud-passwd-srvr is
still in the list of enabled_svcs

    2. The lock should be applied on serve_password.sh, which controlled the
accessing to the password. Applied on the MASTER/BACKUP switch is useless, two
instance of serve_password.sh would still able to access the password file at
the same time.

    3. Password service is a part of redundant router state transition process
now, so if the service failed to start, then the transition failed.

    4. Restart password service should be put before restart dnsmasq, which
would sent out DHCP offer to the user vms. If user VMs got the DHCP offer first
but failed to get password, there would be an issue.

    Reviewed-by: Anthony Xu

commit fa94da114099da357df7daa1aad3c327868393ca
Author: Jayapal Reddy <ja...@citrix.com>
Date:   Wed Sep 12 17:57:03 2012 +0530

    Bug:CS-16318 Starting password server on the both IPs in RRVM
    Reviewed-by: Abhi

Conflicts:

	patches/systemvm/debian/config/opt/cloud/bin/passwd_server


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

Branch: refs/heads/master
Commit: 435e4f6868c3ab3fc7701a61ec1302be0dcec8d8
Parents: f0e9284
Author: Sheng Yang <sh...@citrix.com>
Authored: Wed Sep 26 15:26:30 2012 -0700
Committer: Sheng Yang <sh...@citrix.com>
Committed: Wed Sep 26 16:28:33 2012 -0700

----------------------------------------------------------------------
 .../debian/config/etc/init.d/cloud-passwd-srvr     |    4 +-
 .../debian/config/opt/cloud/bin/passwd_server      |   20 ++-------
 .../debian/config/opt/cloud/bin/passwd_server_ip   |   32 +++++++++++++++
 .../debian/config/opt/cloud/bin/patchsystemvm.sh   |    9 ++--
 .../debian/config/opt/cloud/bin/serve_password.sh  |   11 +++++-
 .../config/root/redundant_router/disable_pubip.sh  |    1 +
 .../root/redundant_router/enable_pubip.sh.templ    |    1 +
 7 files changed, 56 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/435e4f68/patches/systemvm/debian/config/etc/init.d/cloud-passwd-srvr
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/etc/init.d/cloud-passwd-srvr b/patches/systemvm/debian/config/etc/init.d/cloud-passwd-srvr
index 553fe0a..e681841 100755
--- a/patches/systemvm/debian/config/etc/init.d/cloud-passwd-srvr
+++ b/patches/systemvm/debian/config/etc/init.d/cloud-passwd-srvr
@@ -33,11 +33,11 @@ start() {
   [ "$ENABLED" != 0 ]  || exit 0 
   pid=$(getpid)
   [ "$pid" != "" ] && echo "Password server is already running (pid=$pid)" && return 0
-  nohup bash /opt/cloud/bin/passwd_server&
+  nohup bash /opt/cloud/bin/passwd_server &
 }
 
 getpid() {
-  pid=$(ps -ef | grep passwd_server | grep -v grep | awk '{print $2}')
+  pid=$(ps -ef | grep passwd_server_ip | grep -v grep | awk '{print $2}')
   echo $pid
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/435e4f68/patches/systemvm/debian/config/opt/cloud/bin/passwd_server
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/opt/cloud/bin/passwd_server b/patches/systemvm/debian/config/opt/cloud/bin/passwd_server
index 95225b6..71349dd 100755
--- a/patches/systemvm/debian/config/opt/cloud/bin/passwd_server
+++ b/patches/systemvm/debian/config/opt/cloud/bin/passwd_server
@@ -16,18 +16,8 @@
 # specific language governing permissions and limitations
 # under the License.
 
-. /etc/default/cloud-passwd-srvr
-
-while [ "$ENABLED" == "1" ]
-do
-	socat -lf /var/log/cloud.log TCP4-LISTEN:8080,reuseaddr,crnl,bind=0.0.0.0 SYSTEM:"/opt/cloud/bin/serve_password.sh \"\$SOCAT_PEERADDR\""
-
-	rc=$?
-	if [ $rc -ne 0 ]
-	then
-		logger -t cloud "Password server failed with error code $rc. Restarting socat..."
-		sleep 3
-	fi
-        . /etc/default/cloud-passwd-srvr
-
-done
+ips=$(ip addr show dev eth0 | grep inet | grep eth0 | awk '{print $2}' ); echo $ips
+for ip in $ips; do
+	addr=$(echo $ip | awk -F'/' '{print $1}')
+	/opt/cloud/bin/passwd_server_ip $addr &
+done;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/435e4f68/patches/systemvm/debian/config/opt/cloud/bin/passwd_server_ip
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/opt/cloud/bin/passwd_server_ip b/patches/systemvm/debian/config/opt/cloud/bin/passwd_server_ip
new file mode 100755
index 0000000..8d62dff
--- /dev/null
+++ b/patches/systemvm/debian/config/opt/cloud/bin/passwd_server_ip
@@ -0,0 +1,32 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+. /etc/default/cloud-passwd-srvr
+addr=$1;
+while [ "$ENABLED" == "1" ]
+do
+	socat -lf /var/log/cloud.log TCP4-LISTEN:8080,reuseaddr,crnl,bind=$addr SYSTEM:"/opt/cloud/bin/serve_password.sh \"\$SOCAT_PEERADDR\""
+
+	rc=$?
+	if [ $rc -ne 0 ]
+	then
+		logger -t cloud "Password server failed with error code $rc. Restarting socat..."
+		sleep 3
+	fi
+        . /etc/default/cloud-passwd-srvr
+done

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/435e4f68/patches/systemvm/debian/config/opt/cloud/bin/patchsystemvm.sh
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/opt/cloud/bin/patchsystemvm.sh b/patches/systemvm/debian/config/opt/cloud/bin/patchsystemvm.sh
index f994aed..d8f8a6e 100755
--- a/patches/systemvm/debian/config/opt/cloud/bin/patchsystemvm.sh
+++ b/patches/systemvm/debian/config/opt/cloud/bin/patchsystemvm.sh
@@ -70,7 +70,6 @@ routing_svcs() {
    grep "redundant_router=1" /var/cache/cloud/cmdline > /dev/null
    RROUTER=$?
    chkconfig cloud off
-   chkconfig cloud-passwd-srvr on ; 
    chkconfig haproxy on ; 
    chkconfig ssh on
    chkconfig nfs-common off
@@ -78,19 +77,21 @@ routing_svcs() {
    if [ $RROUTER -eq 0 ]
    then
        chkconfig dnsmasq off
+       chkconfig cloud-passwd-srvr off
        chkconfig keepalived on
        chkconfig conntrackd on
        chkconfig postinit on
        echo "keepalived conntrackd postinit" > /var/cache/cloud/enabled_svcs
-       echo "dnsmasq " > /var/cache/cloud/disabled_svcs
+       echo "dnsmasq cloud-passwd-srvr" > /var/cache/cloud/disabled_svcs
    else
        chkconfig dnsmasq on
+       chkconfig cloud-passwd-srvr on
        chkconfig keepalived off
        chkconfig conntrackd off
-       echo "dnsmasq " > /var/cache/cloud/enabled_svcs
+       echo "dnsmasq cloud-passwd-srvr " > /var/cache/cloud/enabled_svcs
        echo "keepalived conntrackd " > /var/cache/cloud/disabled_svcs
    fi
-   echo "cloud-passwd-srvr ssh haproxy apache2" >> /var/cache/cloud/enabled_svcs
+   echo "ssh haproxy apache2" >> /var/cache/cloud/enabled_svcs
    echo "cloud nfs-common portmap" > /var/cache/cloud/disabled_svcs
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/435e4f68/patches/systemvm/debian/config/opt/cloud/bin/serve_password.sh
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/opt/cloud/bin/serve_password.sh b/patches/systemvm/debian/config/opt/cloud/bin/serve_password.sh
index c1f928d..b829b54 100755
--- a/patches/systemvm/debian/config/opt/cloud/bin/serve_password.sh
+++ b/patches/systemvm/debian/config/opt/cloud/bin/serve_password.sh
@@ -20,6 +20,15 @@
 
 # set -x 
 
+source /root/func.sh
+
+lock="passwdlock"
+locked=$(getLockFile $lock)
+if [ "$locked" != "1" ]
+then
+    exit 1
+fi
+
 PASSWD_FILE=/var/cache/cloud/passwords
 
 #   $1 filename
@@ -91,4 +100,4 @@ fi
 
 # echo -e \"\\\"\\\n\\\"\"
 
-exit 0
+unlock_exit 0 $lock $locked

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/435e4f68/patches/systemvm/debian/config/root/redundant_router/disable_pubip.sh
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/root/redundant_router/disable_pubip.sh b/patches/systemvm/debian/config/root/redundant_router/disable_pubip.sh
index 84631f6..af5edbf 100644
--- a/patches/systemvm/debian/config/root/redundant_router/disable_pubip.sh
+++ b/patches/systemvm/debian/config/root/redundant_router/disable_pubip.sh
@@ -21,4 +21,5 @@ while read i
 do
     ifconfig $i down
 done < /tmp/iflist
+service cloud-passwd-srvr stop
 service dnsmasq stop

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/435e4f68/patches/systemvm/debian/config/root/redundant_router/enable_pubip.sh.templ
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/root/redundant_router/enable_pubip.sh.templ b/patches/systemvm/debian/config/root/redundant_router/enable_pubip.sh.templ
index 0bb6ef0..ec5905d 100644
--- a/patches/systemvm/debian/config/root/redundant_router/enable_pubip.sh.templ
+++ b/patches/systemvm/debian/config/root/redundant_router/enable_pubip.sh.templ
@@ -25,4 +25,5 @@ do
     ifup $i
 done < /tmp/iflist
 ip route add default via [GATEWAY] dev eth2 && \
+service cloud-passwd-srvr restart && \
 service dnsmasq restart