You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2015/03/17 11:26:24 UTC

[22/50] git commit: updated refs/heads/master to 3c429ee

Fix the router id on the virtural routers
   - Using the VPC id, it is reliable.
   - Tested stopping/destroying/creating a router and VRRP is pretty happy


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/ca9deb70
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ca9deb70
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ca9deb70

Branch: refs/heads/master
Commit: ca9deb70f6670280af22d09203047f0cef35ffe0
Parents: 05e4fe1
Author: wilderrodrigues <wr...@schubergphilis.com>
Authored: Thu Feb 5 10:06:02 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:39:59 2015 +0100

----------------------------------------------------------------------
 .../router/VirtualNetworkApplianceManagerImpl.java     | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ca9deb70/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
index 5bca748..61fa918 100644
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -693,13 +693,13 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
         }
 
         // We cannot schedule a job at specific time. Provide initial delay instead, from current time, so that the job runs at desired time
-        long initialDelay = aggDate - System.currentTimeMillis();
+        final long initialDelay = aggDate - System.currentTimeMillis();
 
         if( initialDelay < 0){
             s_logger.warn("Initial delay for network usage stats update task is incorrect. Stats update task will run immediately");
         }
 
-        _networkStatsUpdateExecutor.scheduleAtFixedRate(new NetworkStatsUpdateTask(), initialDelay, (_usageAggregationRange * 60 * 1000),
+        _networkStatsUpdateExecutor.scheduleAtFixedRate(new NetworkStatsUpdateTask(), initialDelay, _usageAggregationRange * 60 * 1000,
                 TimeUnit.MILLISECONDS);
 
         if (_routerCheckInterval > 0) {
@@ -1595,6 +1595,9 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
             final List<DomainRouterVO> routers;
             if (vpcId != null) {
                 routers = _routerDao.listByVpcId(vpcId);
+                // For a redundant VPC router, both shall have the same router id. It will be used by the VRRP virtural_router_id attribute.
+                // So we use the VPC id to avoid group problems.
+                buf.append(" router_id=").append(vpcId);
             } else {
                 routers = _routerDao.listByNetworkAndRole(nic.getNetworkId(), Role.VIRTUAL_ROUTER);
             }
@@ -1604,14 +1607,8 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
             if (routers.size() == 0) {
                 redundantState = RedundantState.MASTER.toString();
                 router.setRedundantState(RedundantState.MASTER);
-
-                buf.append(" router_id=").append(router.getId());
             } else {
                 final DomainRouterVO router0 = routers.get(0);
-
-                //For a redundant router, both shall have the same router id. It will be used by the VRRP virtural_router_id attribute.
-                buf.append(" router_id=").append(router0.getId());
-
                 if (router.getId() == router0.getId()) {
                     redundantState = RedundantState.MASTER.toString();
                     router.setRedundantState(RedundantState.MASTER);