Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@
import com.cloud.network.dao.MonitoringServiceDao;
import com.cloud.network.dao.MonitoringServiceVO;
import com.cloud.network.dao.NetworkDao;
import com.cloud.network.dao.NetworkServiceMapDao;
import com.cloud.network.dao.NetworkVO;
import com.cloud.network.dao.OpRouterMonitorServiceDao;
import com.cloud.network.dao.OpRouterMonitorServiceVO;
Expand Down Expand Up @@ -349,6 +350,7 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
@Inject private ApplicationLoadBalancerRuleDao applicationLoadBalancerRuleDao;
@Inject private RouterHealthCheckResultDao routerHealthCheckResultDao;
@Inject private LBStickinessPolicyDao lbStickinessPolicyDao;
@Inject private NetworkServiceMapDao _ntwkSrvcDao;

@Inject private NetworkService networkService;
@Inject private VpcService vpcService;
Expand Down Expand Up @@ -1775,14 +1777,18 @@ private Map<String, String> getRouterHealthChecksConfig(final DomainRouterVO rou
SearchCriteria<UserVmJoinVO> scvm = sbvm.create();
scvm.setParameters("networkId", routerJoinVO.getNetworkId());
List<UserVmJoinVO> vms = userVmJoinDao.search(scvm, null);
boolean isDhcpSupported = _ntwkSrvcDao.areServicesSupportedInNetwork(routerJoinVO.getNetworkId(), Service.Dhcp);
boolean isDnsSupported = _ntwkSrvcDao.areServicesSupportedInNetwork(routerJoinVO.getNetworkId(), Service.Dns);
for (UserVmJoinVO vm : vms) {
if (vm.getState() != VirtualMachine.State.Running) {
continue;
}

vmsData.append("vmName=").append(vm.getName())
.append(",macAddress=").append(vm.getMacAddress())
.append(",ip=").append(vm.getIpAddress()).append(";");
.append(",ip=").append(vm.getIpAddress())
.append(",dhcp=").append(isDhcpSupported)
.append(",dns=").append(isDnsSupported).append(";");
updateWithPortForwardingRules(routerJoinVO, vm, portData);
}
updateWithLbRules(routerJoinVO, loadBalancingData);
Expand Down
15 changes: 11 additions & 4 deletions systemvm/debian/root/health_checks/dhcp_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,20 @@ def main():
print "No VMs running data available, skipping"
exit(0)

with open('/etc/dhcphosts.txt', 'r') as hostsFile:
allHosts = hostsFile.readlines()
hostsFile.close()
try:
with open('/etc/dhcphosts.txt', 'r') as hostsFile:
allHosts = hostsFile.readlines()
hostsFile.close()
except IOError:
allHosts = []

failedCheck = False
failureMessage = "Missing elements in dhcphosts.txt - \n"
COUNT = 0
for vM in vMs:
if vM["dhcp"] == "false":
continue
COUNT = COUNT + 1
entry = vM["macAddress"] + " " + vM["ip"] + " " + vM["vmName"]
foundEntry = False
for host in allHosts:
Expand All @@ -60,7 +67,7 @@ def main():
print failureMessage[:-2]
exit(1)
else:
print "All " + str(len(vMs)) + " VMs are present in dhcphosts.txt"
print "All " + str(COUNT) + " VMs are present in dhcphosts.txt"
exit(0)


Expand Down
6 changes: 5 additions & 1 deletion systemvm/debian/root/health_checks/dns_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ def main():

failedCheck = False
failureMessage = "Missing entries for VMs in /etc/hosts -\n"
COUNT = 0
for vM in vMs:
if vM["dns"] == "false":
continue
COUNT = COUNT + 1
foundEntry = False
for host in allHosts:
components = host.split('\t')
Expand All @@ -50,7 +54,7 @@ def main():
print failureMessage[:-2]
exit(1)
else:
print "All " + str(len(vMs)) + " VMs are present in /etc/hosts"
print "All " + str(COUNT) + " VMs are present in /etc/hosts"
exit(0)


Expand Down