cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject [17/50] [abbrv] git commit: updated refs/heads/feature/systemvm-persistent-config to 8620642
Date Mon, 16 Feb 2015 16:47:58 GMT
Fix router priuority using the same logic as the one for the state
Fix the router state. do not show UNKNOW, but MASTER or BACKUP depending on the type of router
Implement the virtual_router_id to be passed as a boot parameter to the router
  - it is needed for the keepalived configuration


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

Branch: refs/heads/feature/systemvm-persistent-config
Commit: f931111c9d90d46bad1f0414d4fd91393158ea73
Parents: 13bd340
Author: wilderrodrigues <wrodrigues@schubergphilis.com>
Authored: Tue Jan 27 14:05:38 2015 +0100
Committer: wilderrodrigues <wrodrigues@schubergphilis.com>
Committed: Mon Feb 16 16:08:38 2015 +0100

----------------------------------------------------------------------
 .../VirtualNetworkApplianceManagerImpl.java     | 22 +++++++++++++-------
 .../debian/config/opt/cloud/bin/cs/CsDatabag.py |  7 ++++++-
 .../config/opt/cloud/bin/cs/CsRedundant.py      |  3 ++-
 .../opt/cloud/templates/keepalived.conf.templ   |  4 ++--
 4 files changed, 24 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f931111c/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 f0730f5..1c32c7e 100644
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -1302,23 +1302,24 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine>
{
         }
     }
 
-    protected int getUpdatedPriority(final Network network, final List<DomainRouterVO>
routers, final DomainRouterVO exclude)
+    protected int getUpdatedPriority(final Network network, final List<DomainRouterVO>
routers, final DomainRouterVO masterRouter)
             throws InsufficientVirtualNetworkCapacityException {
         int priority;
         if (routers.size() == 0) {
             priority = DEFAULT_PRIORITY;
         } else {
             int maxPriority = 0;
-            for (final DomainRouterVO r : routers) {
-                if (!r.getIsRedundantRouter()) {
+
+            final DomainRouterVO router0 = routers.get(0);
+            if (router0.getId() == masterRouter.getId()) {
+                if (!router0.getIsRedundantRouter()) {
                     throw new CloudRuntimeException("Redundant router is mixed with single
router in one network!");
                 }
-                // FIXME Assume the maxPriority one should be running or just
-                // created.
-                if (r.getId() != exclude.getId() && _nwHelper.getRealPriority(r)
> maxPriority) {
-                    maxPriority = _nwHelper.getRealPriority(r);
-                }
+                maxPriority = _nwHelper.getRealPriority(router0);
+            } else {
+                maxPriority = DEFAULT_PRIORITY;
             }
+
             if (maxPriority == 0) {
                 return DEFAULT_PRIORITY;
             }
@@ -1330,6 +1331,7 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine>
{
                 throw new InsufficientVirtualNetworkCapacityException("Too many times fail-over
happened! Current maximum priority is too high as " + maxPriority + "!",
                         network.getId());
             }
+
             priority = maxPriority - DEFAULT_DELTA + 1;
         }
         return priority;
@@ -1589,6 +1591,7 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine>
{
         final boolean isRedundant = router.getIsRedundantRouter();
         if (isRedundant) {
             buf.append(" redundant_router=1");
+            buf.append(" router_id=").append(router.getId());
 
             final Long vpcId = router.getVpcId();
             final List<DomainRouterVO> routers;
@@ -1599,13 +1602,16 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine>
{
             }
 
             String redundantState = RedundantState.BACKUP.toString();
+            router.setRedundantState(RedundantState.BACKUP);
             if (routers.size() == 0) {
                 redundantState = RedundantState.MASTER.toString();
+                router.setRedundantState(RedundantState.MASTER);
             } else {
                 final DomainRouterVO router0 = routers.get(0);
 
                 if (router.getId() == router0.getId()) {
                     redundantState = RedundantState.MASTER.toString();
+                    router.setRedundantState(RedundantState.MASTER);
                 }
             }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f931111c/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDatabag.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDatabag.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDatabag.py
index d1d899b..187a0cb 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDatabag.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDatabag.py
@@ -129,4 +129,9 @@ class CsCmdLine(CsDataBag):
     def get_state(self):
         if "redundant_state" in self.idata():
             return self.idata()['redundant_state']
-        return "MASTER"
\ No newline at end of file
+        return "MASTER"
+    
+    def get_router_id(self):
+        if "router_id" in self.idata():
+            return self.idata()['router_id']
+        return 1
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f931111c/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
index 267cc1c..9569f08 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
@@ -102,6 +102,7 @@ class CsRedundant(object):
         file.search(" priority ", "    priority %s" % self.cl.get_priority())
         file.search(" weight ", "    weight %s" % 2)
         file.search(" state ", "    state %s" % self.cl.get_state())
+        file.search(" virtual_router_id ", "    virtual_router_id %s" % self.cl.get_router_id())
         file.greplace("[RROUTER_BIN_PATH]", self.CS_ROUTER_DIR)
         file.section("virtual_ipaddress {", "}", self._collect_ips())
         file.commit()
@@ -122,7 +123,7 @@ class CsRedundant(object):
         if connt.is_changed():
             CsHelper.service("conntrackd", "restart")
 
-        if file.is_changed() and self.cl.get_state() == 'MASTER':
+        if file.is_changed():
             CsHelper.service("keepalived", "restart")
 
         # FIXME

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f931111c/systemvm/patches/debian/config/opt/cloud/templates/keepalived.conf.templ
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/templates/keepalived.conf.templ b/systemvm/patches/debian/config/opt/cloud/templates/keepalived.conf.templ
index 9f3c24b..ef27617 100644
--- a/systemvm/patches/debian/config/opt/cloud/templates/keepalived.conf.templ
+++ b/systemvm/patches/debian/config/opt/cloud/templates/keepalived.conf.templ
@@ -38,8 +38,8 @@ vrrp_instance inside_network {
 
     advert_int 1
     authentication {
-        auth_type PASS
-        auth_pass WORD
+        auth_type AH
+        auth_pass k33p@live
     }
 
     virtual_ipaddress {


Mime
View raw message