You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ed...@apache.org on 2012/09/27 06:58:03 UTC
[6/33] git commit: VPC : password server,
start password server when guest network is created
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/9afe06e2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/9afe06e2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/9afe06e2
Branch: refs/heads/4.0
Commit: 9afe06e2bb739bc3bde9336eeba7c7cb7ff28513
Parents: 889a34c
Author: Anthony Xu <an...@cloud.com>
Authored: Mon Sep 24 17:47:35 2012 -0700
Committer: Edison Su <di...@gmail.com>
Committed: Wed Sep 26 21:56:24 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/9afe06e2/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/9afe06e2/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/9afe06e2/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 7331c53..e824091 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/9afe06e2/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