Fix dhcp_entry.sh fail on redundant router

And don't worry about "chkconfig dnsmasq off", because keepalived script should
take care of it.
This commit is contained in:
Sheng Yang 2011-08-10 17:11:38 -07:00
parent dc116d99a8
commit 02049d4cd4
3 changed files with 15 additions and 4 deletions

View File

@ -325,7 +325,7 @@ setup_redundant_router() {
sed -i "s/\[ETH2IP\]/$ETH2_IP/g" /root/redundant_router/enable_pubip.sh
sed -i "s/\[GATEWAY\]/$GW/g" /root/redundant_router/enable_pubip.sh
sed -i "s/--exec\ \$DAEMON;/--exec\ \$DAEMON\ --\ --vrrp;/g" /etc/init.d/keepalived
grep "sleep 10;" /etc/init.d/keepalived > /dev/null
#grep "sleep 10;" /etc/init.d/keepalived > /dev/null
if [ $? -ne 0 ]
then
sed -i "s/if\ start-stop-daemon\ --start/sleep\ 10;if\ start-stop-daemon\ --start/g" /etc/init.d/keepalived

View File

@ -72,15 +72,16 @@ routing_svcs() {
chkconfig cloud off
chkconfig cloud-passwd-srvr on ;
chkconfig haproxy on ;
chkconfig dnsmasq on
chkconfig ssh on
chkconfig nfs-common off
chkconfig portmap off
if [ $RROUTER -eq 0 ]
then
chkconfig dnsmasq off
chkconfig postinit on
echo "postinit" > /var/cache/cloud/enabled_svcs
else
chkconfig dnsmasq on
chkconfig keepalived off
chkconfig conntrackd off
fi

View File

@ -25,6 +25,9 @@
# $2 : the associated ip address
# $3 : the hostname
grep "redundant_router=1" /var/cache/cloud/cmdline > /dev/null
no_redundant=$?
wait_for_dnsmasq () {
local _pid=$(pidof dnsmasq)
for i in 0 1 2 3 4 5 6 7 8 9 10
@ -34,10 +37,12 @@ wait_for_dnsmasq () {
[ "$_pid" != "" ] && break;
done
[ "$_pid" != "" ] && return 0;
echo "edithosts: timed out waiting for dnsmasq to start"
logger -t cloud "edithosts: timed out waiting for dnsmasq to start"
return 1
}
logger -t cloud "edithosts: update $1 $2 $3 to hosts"
[ ! -f /etc/dhcphosts.txt ] && touch /etc/dhcphosts.txt
[ ! -f /var/lib/misc/dnsmasq.leases ] && touch /var/lib/misc/dnsmasq.leases
@ -68,7 +73,12 @@ if [ "$pid" != "" ]
then
service dnsmasq restart
else
wait_for_dnsmasq
if [ $no_redundant -eq 1 ]
then
wait_for_dnsmasq
else
logger -t cloud "edithosts: skip wait dnsmasq due to redundant virtual router"
fi
fi
exit $?