cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anthon...@apache.org
Subject [1/7] git commit: VPC : password server, start password server when guest network is created
Date Thu, 27 Sep 2012 00:42:43 GMT
Updated Branches:
  refs/heads/master 915babd97 -> e44d306dd


VPC : password server, start password server when guest network is created


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

Branch: refs/heads/master
Commit: b59c3c888536730132fe87dc41a551585023f504
Parents: 5d301f2
Author: Anthony Xu <anthony@cloud.com>
Authored: Mon Sep 24 17:47:35 2012 -0700
Committer: Anthony Xu <anthony@cloud.com>
Committed: Wed Sep 26 17:42:42 2012 -0700

----------------------------------------------------------------------
 .../debian/config/etc/init.d/cloud-early-config    |    2 -
 .../debian/config/opt/cloud/bin/patchsystemvm.sh   |   24 +++++++++++++++
 .../debian/config/opt/cloud/bin/vpc_guestnw.sh     |   18 ++++++++++-
 .../debian/config/opt/cloud/bin/vpc_passwd_server  |   13 ++++++++
 4 files changed, 54 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b59c3c88/patches/systemvm/debian/config/etc/init.d/cloud-early-config
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/etc/init.d/cloud-early-config b/patches/systemvm/debian/config/etc/init.d/cloud-early-config
index d2c07b5..8036359 100755
--- a/patches/systemvm/debian/config/etc/init.d/cloud-early-config
+++ b/patches/systemvm/debian/config/etc/init.d/cloud-early-config
@@ -650,11 +650,9 @@ EOF
 
   enable_svc dnsmasq 1
   enable_svc haproxy 1
-  enable_svc cloud-passwd-srvr 1
   enable_svc cloud 0
   disable_rpfilter_domR
   enable_fwding 1
-  chkconfig nfs-common off
   cp /etc/iptables/iptables-vpcrouter /etc/iptables/rules
   setup_sshd $ETH0_IP "eth0"
   cp /etc/vpcdnsmasq.conf /etc/dnsmasq.conf

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b59c3c88/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 d8f8a6e..1db7fb7 100755
--- a/patches/systemvm/debian/config/opt/cloud/bin/patchsystemvm.sh
+++ b/patches/systemvm/debian/config/opt/cloud/bin/patchsystemvm.sh
@@ -95,6 +95,20 @@ routing_svcs() {
    echo "cloud nfs-common portmap" > /var/cache/cloud/disabled_svcs
 }
 
+vpcrouting_svcs() {
+   chkconfig cloud off
+   chkconfig haproxy on ; 
+   chkconfig ssh on
+   chkconfig nfs-common off
+   chkconfig portmap off
+   chkconfig dnsmasq on
+   chkconfig keepalived off
+   chkconfig conntrackd off
+   chkconfig apache2 off
+   echo "ssh haproxy dnsmasq" >> /var/cache/cloud/enabled_svcs
+   echo "cloud cloud-passwd-srvr apache2 nfs-common portmap keepalived conntrackd" > /var/cache/cloud/disabled_svcs
+}
+
 dhcpsrvr_svcs() {
    chkconfig cloud off
    chkconfig cloud-passwd-srvr on ; 
@@ -188,6 +202,16 @@ then
   fi
 fi
 
+if [ "$TYPE" == "vpcrouter" ]
+then
+  vpcrouting_svcs
+  if [ $? -gt 0 ]
+  then
+    printf "Failed to execute vpcrouting_svcs\n" >$logfile
+    exit 6
+  fi
+fi
+
 if [ "$TYPE" == "dhcpsrvr" ]
 then
   dhcpsrvr_svcs

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b59c3c88/patches/systemvm/debian/config/opt/cloud/bin/vpc_guestnw.sh
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/opt/cloud/bin/vpc_guestnw.sh b/patches/systemvm/debian/config/opt/cloud/bin/vpc_guestnw.sh
index 590b58e..fcd7e84 100755
--- a/patches/systemvm/debian/config/opt/cloud/bin/vpc_guestnw.sh
+++ b/patches/systemvm/debian/config/opt/cloud/bin/vpc_guestnw.sh
@@ -92,7 +92,7 @@ setup_dnsmasq() {
 }
 
 desetup_dnsmasq() {
-  logger -t cloud "Setting up dnsmasq for network $ip/$mask "
+  logger -t cloud "Desetting up dnsmasq for network $ip/$mask "
   
   sed -i -e "/^[#]*dhcp-option=tag:interface-$dev,option:router.*$/d" /etc/dnsmasq.d/cloud.conf
   sed -i -e "/^[#]*dhcp-option=tag:interface-$dev,6.*$/d" /etc/dnsmasq.d/cloud.conf
@@ -101,6 +101,20 @@ desetup_dnsmasq() {
   sleep 1
 }
 
+setup_passwdsvcs() {
+  logger -t cloud "Setting up password service for network $ip/$mask, eth $dev "
+  nohup bash /opt/cloud/bin/vpc_passwd_server $ip &
+}
+
+desetup_passwdsvcs() {
+  logger -t cloud "Desetting up password service for network $ip/$mask, eth $dev "
+  pid=`ps -ef | grep socat | grep $ip | grep -v grep | awk '{print $2}'`
+  if [ -n "$pid" ]
+  then
+    kill -9 $pid
+  fi 
+}
+
 create_guest_network() {
   logger -t cloud " $(basename $0): Create network on interface $dev,  gateway $gw, network
$ip/$mask "
   # setup ip configuration
@@ -125,6 +139,7 @@ create_guest_network() {
   create_acl_chain
   setup_dnsmasq
   setup_apache2
+  setup_passwdsvcs
 }
 
 destroy_guest_network() {
@@ -140,6 +155,7 @@ destroy_guest_network() {
   destroy_acl_chain
   desetup_dnsmasq
   desetup_apache2
+  desetup_passwdsvcs
 }
 
 #set -x

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b59c3c88/patches/systemvm/debian/config/opt/cloud/bin/vpc_passwd_server
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/opt/cloud/bin/vpc_passwd_server b/patches/systemvm/debian/config/opt/cloud/bin/vpc_passwd_server
new file mode 100755
index 0000000..2b9deb1
--- /dev/null
+++ b/patches/systemvm/debian/config/opt/cloud/bin/vpc_passwd_server
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+ip=$1
+while [ -n "$ip" ]
+do
+	socat -lf /var/log/cloud.log TCP4-LISTEN:8080,reuseaddr,crnl,bind=$ip SYSTEM:"/opt/cloud/bin/serve_password.sh"
+	rc=$?
+	if [ $rc -ne 0 ]
+	then
+		logger -t cloud "Password server failed with error code $rc. Restarting socat..."
+		sleep 3
+	fi
+done


Mime
View raw message