Redundant router script fix, also fix CheckRouterTask

This commit is contained in:
Sheng Yang 2011-08-11 17:55:53 -07:00
parent e4092e8084
commit 0387b6e802
4 changed files with 7 additions and 5 deletions

View File

@ -327,9 +327,10 @@ setup_redundant_router() {
sed -i "s/\[IGNORE_IP2\]/$ETH0_IP/g" /etc/conntrackd/conntrackd.conf
sed -i "s/\[IGNORE_IP3\]/$ETH1_IP/g" /etc/conntrackd/conntrackd.conf
sed -i "s/\[ETH2IP\]/$ETH2_IP/g" /root/redundant_router/enable_pubip.sh
sed -i "s/\[ETH2MASK\]/$ETH2_MASK/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

@ -1,5 +1,4 @@
#!/bin/bash
ifdown eth2
ifconfig eth2 down
service dnsmasq stop

View File

@ -1,8 +1,8 @@
#!/bin/bash
ifdown eth2 && \
ifconfig eth2 down && \
ifconfig eth2 hw ether [ETH2MAC] && \
ifup eth2 && \
ifconfig eth2 [ETH2IP] netmask [ETH2MASK] && \
ifconfig eth2 up && \
ip route add default via [GATEWAY] dev eth2 && \
service dnsmasq restart

View File

@ -98,6 +98,7 @@ import com.cloud.exception.PermissionDeniedException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.exception.StorageUnavailableException;
import com.cloud.host.HostVO;
import com.cloud.host.Status;
import com.cloud.host.dao.HostDao;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.network.IPAddressVO;
@ -766,7 +767,8 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
String privateIP = router.getPrivateIpAddress();
HostVO host = _hostDao.findById(router.getHostId());
/* Only cover hosts managed by this management server */
if (host == null || host.getManagementServerId() != ManagementServerNode.getManagementServerId()) {
if (host == null || host.getStatus() != Status.Up ||
host.getManagementServerId() != ManagementServerNode.getManagementServerId()) {
continue;
}
if (privateIP != null) {