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 @@ -1619,7 +1619,7 @@ protected void runInContext() {
}

private SetMonitorServiceCommand createMonitorServiceCommand(DomainRouterVO router, List<MonitorServiceTO> services,
boolean reconfigure, boolean deleteFromProcessedCache) {
boolean reconfigure, boolean deleteFromProcessedCache, Map<String, String> routerHealthCheckConfig) {
final SetMonitorServiceCommand command = new SetMonitorServiceCommand(services);
command.setAccessDetail(NetworkElementCommand.ROUTER_IP, _routerControlHelper.getRouterControlIp(router.getId()));
command.setAccessDetail(NetworkElementCommand.ROUTER_NAME, router.getInstanceName());
Expand All @@ -1637,7 +1637,7 @@ private SetMonitorServiceCommand createMonitorServiceCommand(DomainRouterVO rout
}

command.setAccessDetail(SetMonitorServiceCommand.ROUTER_HEALTH_CHECKS_EXCLUDED, excludedTests);
command.setHealthChecksConfig(getRouterHealthChecksConfig(router));
command.setHealthChecksConfig(routerHealthCheckConfig);
command.setReconfigureAfterUpdate(reconfigure);
command.setDeleteFromProcessedCache(deleteFromProcessedCache); // As part of updating
return command;
Expand All @@ -1662,7 +1662,7 @@ private boolean updateRouterHealthChecksConfig(DomainRouterVO router) {
s_logger.info("Updating data for router health checks for router " + router.getUuid());
Answer origAnswer = null;
try {
SetMonitorServiceCommand command = createMonitorServiceCommand(router, null, true, true);
SetMonitorServiceCommand command = createMonitorServiceCommand(router, null, true, true, getRouterHealthChecksConfig(router));
origAnswer = _agentMgr.easySend(router.getHostId(), command);
} catch (final Exception e) {
s_logger.error("Error while sending update data for health check to router: " + router.getInstanceName(), e);
Expand Down Expand Up @@ -1777,7 +1777,7 @@ private void updateWithLbRules(final DomainRouterJoinVO routerJoinVO, final Stri
}
}

private Map<String, String> getRouterHealthChecksConfig(final DomainRouterVO router) {
protected Map<String, String> getRouterHealthChecksConfig(final DomainRouterVO router) {
Map<String, String> data = new HashMap<>();
List<DomainRouterJoinVO> routerJoinVOs = domainRouterJoinDao.searchByIds(router.getId());
StringBuilder vmsData = new StringBuilder();
Expand Down Expand Up @@ -2342,6 +2342,7 @@ public boolean finalizeCommandsOnStart(final Commands cmds, final VirtualMachine
final Provider provider = getVrProvider(router);

final List<Long> routerGuestNtwkIds = _routerDao.getRouterNetworks(router.getId());
Map <String, String> routerHealthChecksConfig = getRouterHealthChecksConfig(router);
for (final Long guestNetworkId : routerGuestNtwkIds) {
final AggregationControlCommand startCmd = new AggregationControlCommand(Action.Start, router.getInstanceName(), controlNic.getIPv4Address(), _routerControlHelper.getRouterIpInNetwork(
guestNetworkId, router.getId()));
Expand All @@ -2350,7 +2351,7 @@ public boolean finalizeCommandsOnStart(final Commands cmds, final VirtualMachine
if (reprogramGuestNtwks) {
finalizeIpAssocForNetwork(cmds, router, provider, guestNetworkId, null);
finalizeNetworkRulesForNetwork(cmds, router, provider, guestNetworkId);
finalizeMonitorService(cmds, profile, router, provider, guestNetworkId, true);
finalizeMonitorService(cmds, profile, router, provider, guestNetworkId, true, routerHealthChecksConfig);
}

finalizeUserDataAndDhcpOnStart(cmds, router, provider, guestNetworkId);
Expand All @@ -2364,7 +2365,7 @@ public boolean finalizeCommandsOnStart(final Commands cmds, final VirtualMachine
}

protected void finalizeMonitorService(final Commands cmds, final VirtualMachineProfile profile, final DomainRouterVO router, final Provider provider,
final long networkId, boolean onStart) {
final long networkId, boolean onStart, Map<String, String> routerHealthCheckConfig) {
final NetworkOffering offering = _networkOfferingDao.findById(_networkDao.findById(networkId).getNetworkOfferingId());
if (offering.isRedundantRouter()) {
// service monitoring is currently not added in RVR
Expand Down Expand Up @@ -2414,7 +2415,7 @@ protected void finalizeMonitorService(final Commands cmds, final VirtualMachineP
}

// As part of aggregate command we don't need to reconfigure if onStart and persist in processed cache. Subsequent updates are not needed.
SetMonitorServiceCommand command = createMonitorServiceCommand(router, servicesTO, !onStart, false);
SetMonitorServiceCommand command = createMonitorServiceCommand(router, servicesTO, !onStart, false, routerHealthCheckConfig);
command.setAccessDetail(NetworkElementCommand.ROUTER_GUEST_IP, _routerControlHelper.getRouterIpInNetwork(networkId, router.getId()));
if (!isMonitoringServicesEnabled) {
command.setAccessDetail(SetMonitorServiceCommand.ROUTER_MONITORING_ENABLED, isMonitoringServicesEnabled.toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -499,8 +499,9 @@ public boolean finalizeCommandsOnStart(final Commands cmds, final VirtualMachine
throw new CloudRuntimeException("Cannot find related provider of virtual router provider: " + vrProvider.getType().toString());
}

Map<String, String> routerHealthCheckConfig = getRouterHealthChecksConfig(domainRouterVO);
if (reprogramGuestNtwks && publicNics.size() > 0) {
finalizeMonitorService(cmds, profile, domainRouterVO, provider, publicNics.get(0).second().getId(), true);
finalizeMonitorService(cmds, profile, domainRouterVO, provider, publicNics.get(0).second().getId(), true, routerHealthCheckConfig);
}

for (final Pair<Nic, Network> nicNtwk : guestNics) {
Expand All @@ -512,7 +513,7 @@ public boolean finalizeCommandsOnStart(final Commands cmds, final VirtualMachine
if (reprogramGuestNtwks) {
finalizeIpAssocForNetwork(cmds, domainRouterVO, provider, guestNetworkId, vlanMacAddress);
finalizeNetworkRulesForNetwork(cmds, domainRouterVO, provider, guestNetworkId);
finalizeMonitorService(cmds, profile, domainRouterVO, provider, guestNetworkId, true);
finalizeMonitorService(cmds, profile, domainRouterVO, provider, guestNetworkId, true, routerHealthCheckConfig);
}

finalizeUserDataAndDhcpOnStart(cmds, domainRouterVO, provider, guestNetworkId);
Expand Down Expand Up @@ -571,7 +572,7 @@ protected boolean sendNetworkRulesToRouter(final long routerId, final long netwo
finalizeNetworkRulesForNetwork(cmds, router, provider, networkId);
}

finalizeMonitorService(cmds, getVirtualMachineProfile(router), router, provider, networkId, false);
finalizeMonitorService(cmds, getVirtualMachineProfile(router), router, provider, networkId, false, getRouterHealthChecksConfig(router));

return _nwHelper.sendCommandsToRouter(router, cmds);
}
Expand Down