phsm commented on issue #8055:
URL: https://github.com/apache/cloudstack/issues/8055#issuecomment-1864388934
@weizhouapache
Hi Wei,
I've actually managed to implement the patch myself.
The test looks promising:
Without this patch applied, the 10-tier VPC took 61 minutes to fully restart
With this patch applied, the same VPC took 9 minutes to fully restart
Can you take a look at it? If it looks good to you, I can make a PR with it.
- I changed getRouterHealthChecksConfig() to be protected as
VpcVirtualNetworkApplianceManagerImpl is going to call it.
- Moved the getRouterHealthChecksConfig() upper to finalizeCommandsOnStart()
in the execution stack. The health check config is now passed down the stack as
a function argument.
- Adjusted other methods that use getRouterHealthChecksConfig().
```patch
diff --git
a/server/src/main/java/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
b/server/src/main/java/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
index f7bfb1c4af..3d236c0a13 100644
---
a/server/src/main/java/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++
b/server/src/main/java/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -1623,7 +1623,7 @@ Configurable, StateListener<VirtualMachine.State,
VirtualMachine.Event, VirtualM
}
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());
@@ -1641,7 +1641,7 @@ Configurable, StateListener<VirtualMachine.State,
VirtualMachine.Event, VirtualM
}
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;
@@ -1666,7 +1666,7 @@ Configurable, StateListener<VirtualMachine.State,
VirtualMachine.Event, VirtualM
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);
@@ -1891,7 +1891,7 @@ Configurable, StateListener<VirtualMachine.State,
VirtualMachine.Event, VirtualM
.append(generateKeyValuePairOrEmptyString("server.maxqueue", serverMaxqueue));
}
- 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();
@@ -2464,7 +2464,7 @@ Configurable, StateListener<VirtualMachine.State,
VirtualMachine.Event, VirtualM
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, getRouterHealthChecksConfig(router));
}
finalizeUserDataAndDhcpOnStart(cmds, router, provider,
guestNetworkId);
@@ -2478,7 +2478,7 @@ Configurable, StateListener<VirtualMachine.State,
VirtualMachine.Event, VirtualM
}
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
@@ -2528,7 +2528,7 @@ Configurable, StateListener<VirtualMachine.State,
VirtualMachine.Event, VirtualM
}
// 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());
diff --git
a/server/src/main/java/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
b/server/src/main/java/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
index 18801eb01f..27958126e7 100644
---
a/server/src/main/java/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
+++
b/server/src/main/java/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
@@ -482,8 +482,9 @@ public class VpcVirtualNetworkApplianceManagerImpl
extends VirtualNetworkApplian
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) {
@@ -495,7 +496,7 @@ public class VpcVirtualNetworkApplianceManagerImpl
extends VirtualNetworkApplian
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);
@@ -554,7 +555,7 @@ public class VpcVirtualNetworkApplianceManagerImpl
extends VirtualNetworkApplian
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);
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]