ustcweizhou commented on a change in pull request #3421: RvR: VPC redundant vrs 
run on same hypervisor
URL: https://github.com/apache/cloudstack/pull/3421#discussion_r298009225
 
 

 ##########
 File path: server/src/com/cloud/network/router/NetworkHelperImpl.java
 ##########
 @@ -388,6 +388,19 @@ public DomainRouterVO startVirtualRouter(final 
DomainRouterVO router, final User
                     routerToBeAvoid = rrouter;
                 }
             }
+        } else if (router.getVpcId() != null) {
+            final List<DomainRouterVO> routerList = 
_routerDao.listByVpcId(router.getVpcId());
+            for (final DomainRouterVO rrouter : routerList) {
+                if (rrouter.getHostId() != null && 
rrouter.getIsRedundantRouter() && rrouter.getState() == State.Running) {
+                    if (routerToBeAvoid != null) {
+                        throw new ResourceUnavailableException("Try to start 
router " + router.getInstanceName() + "(" + router.getId() + ")"
+                                + ", but there are already two redundant 
routers with IP " + router.getPublicIpAddress() + ", they are " + 
rrouter.getInstanceName() + "("
+                                + rrouter.getId() + ") and " + 
routerToBeAvoid.getInstanceName() + "(" + routerToBeAvoid.getId() + ")", 
DataCenter.class,
+                                rrouter.getDataCenterId());
+                    }
+                    routerToBeAvoid = rrouter;
+                }
+            }
 
 Review comment:
   updated code as @anuragaw suggested

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to