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_r366254106
 
 

 ##########
 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:
   @DaanHoogland - the aim is to recreate router. My understanding was to not 
let any case slide and I am not sure if an entry without VPC ID would ensure 
it's the right one and rest entries won't have a VPC ID. Let me knw if you 
disagree. There are so many possible paths and it seemed like the most 
exhaustive approach to me. Thoughts?

----------------------------------------------------------------
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

Reply via email to