anuragaw 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_r365938321
##########
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:
This is DomainRouterJoinVO for a given ID. So it's all a single router
specific but for each NIC. The intention now here is we want to recreate a
Router. To do that cleanly and redoing all rules we -
1. IF any network had VPC associated we just restart the VPC with cleanup
and return.
2. IF no join VO had VPC we just restart any guest network with cleanup. So
reassigning is fine.
Makes sense?
----------------------------------------------------------------
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