DaanHoogland commented on a change in pull request #3575: [WIP DO NOT MERGE]
Health check feature for virtual router
URL: https://github.com/apache/cloudstack/pull/3575#discussion_r365863692
##########
File path:
server/src/main/java/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
##########
@@ -1271,6 +1280,43 @@ protected void runInContext() {
}
}
+ /**
+ * Attempts recreation of router by restarting with cleanup a VPC if any
or a guest network associated in case no VPC.
+ * @param routerId - the id of the router to be recreated.
+ * @return true if successfully restart is attempted else false.
+ */
+ private boolean recreateRouter(long routerId) {
+ List<DomainRouterJoinVO> routerJoinVOs =
domainRouterJoinDao.searchByIds(routerId);
+ DomainRouterJoinVO routerJoinToRestart = null;
+ User systemUser = _userDao.getUser(User.UID_SYSTEM);
+ for (DomainRouterJoinVO router : routerJoinVOs) {
+ if (router.getRemoved() == null && router.getTrafficType() ==
TrafficType.Guest) {
+ if (router.getVpcId() != 0) {
+ try {
+ s_logger.debug("Attempting restart VPC " +
router.getVpcName() + " for router recreation " + router.getUuid());
+ return vpcService.restartVpc(router.getVpcId(), true,
false, systemUser);
+ } catch (Exception e) {
+ s_logger.error("Failed to restart VPC for router
recreation " + router.getVpcName() + " ,router " + router.getUuid(), e);
+ }
+ }
+ routerJoinToRestart = router;
+ }
Review comment:
for all routers, if guest and present, if vpc ...
in that if it can fail and get an error logged but than it get treated as if
not vpc. I don't think this is logic as intended.
Also routerJoinToRestart might get re-assigned multiple times, thus ignoring
teh first one found. What is intended here?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services