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:03 UTC

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

Repository: cloudstack
Updated Branches:
  refs/heads/master 83736ab53 -> 3c429ee6b


No bump for now


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

Branch: refs/heads/master
Commit: e95a6498b5130be427369bfb7fdf463ddc052675
Parents: f5ef75e
Author: Ian Southam <is...@schubergphilis.com>
Authored: Tue Jan 27 16:59:07 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:39:51 2015 +0100

----------------------------------------------------------------------
 .../config/opt/cloud/templates/keepalived.conf.templ    | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e95a6498/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 ef27617..e5bdc7c 100644
--- a/systemvm/patches/debian/config/opt/cloud/templates/keepalived.conf.templ
+++ b/systemvm/patches/debian/config/opt/cloud/templates/keepalived.conf.templ
@@ -19,11 +19,11 @@ global_defs {
    router_id [ROUTER_ID]
 }
 
-vrrp_script check_bumpup {
-    script "[RROUTER_BIN_PATH]/check_bumpup.sh"
-    interval 5
-    weight [DELTA]
-}
+!vrrp_script check_bumpup {
+    !script "[RROUTER_BIN_PATH]/check_bumpup.sh"
+    !interval 5
+    !weight [DELTA]
+!}
 
 vrrp_script heartbeat {
     script "[RROUTER_BIN_PATH]/heartbeat.sh"
@@ -47,7 +47,7 @@ vrrp_instance inside_network {
     }
 
     track_script {
-        check_bumpup
+        !check_bumpup
         heartbeat
     }
 


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

Posted by bh...@apache.org.
Fixed CsAddress destroying the VIP address on a redundant router
Taken quite a bit of code out of CsRedundant
Fixed public IP in keepalived when there is no guest network


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

Branch: refs/heads/master
Commit: bf6e3fa8b2ce4aefb06ea2a76e229c1e91f545f0
Parents: 6d34f1f
Author: Ian Southam <is...@schubergphilis.com>
Authored: Wed Jan 28 15:20:45 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:39:53 2015 +0100

----------------------------------------------------------------------
 .../debian/config/opt/cloud/bin/cs/CsAddress.py |  5 +-
 .../debian/config/opt/cloud/bin/cs/CsDatabag.py |  6 +-
 .../config/opt/cloud/bin/cs/CsRedundant.py      | 58 +++++++++++---------
 3 files changed, 37 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bf6e3fa8/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
index a3ca801..0b5cca9 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
@@ -28,6 +28,7 @@ from CsRule import CsRule
 
 VRRP_TYPES = ['guest']
 
+
 class CsAddress(CsDataBag):
 
     def compare(self):
@@ -499,10 +500,10 @@ class CsIP:
     def is_guest_gateway(self, bag, ip):
         """ Exclude the vrrp maintained addresses on a redundant router """
         if not self.config.cl.is_redundant():
-           return False
+            return False
         rip = ip.split('/')[0]
         if bag['nw_type'] == "guest" and rip == bag['gateway']:
-           return True
+            return True
         return False
 
     def delete(self, ip):

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bf6e3fa8/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 187a0cb..936f993 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDatabag.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDatabag.py
@@ -125,13 +125,13 @@ class CsCmdLine(CsDataBag):
         if "redundant_master" in self.idata():
             return self.idata()['redundant_master'] == "true"
         return False
-    
+
     def get_state(self):
         if "redundant_state" in self.idata():
             return self.idata()['redundant_state']
         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
+        return 1

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bf6e3fa8/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 a1bef3a..1db27ad 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
@@ -38,6 +38,7 @@ import logging
 import CsHelper
 from CsFile import CsFile
 from CsConfig import CsConfig
+from CsProcess import CsProcess
 
 
 class CsRedundant(object):
@@ -63,8 +64,7 @@ class CsRedundant(object):
 
     def set(self):
         logging.debug("Router redundancy status is %s", self.cl.is_redundant())
-        guest = self.address.get_guest_if()
-        if self.cl.is_redundant() and guest:
+        if self.cl.is_redundant():
             self._redundant_on()
         else:
             self._redundant_off()
@@ -99,29 +99,35 @@ class CsRedundant(object):
         # keepalived configuration
         file = CsFile(self.KEEPALIVED_CONF)
         file.search(" router_id ", "    router_id %s" % self.cl.get_name())
-        file.search(" priority ", "    priority %s" % self.cl.get_priority())
+        # 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.search(" state ", "    state %s" % self.cl.get_state())
+        file.search(" state ", "    state %s" % "EQUAL")
+        # 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())
-        if self.cl.get_state() == 'MASTER':
-            file.search(" priority ", "    priority %s" % 120)
+# If there is no guest network still bring up the public interface
+# Maybe necessary for things like VPNs and private gateways
+        if self.address.get_guest_if():
+            file.section("virtual_ipaddress {", "}", self._collect_ips())
+        # if self.cl.get_state() == 'MASTER':
+            # file.search(" priority ", "    priority %s" % 100)
         file.commit()
 
         # conntrackd configuration
         guest = self.address.get_guest_if()
         connt = CsFile(self.CONNTRACKD_CONF)
-        connt.section("Multicast {", "}", [
-                      "IPv4_address 225.0.0.50\n",
-                      "Group 3780\n",
-                      "IPv4_interface %s\n" % guest.get_ip(),
-                      "Interface %s\n" % guest.get_device(),
-                      "SndSocketBuffer 1249280\n",
-                      "RcvSocketBuffer 1249280\n",
-                      "Checksum on\n"])
-        connt.section("Address Ignore {", "}", self._collect_ignore_ips())
-        connt.commit()
+        if guest is not None:
+            connt.section("Multicast {", "}", [
+                          "IPv4_address 225.0.0.50\n",
+                          "Group 3780\n",
+                          "IPv4_interface %s\n" % guest.get_ip(),
+                          "Interface %s\n" % guest.get_device(),
+                          "SndSocketBuffer 1249280\n",
+                          "RcvSocketBuffer 1249280\n",
+                          "Checksum on\n"])
+            connt.section("Address Ignore {", "}", self._collect_ignore_ips())
+            connt.commit()
+
         if connt.is_changed():
             CsHelper.service("conntrackd", "restart")
 
@@ -138,6 +144,10 @@ class CsRedundant(object):
         cron.add("*/1 * * * * root $SHELL %s/check_heartbeat.sh 2>&1 > /dev/null" % self.CS_ROUTER_DIR, -1)
         cron.commit()
 
+        proc = CsProcess(['/usr/sbin/keepalived', '--vrrp'])
+        if not proc.find():
+            CsHelper.service("keepalived", "restart")
+
     def set_fault(self):
         """ Set fault mode on this router """
         if not self.cl.is_redundant():
@@ -177,9 +187,9 @@ class CsRedundant(object):
         CsHelper.service("xl2tpd", "stop")
         CsHelper.service("cloud-passwd-srvr", "stop")
         CsHelper.service("dnsmasq", "stop")
-        self._set_priority(self.CS_PRIO_DOWN)
+        # self._set_priority(self.CS_PRIO_DOWN)
         self.cl.dbag['config']['redundant_master'] = "false"
-        #CsHelper.service("keepalived", "restart")
+        # CsHelper.service("keepalived", "restart")
         self.cl.save()
         logging.info("Router switched to backup mode")
 
@@ -212,15 +222,9 @@ class CsRedundant(object):
         CsHelper.service("dnsmasq", "restart")
         self.cl.dbag['config']['redundant_master'] = "true"
         self.cl.save()
-        #CsHelper.service("keepalived", "restart")
+        # CsHelper.service("keepalived", "restart")
         logging.info("Router switched to master mode")
 
-    def _set_priority(self, dir):
-        self.cl.set_priority(int(self.cl.get_priority()) + dir)
-        file = CsFile(self.KEEPALIVED_CONF)
-        file.search(" priority ", "    priority %s" % self.cl.get_priority())
-        file.commit()
-
     def _collect_ignore_ips(self):
         """
         This returns a list of ip objects that should be ignored


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

Posted by bh...@apache.org.
Fix state of isolated redundant network router
   - once stopped, got to UNKNOWN


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

Branch: refs/heads/master
Commit: ae6b07af15665ca35f8a9ea732c7f5b58b80f8ef
Parents: b3da2c5
Author: wilderrodrigues <wr...@schubergphilis.com>
Authored: Sat Feb 7 10:15:24 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:40:04 2015 +0100

----------------------------------------------------------------------
 .../cloud/network/router/VirtualNetworkApplianceManagerImpl.java    | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ae6b07af/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 5d59813..234c745 100644
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -1173,6 +1173,7 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
                     } else {
                         router = router1;
                     }
+                    // && router.getState() == State.Stopped
                     if (router.getHostId() == null) {
                         s_logger.debug("Skip router pair (" + router0.getInstanceName() + "," + router1.getInstanceName() + ") due to can't find host");
                         continue;


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

Posted by bh...@apache.org.
Merge remote-tracking branch 'sbp/feature/persisten-systemvm-redundant-vpc-REBASE'

This closes #118

Signed-off-by: Rohit Yadav <ro...@shapeblue.com>


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

Branch: refs/heads/master
Commit: 3c429ee6b5e7dc2dc948c837aa53f554f1c40d9c
Parents: 83736ab 23c100d
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Tue Mar 17 15:44:40 2015 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Tue Mar 17 15:44:57 2015 +0530

----------------------------------------------------------------------
 .gitignore                                      |    8 +-
 api/src/com/cloud/network/Network.java          |    2 +
 api/src/com/cloud/network/NetworkProfile.java   |   11 +-
 .../VpcVirtualNetworkApplianceService.java      |    4 +-
 api/src/com/cloud/network/vpc/Vpc.java          |    2 +
 api/src/com/cloud/network/vpc/VpcOffering.java  |    4 +
 api/src/com/cloud/network/vpc/VpcService.java   |   14 +-
 .../org/apache/cloudstack/api/ApiConstants.java |    4 +-
 .../api/command/user/vpc/RestartVPCCmd.java     |   37 +-
 .../cloudstack/api/response/VpcResponse.java    |   56 +-
 .../classes/resources/messages.properties       |    3 +
 .../classes/resources/messages_de_DE.properties |    1 +
 .../classes/resources/messages_es.properties    |    1 +
 .../classes/resources/messages_fr_FR.properties |    1 +
 .../classes/resources/messages_it_IT.properties |    1 +
 .../classes/resources/messages_ja_JP.properties |    1 +
 .../classes/resources/messages_ko_KR.properties |    1 +
 .../classes/resources/messages_nb_NO.properties |    3 +
 .../classes/resources/messages_nl_NL.properties |    5 +-
 .../classes/resources/messages_pl.properties    |    1 +
 .../classes/resources/messages_pt_BR.properties |    7 +-
 .../classes/resources/messages_ru_RU.properties |    3 +
 .../classes/resources/messages_zh_CN.properties |    1 +
 client/pom.xml                                  |   31 +-
 .../api/routing/NetworkElementCommand.java      |   10 +-
 .../api/routing/SetStaticRouteCommand.java      |   14 +-
 .../resource/virtualnetwork/ConfigHelper.java   |  719 ----
 .../resource/virtualnetwork/FileConfigItem.java |   10 +
 .../virtualnetwork/ScriptConfigItem.java        |   10 +
 .../resource/virtualnetwork/VRScripts.java      |   89 +-
 .../virtualnetwork/VirtualRoutingResource.java  |   19 +-
 .../facade/AbstractConfigItemFacade.java        |  120 +
 .../facade/BumpUpPriorityConfigItem.java        |   39 +
 .../facade/CreateIpAliasConfigItem.java         |   57 +
 .../facade/DeleteIpAliasConfigItem.java         |   64 +
 .../facade/DhcpEntryConfigItem.java             |   49 +
 .../facade/DnsMasqConfigItem.java               |   56 +
 .../facade/IpAssociationConfigItem.java         |   59 +
 .../facade/LoadBalancerConfigItem.java          |   74 +
 .../facade/RemoteAccessVpnConfigItem.java       |   48 +
 .../facade/SavePasswordConfigItem.java          |   47 +
 .../facade/SetFirewallRulesConfigItem.java      |   58 +
 .../facade/SetGuestNetworkConfigItem.java       |   68 +
 .../facade/SetMonitorServiceConfigItem.java     |   47 +
 .../facade/SetNetworkAclConfigItem.java         |  107 +
 .../SetPortForwardingRulesConfigItem.java       |   59 +
 .../SetPortForwardingRulesVpcConfigItem.java    |   33 +
 .../facade/SetSourceNatConfigItem.java          |   54 +
 .../facade/SetStaticNatRulesConfigItem.java     |   56 +
 .../facade/SetStaticRouteConfigItem.java        |   61 +
 .../facade/Site2SiteVpnConfigItem.java          |   49 +
 .../virtualnetwork/facade/VmDataConfigItem.java |   48 +
 .../facade/VpnUsersConfigItem.java              |   54 +
 .../resource/virtualnetwork/model/AclRule.java  |   60 +
 .../virtualnetwork/model/AllAclRule.java        |   33 +
 .../virtualnetwork/model/ConfigBase.java        |   60 +
 .../virtualnetwork/model/DhcpConfig.java        |   45 +
 .../virtualnetwork/model/DhcpConfigEntry.java   |   72 +
 .../virtualnetwork/model/FirewallRule.java      |  175 +
 .../virtualnetwork/model/FirewallRules.java     |   42 +
 .../virtualnetwork/model/ForwardingRule.java    |   91 +
 .../virtualnetwork/model/ForwardingRules.java   |   42 +
 .../virtualnetwork/model/GuestNetwork.java      |  122 +
 .../virtualnetwork/model/IcmpAclRule.java       |   53 +
 .../virtualnetwork/model/IpAddress.java         |  134 +
 .../virtualnetwork/model/IpAddressAlias.java    |   72 +
 .../virtualnetwork/model/IpAliases.java         |   44 +
 .../virtualnetwork/model/IpAssociation.java     |   42 +
 .../virtualnetwork/model/LoadBalancerRule.java  |  104 +
 .../virtualnetwork/model/LoadBalancerRules.java |   43 +
 .../virtualnetwork/model/MonitorService.java    |   52 +
 .../virtualnetwork/model/NetworkACL.java        |  102 +
 .../virtualnetwork/model/ProtocolAclRule.java   |   43 +
 .../virtualnetwork/model/RemoteAccessVpn.java   |   98 +
 .../virtualnetwork/model/Site2SiteVpn.java      |  155 +
 .../virtualnetwork/model/StaticNatRule.java     |   82 +
 .../virtualnetwork/model/StaticNatRules.java    |   44 +
 .../virtualnetwork/model/StaticRoute.java       |   72 +
 .../virtualnetwork/model/StaticRoutes.java      |   44 +
 .../virtualnetwork/model/TcpAclRule.java        |   53 +
 .../virtualnetwork/model/UdpAclRule.java        |   53 +
 .../resource/virtualnetwork/model/VmData.java   |   54 +
 .../virtualnetwork/model/VmDhcpConfig.java      |  123 +
 .../virtualnetwork/model/VmPassword.java        |   52 +
 .../resource/virtualnetwork/model/VpnUser.java  |   62 +
 .../virtualnetwork/model/VpnUserList.java       |   44 +
 .../virtualnetwork/ConfigHelperTest.java        |  286 ++
 .../VirtualRoutingResourceTest.java             |   46 +-
 .../com/cloud/vm/VirtualMachineManagerImpl.java | 1593 ++++-----
 .../orchestration/NetworkOrchestrator.java      |    3 +-
 .../src/com/cloud/network/dao/NetworkDao.java   |    2 +
 .../com/cloud/network/dao/NetworkDaoImpl.java   |  234 +-
 .../src/com/cloud/network/dao/NetworkVO.java    |   20 +-
 .../com/cloud/network/vpc/VpcOfferingVO.java    |   15 +-
 .../schema/src/com/cloud/network/vpc/VpcVO.java |   38 +-
 .../com/cloud/upgrade/dao/Upgrade451to460.java  |   62 +-
 .../com/cloud/vm/dao/DomainRouterDaoImpl.java   |  162 +-
 .../schema/src/com/cloud/vm/dao/NicDaoImpl.java |    6 +-
 .../resource/HypervDirectConnectResource.java   |   41 +-
 .../agent/manager/MockNetworkManagerImpl.java   |    7 +-
 .../xenserver/resource/CitrixResourceBase.java  | 3288 +++++++++---------
 .../guru/BigSwitchVnsGuestNetworkGuru.java      |    2 +-
 .../contrail/management/ContrailGuru.java       |    2 +-
 .../management/ManagementNetworkGuru.java       |    2 +-
 .../network/guru/MidoNetGuestNetworkGuru.java   |    2 +-
 .../network/guru/MidoNetPublicNetworkGuru.java  |    4 +-
 .../network/guru/NiciraNvpGuestNetworkGuru.java |    2 +-
 .../network/guru/NuageVspGuestNetworkGuru.java  |    4 +-
 .../OpendaylightGuestNetworkGuru.java           |    2 +-
 .../network/guru/VxlanGuestNetworkGuru.java     |    2 +-
 .../spring-server-core-managers-context.xml     |    2 +
 server/src/com/cloud/api/ApiResponseHelper.java |    1 +
 .../network/element/VirtualRouterElement.java   |  294 +-
 .../element/VpcVirtualRouterElement.java        |  360 +-
 .../cloud/network/guru/ControlNetworkGuru.java  |    2 +-
 .../cloud/network/guru/DirectNetworkGuru.java   |    3 +-
 .../network/guru/ExternalGuestNetworkGuru.java  |    2 +-
 .../cloud/network/guru/GuestNetworkGuru.java    |   93 +-
 .../cloud/network/guru/PodBasedNetworkGuru.java |    3 +-
 .../cloud/network/guru/PrivateNetworkGuru.java  |    3 +-
 .../cloud/network/guru/PublicNetworkGuru.java   |    2 +-
 .../cloud/network/guru/StorageNetworkGuru.java  |    2 +-
 .../network/router/CommandSetupHelper.java      |  217 +-
 .../com/cloud/network/router/NetworkHelper.java |   17 +-
 .../cloud/network/router/NetworkHelperImpl.java |  244 +-
 .../cloud/network/router/NicProfileHelper.java  |    4 +-
 .../network/router/NicProfileHelperImpl.java    |   46 +-
 .../VirtualNetworkApplianceManagerImpl.java     |  309 +-
 .../network/router/VpcNetworkHelperImpl.java    |   40 +-
 .../VpcVirtualNetworkApplianceManagerImpl.java  |  487 ++-
 .../com/cloud/network/vpc/VpcManagerImpl.java   | 1213 ++++---
 .../VpcPrivateGatewayTransactionCallable.java   |   77 +
 .../cloud/server/ConfigurationServerImpl.java   |    2 +-
 .../topology/AdvancedNetworkTopology.java       |   35 +-
 .../topology/AdvancedNetworkVisitor.java        |   34 +-
 .../network/topology/BasicNetworkTopology.java  |   34 +-
 .../deployment/RouterDeploymentDefinition.java  |   45 +-
 .../RouterDeploymentDefinitionBuilder.java      |   17 +-
 .../VpcRouterDeploymentDefinition.java          |   67 +-
 .../cloud/network/CreatePrivateNetworkTest.java |    2 +-
 .../cloud/network/vpc/VpcManagerImplTest.java   |  107 +-
 .../MockVpcVirtualNetworkApplianceManager.java  |    4 +-
 server/test/com/cloud/vpc/VpcApiUnitTest.java   |    2 +-
 .../com/cloud/vpc/dao/MockNetworkDaoImpl.java   |   78 +-
 .../test/com/cloud/vpc/dao/MockVpcDaoImpl.java  |    4 +-
 .../network/lb/ApplicationLoadBalancerTest.java |    4 +-
 .../RouterDeploymentDefinitionTest.java         |  520 ++-
 .../RouterDeploymentDefinitionTestBase.java     |   14 +-
 .../VpcRouterDeploymentDefinitionTest.java      |   59 +-
 systemvm/cloudpatch-descriptor.xml              |   59 -
 .../patches/debian/config/etc/chef/node.json    |    5 +
 systemvm/patches/debian/config/etc/chef/solo.rb |    4 +
 .../debian/config/etc/init.d/cloud-early-config |   34 +-
 .../debian/config/etc/iptables/iptables-router  |    6 +-
 .../config/etc/iptables/iptables-vpcrouter      |    4 +-
 .../debian/config/opt/cloud/bin/baremetal-vr.py |    1 -
 .../debian/config/opt/cloud/bin/checkrouter.sh  |    8 +
 .../debian/config/opt/cloud/bin/configure.py    |  658 ++++
 .../debian/config/opt/cloud/bin/cs/CsAddress.py |  587 ++++
 .../debian/config/opt/cloud/bin/cs/CsApp.py     |  103 +
 .../debian/config/opt/cloud/bin/cs/CsConfig.py  |   98 +
 .../debian/config/opt/cloud/bin/cs/CsDatabag.py |  144 +
 .../debian/config/opt/cloud/bin/cs/CsDhcp.py    |  154 +
 .../debian/config/opt/cloud/bin/cs/CsFile.py    |  131 +
 .../config/opt/cloud/bin/cs/CsGuestNetwork.py   |   75 +
 .../debian/config/opt/cloud/bin/cs/CsHelper.py  |  208 ++
 .../config/opt/cloud/bin/cs/CsLoadBalancer.py   |   46 +
 .../debian/config/opt/cloud/bin/cs/CsMonitor.py |   43 +
 .../config/opt/cloud/bin/cs/CsNetfilter.py      |  291 ++
 .../debian/config/opt/cloud/bin/cs/CsProcess.py |   63 +
 .../config/opt/cloud/bin/cs/CsRedundant.py      |  301 ++
 .../debian/config/opt/cloud/bin/cs/CsRoute.py   |   58 +
 .../debian/config/opt/cloud/bin/cs/CsRule.py    |   44 +
 .../debian/config/opt/cloud/bin/cs/__init__.py  |   16 +
 .../debian/config/opt/cloud/bin/cs_cmdline.py   |   27 +
 .../debian/config/opt/cloud/bin/cs_dhcp.py      |   49 +
 .../config/opt/cloud/bin/cs_firewallrules.py    |   32 +
 .../config/opt/cloud/bin/cs_forwardingrules.py  |   79 +
 .../config/opt/cloud/bin/cs_guestnetwork.py     |   41 +
 .../debian/config/opt/cloud/bin/cs_ip.py        |   43 +
 .../config/opt/cloud/bin/cs_loadbalancer.py     |   27 +
 .../config/opt/cloud/bin/cs_monitorservice.py   |   26 +
 .../config/opt/cloud/bin/cs_network_acl.py      |   24 +
 .../config/opt/cloud/bin/cs_site2sitevpn.py     |   28 +
 .../debian/config/opt/cloud/bin/cs_vmdata.py    |   23 +
 .../debian/config/opt/cloud/bin/cs_vmp.py       |   27 +
 .../opt/cloud/bin/get_template_version.sh       |    2 +-
 .../patches/debian/config/opt/cloud/bin/ian.py  |   10 +
 .../debian/config/opt/cloud/bin/line_edit.py    |  199 ++
 .../debian/config/opt/cloud/bin/master.py       |   53 +
 .../debian/config/opt/cloud/bin/merge.py        |  254 ++
 .../debian/config/opt/cloud/bin/netusage.sh     |    6 +-
 .../config/opt/cloud/bin/passwd_server_ip       |    1 +
 .../config/opt/cloud/bin/patchsystemvm.sh       |   24 -
 .../config/opt/cloud/bin/set_redundant.py       |   47 +
 .../patches/debian/config/opt/cloud/bin/test.sh |    9 +
 .../config/opt/cloud/bin/update_config.py       |  140 +
 .../debian/config/opt/cloud/bin/vmdata.py       |   31 +-
 .../debian/config/opt/cloud/bin/vpc_netusage.sh |    4 +-
 .../config/opt/cloud/bin/vpc_passwd_server      |    2 +-
 .../debian/config/opt/cloud/templates/README    |    2 +
 .../cloud/templates/arping_gateways.sh.templ    |   29 +
 .../config/opt/cloud/templates/check_bumpup.sh  |   19 +
 .../cloud/templates/check_heartbeat.sh.templ    |   62 +
 .../opt/cloud/templates/checkrouter.sh.templ    |   60 +
 .../opt/cloud/templates/conntrackd.conf.templ   |  401 +++
 .../opt/cloud/templates/heartbeat.sh.templ      |   20 +
 .../opt/cloud/templates/keepalived.conf.templ   |   59 +
 .../debian/config/opt/cloud/testdata/README     |    1 +
 .../config/opt/cloud/testdata/acl0001.json      |   54 +
 .../config/opt/cloud/testdata/dhcp0001.json     |    9 +
 .../config/opt/cloud/testdata/gn0001.json       |   10 +
 .../config/opt/cloud/testdata/ips0001.json      |   12 +
 .../config/opt/cloud/testdata/ips0002.json      |   12 +
 .../config/opt/cloud/testdata/ips0003.json      |   12 +
 .../config/opt/cloud/testdata/s2s0001.json      |   16 +
 .../config/opt/cloud/testdata/vmp0001.json      |    1 +
 .../redundant_router/check_heartbeat.sh.templ   |   11 +-
 systemvm/test/python/TestCsAddress.py           |   25 +
 systemvm/test/python/TestCsApp.py               |   21 +
 systemvm/test/python/TestCsCmdLine.py           |   37 +
 systemvm/test/python/TestCsConfig.py            |   16 +
 systemvm/test/python/TestCsDatabag.py           |   16 +
 systemvm/test/python/TestCsDhcp.py              |   20 +
 systemvm/test/python/TestCsFile.py              |   16 +
 systemvm/test/python/TestCsGuestNetwork.py      |   27 +
 systemvm/test/python/TestCsHelper.py            |   18 +
 systemvm/test/python/TestCsInterface.py         |   24 +
 systemvm/test/python/TestCsNetfilter.py         |   16 +
 systemvm/test/python/TestCsProcess.py           |   16 +
 systemvm/test/python/TestCsRedundant.py         |   23 +
 systemvm/test/python/TestCsRoute.py             |   16 +
 systemvm/test/python/TestCsRule.py              |   16 +
 systemvm/test/python/runtests.sh                |   11 +
 .../integration/component/test_vpc_offerings.py |   80 +
 test/systemvm/README.md                         |   75 +
 test/systemvm/__init__.py                       |  224 ++
 test/systemvm/test_hello_systemvm.py            |   54 +
 test/systemvm/test_update_config.py             |  409 +++
 tools/appliance/.ruby-version                   |    1 +
 tools/appliance/Gemfile                         |    3 +-
 tools/appliance/README.md                       |    8 +-
 .../configure_persistent_config.sh              |   25 +
 .../definitions/systemvmtemplate/definition.rb  |    1 +
 .../install_systemvm_packages.sh                |    4 +-
 .../definitions/systemvmtemplate/preseed.cfg    |   41 +
 tools/appliance/vbox_vm_clean.rb                |    4 +
 tools/vagrant/devcloud/Vagrantfile              |  189 +
 .../vagrant/devcloud/templates/tmpl/1/1/README  |    1 +
 .../vagrant/devcloud/templates/tmpl/1/5/README  |    2 +
 tools/vagrant/systemvm/.gitignore               |   52 +
 tools/vagrant/systemvm/.ruby-version            |    1 +
 tools/vagrant/systemvm/.rvmrc                   |   24 +
 tools/vagrant/systemvm/Gemfile                  |   20 +
 tools/vagrant/systemvm/README.md                |   30 +
 tools/vagrant/systemvm/VBoxManage               |   41 +
 tools/vagrant/systemvm/Vagrantfile              |  123 +
 tools/vagrant/systemvm/test.sh                  |  213 ++
 tools/vagrant/systemvm/vagrant.pub              |    1 +
 ui/dictionary.jsp                               |    3 +
 ui/scripts/configuration.js                     |   15 +-
 ui/scripts/network.js                           |   84 +-
 262 files changed, 16561 insertions(+), 5645 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3c429ee6/ui/scripts/configuration.js
----------------------------------------------------------------------


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

Posted by bh...@apache.org.
Adding nre method to NetworkDao
  - listVpcNetworks() to be used for the router check task


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

Branch: refs/heads/master
Commit: 0a133c06f831067e8792e0f2068dbe960e8dce84
Parents: 6194b2c
Author: wilderrodrigues <wr...@schubergphilis.com>
Authored: Thu Feb 5 15:54:39 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:40:01 2015 +0100

----------------------------------------------------------------------
 .../src/com/cloud/network/dao/NetworkDao.java   |   2 +
 .../com/cloud/network/dao/NetworkDaoImpl.java   | 234 ++++++++++---------
 .../com/cloud/vm/dao/DomainRouterDaoImpl.java   | 162 ++++++-------
 .../VirtualNetworkApplianceManagerImpl.java     |  36 ++-
 .../com/cloud/vpc/dao/MockNetworkDaoImpl.java   |  78 ++++---
 5 files changed, 273 insertions(+), 239 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0a133c06/engine/schema/src/com/cloud/network/dao/NetworkDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/NetworkDao.java b/engine/schema/src/com/cloud/network/dao/NetworkDao.java
index 6d49b0a..037f776 100644
--- a/engine/schema/src/com/cloud/network/dao/NetworkDao.java
+++ b/engine/schema/src/com/cloud/network/dao/NetworkDao.java
@@ -112,6 +112,8 @@ public interface NetworkDao extends GenericDao<NetworkVO, Long>, StateDao<State,
 
     List<NetworkVO> listRedundantNetworks();
 
+    List<NetworkVO> listVpcNetworks();
+
     List<NetworkVO> listByAclId(long aclId);
 
     int getNonSystemNetworkCountByVpcId(long vpcId);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0a133c06/engine/schema/src/com/cloud/network/dao/NetworkDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/NetworkDaoImpl.java b/engine/schema/src/com/cloud/network/dao/NetworkDaoImpl.java
index 0c556c8..433eded 100644
--- a/engine/schema/src/com/cloud/network/dao/NetworkDaoImpl.java
+++ b/engine/schema/src/com/cloud/network/dao/NetworkDaoImpl.java
@@ -25,9 +25,8 @@ import javax.ejb.Local;
 import javax.inject.Inject;
 import javax.persistence.TableGenerator;
 
-import org.springframework.stereotype.Component;
-
 import org.apache.cloudstack.acl.ControlledEntity.ACLType;
+import org.springframework.stereotype.Component;
 
 import com.cloud.network.Network;
 import com.cloud.network.Network.Event;
@@ -116,7 +115,7 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
         AllFieldsSearch.and("broadcastUri", AllFieldsSearch.entity().getBroadcastUri(), Op.EQ);
         AllFieldsSearch.and("vpcId", AllFieldsSearch.entity().getVpcId(), Op.EQ);
         AllFieldsSearch.and("aclId", AllFieldsSearch.entity().getNetworkACLId(), Op.EQ);
-        SearchBuilder<NetworkOfferingVO> join1 = _ntwkOffDao.createSearchBuilder();
+        final SearchBuilder<NetworkOfferingVO> join1 = _ntwkOffDao.createSearchBuilder();
         join1.and("isSystem", join1.entity().isSystemOnly(), Op.EQ);
         join1.and("isRedundant", join1.entity().getRedundantRouter(), Op.EQ);
         AllFieldsSearch.join("offerings", join1, AllFieldsSearch.entity().getNetworkOfferingId(), join1.entity().getId(), JoinBuilder.JoinType.INNER);
@@ -124,7 +123,7 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
 
         AccountSearch = createSearchBuilder();
         AccountSearch.and("offering", AccountSearch.entity().getNetworkOfferingId(), Op.EQ);
-        SearchBuilder<NetworkAccountVO> join = _accountsDao.createSearchBuilder();
+        final SearchBuilder<NetworkAccountVO> join = _accountsDao.createSearchBuilder();
         join.and("account", join.entity().getAccountId(), Op.EQ);
         AccountSearch.join("accounts", join, AccountSearch.entity().getId(), join.entity().getNetworkId(), JoinBuilder.JoinType.INNER);
         AccountSearch.and("datacenter", AccountSearch.entity().getDataCenterId(), Op.EQ);
@@ -135,14 +134,14 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
         RelatedConfigSearch = createSearchBuilder();
         RelatedConfigSearch.and("offering", RelatedConfigSearch.entity().getNetworkOfferingId(), Op.EQ);
         RelatedConfigSearch.and("datacenter", RelatedConfigSearch.entity().getDataCenterId(), Op.EQ);
-        SearchBuilder<NetworkAccountVO> join2 = _accountsDao.createSearchBuilder();
+        final SearchBuilder<NetworkAccountVO> join2 = _accountsDao.createSearchBuilder();
         join2.and("account", join2.entity().getAccountId(), Op.EQ);
         RelatedConfigSearch.join("account", join2, join2.entity().getNetworkId(), RelatedConfigSearch.entity().getId(), JoinType.INNER);
         RelatedConfigSearch.done();
 
         AccountNetworkSearch = createSearchBuilder();
         AccountNetworkSearch.and("networkId", AccountNetworkSearch.entity().getId(), Op.EQ);
-        SearchBuilder<NetworkAccountVO> mapJoin = _accountsDao.createSearchBuilder();
+        final SearchBuilder<NetworkAccountVO> mapJoin = _accountsDao.createSearchBuilder();
         mapJoin.and("accountId", mapJoin.entity().getAccountId(), Op.EQ);
         AccountNetworkSearch.join("networkSearch", mapJoin, AccountNetworkSearch.entity().getId(), mapJoin.entity().getNetworkId(), JoinBuilder.JoinType.INNER);
         AccountNetworkSearch.done();
@@ -163,7 +162,7 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
 
         ZoneSecurityGroupSearch = createSearchBuilder();
         ZoneSecurityGroupSearch.and("dataCenterId", ZoneSecurityGroupSearch.entity().getDataCenterId(), Op.EQ);
-        SearchBuilder<NetworkServiceMapVO> offJoin = _ntwkSvcMap.createSearchBuilder();
+        final SearchBuilder<NetworkServiceMapVO> offJoin = _ntwkSvcMap.createSearchBuilder();
         offJoin.and("service", offJoin.entity().getService(), Op.EQ);
         ZoneSecurityGroupSearch.join("services", offJoin, ZoneSecurityGroupSearch.entity().getId(), offJoin.entity().getNetworkId(), JoinBuilder.JoinType.INNER);
         ZoneSecurityGroupSearch.done();
@@ -173,7 +172,7 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
         CountBy.and("offeringId", CountBy.entity().getNetworkOfferingId(), Op.EQ);
         CountBy.and("vpcId", CountBy.entity().getVpcId(), Op.EQ);
         CountBy.and("removed", CountBy.entity().getRemoved(), Op.NULL);
-        SearchBuilder<NetworkOfferingVO> ntwkOffJoin = _ntwkOffDao.createSearchBuilder();
+        final SearchBuilder<NetworkOfferingVO> ntwkOffJoin = _ntwkOffDao.createSearchBuilder();
         ntwkOffJoin.and("isSystem", ntwkOffJoin.entity().isSystemOnly(), Op.EQ);
         CountBy.join("offerings", ntwkOffJoin, CountBy.entity().getNetworkOfferingId(), ntwkOffJoin.entity().getId(), JoinBuilder.JoinType.INNER);
         CountBy.done();
@@ -183,7 +182,7 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
         PhysicalNetworkSearch.done();
 
         SecurityGroupSearch = createSearchBuilder();
-        SearchBuilder<NetworkServiceMapVO> join3 = _ntwkSvcMap.createSearchBuilder();
+        final SearchBuilder<NetworkServiceMapVO> join3 = _ntwkSvcMap.createSearchBuilder();
         join3.and("service", join3.entity().getService(), Op.EQ);
         SecurityGroupSearch.join("services", join3, SecurityGroupSearch.entity().getId(), join3.entity().getNetworkId(), JoinBuilder.JoinType.INNER);
         SecurityGroupSearch.done();
@@ -197,15 +196,15 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
         NetworksRegularUserCanCreateSearch.and("aclType", NetworksRegularUserCanCreateSearch.entity().getAclType(), Op.EQ);
         NetworksRegularUserCanCreateSearch.and("displayNetwork", NetworksRegularUserCanCreateSearch.entity().getDisplayNetwork(), Op.EQ);
         NetworksRegularUserCanCreateSearch.select(null, Func.COUNT, NetworksRegularUserCanCreateSearch.entity().getId());
-        SearchBuilder<NetworkAccountVO> join4 = _accountsDao.createSearchBuilder();
+        final SearchBuilder<NetworkAccountVO> join4 = _accountsDao.createSearchBuilder();
         join4.and("account", join4.entity().getAccountId(), Op.EQ);
         join4.and("isOwner", join4.entity().isOwner(), Op.EQ);
         NetworksRegularUserCanCreateSearch.join("accounts", join4, NetworksRegularUserCanCreateSearch.entity().getId(), join4.entity().getNetworkId(),
-            JoinBuilder.JoinType.INNER);
-        SearchBuilder<NetworkOfferingVO> join5 = _ntwkOffDao.createSearchBuilder();
+                JoinBuilder.JoinType.INNER);
+        final SearchBuilder<NetworkOfferingVO> join5 = _ntwkOffDao.createSearchBuilder();
         join5.and("specifyVlan", join5.entity().getSpecifyVlan(), Op.EQ);
         NetworksRegularUserCanCreateSearch.join("ntwkOff", join5, NetworksRegularUserCanCreateSearch.entity().getNetworkOfferingId(), join5.entity().getId(),
-            JoinBuilder.JoinType.INNER);
+                JoinBuilder.JoinType.INNER);
         NetworksRegularUserCanCreateSearch.done();
 
         _tgMacAddress = _tgs.get("macAddress");
@@ -214,7 +213,7 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
         SourceNATSearch.and("account", SourceNATSearch.entity().getAccountId(), Op.EQ);
         SourceNATSearch.and("datacenter", SourceNATSearch.entity().getDataCenterId(), Op.EQ);
         SourceNATSearch.and("guestType", SourceNATSearch.entity().getGuestType(), Op.EQ);
-        SearchBuilder<NetworkServiceMapVO> join6 = _ntwkSvcMap.createSearchBuilder();
+        final SearchBuilder<NetworkServiceMapVO> join6 = _ntwkSvcMap.createSearchBuilder();
         join6.and("service", join6.entity().getService(), Op.EQ);
         SourceNATSearch.join("services", join6, SourceNATSearch.entity().getId(), join6.entity().getNetworkId(), JoinBuilder.JoinType.INNER);
         SourceNATSearch.done();
@@ -222,33 +221,33 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
         VpcNetworksCount = createSearchBuilder(Long.class);
         VpcNetworksCount.and("vpcId", VpcNetworksCount.entity().getVpcId(), Op.EQ);
         VpcNetworksCount.select(null, Func.COUNT, VpcNetworksCount.entity().getId());
-        SearchBuilder<NetworkOfferingVO> join9 = _ntwkOffDao.createSearchBuilder();
+        final SearchBuilder<NetworkOfferingVO> join9 = _ntwkOffDao.createSearchBuilder();
         join9.and("isSystem", join9.entity().isSystemOnly(), Op.EQ);
         VpcNetworksCount.join("offerings", join9, VpcNetworksCount.entity().getNetworkOfferingId(), join9.entity().getId(), JoinBuilder.JoinType.INNER);
         VpcNetworksCount.done();
 
         OfferingAccountNetworkSearch = createSearchBuilder();
         OfferingAccountNetworkSearch.select(null, Func.DISTINCT, OfferingAccountNetworkSearch.entity().getId());
-        SearchBuilder<NetworkOfferingVO> ntwkOfferingJoin = _ntwkOffDao.createSearchBuilder();
+        final SearchBuilder<NetworkOfferingVO> ntwkOfferingJoin = _ntwkOffDao.createSearchBuilder();
         ntwkOfferingJoin.and("isSystem", ntwkOfferingJoin.entity().isSystemOnly(), Op.EQ);
         OfferingAccountNetworkSearch.join("ntwkOfferingSearch", ntwkOfferingJoin, OfferingAccountNetworkSearch.entity().getNetworkOfferingId(), ntwkOfferingJoin.entity()
-            .getId(), JoinBuilder.JoinType.LEFT);
-        SearchBuilder<NetworkAccountVO> ntwkAccountJoin = _accountsDao.createSearchBuilder();
+                .getId(), JoinBuilder.JoinType.LEFT);
+        final SearchBuilder<NetworkAccountVO> ntwkAccountJoin = _accountsDao.createSearchBuilder();
         ntwkAccountJoin.and("accountId", ntwkAccountJoin.entity().getAccountId(), Op.EQ);
         OfferingAccountNetworkSearch.join("ntwkAccountSearch", ntwkAccountJoin, OfferingAccountNetworkSearch.entity().getId(), ntwkAccountJoin.entity().getNetworkId(),
-            JoinBuilder.JoinType.INNER);
+                JoinBuilder.JoinType.INNER);
         OfferingAccountNetworkSearch.and("zoneId", OfferingAccountNetworkSearch.entity().getDataCenterId(), Op.EQ);
         OfferingAccountNetworkSearch.and("type", OfferingAccountNetworkSearch.entity().getGuestType(), Op.EQ);
         OfferingAccountNetworkSearch.done();
 
         GarbageCollectedSearch = createSearchBuilder(Long.class);
         GarbageCollectedSearch.selectFields(GarbageCollectedSearch.entity().getId());
-        SearchBuilder<NetworkOpVO> join7 = _ntwkOpDao.createSearchBuilder();
+        final SearchBuilder<NetworkOpVO> join7 = _ntwkOpDao.createSearchBuilder();
         join7.and("activenics", join7.entity().getActiveNicsCount(), Op.EQ);
         join7.and("gc", join7.entity().isGarbageCollected(), Op.EQ);
         join7.and("check", join7.entity().isCheckForGc(), Op.EQ);
         GarbageCollectedSearch.join("ntwkOpGC", join7, GarbageCollectedSearch.entity().getId(), join7.entity().getId(), JoinBuilder.JoinType.INNER);
-        SearchBuilder<NetworkOfferingVO> join8 = _ntwkOffDao.createSearchBuilder();
+        final SearchBuilder<NetworkOfferingVO> join8 = _ntwkOffDao.createSearchBuilder();
         join8.and("isPersistent", join8.entity().getIsPersistent(), Op.EQ);
         GarbageCollectedSearch.join("ntwkOffGC", join8, GarbageCollectedSearch.entity().getNetworkOfferingId(), join8.entity().getId(), JoinBuilder.JoinType.INNER);
         GarbageCollectedSearch.done();
@@ -256,8 +255,8 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
     }
 
     @Override
-    public List<NetworkVO> listByZoneAndGuestType(long accountId, long dataCenterId, Network.GuestType type, Boolean isSystem) {
-        SearchCriteria<NetworkVO> sc = AllFieldsSearch.create();
+    public List<NetworkVO> listByZoneAndGuestType(final long accountId, final long dataCenterId, final Network.GuestType type, final Boolean isSystem) {
+        final SearchCriteria<NetworkVO> sc = AllFieldsSearch.create();
         sc.setParameters("datacenter", dataCenterId);
         sc.setParameters("account", accountId);
         if (type != null) {
@@ -271,8 +270,8 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
         return listBy(sc, null);
     }
 
-    public List<NetworkVO> findBy(TrafficType trafficType, Mode mode, BroadcastDomainType broadcastType, long networkOfferingId, long dataCenterId) {
-        SearchCriteria<NetworkVO> sc = AllFieldsSearch.create();
+    public List<NetworkVO> findBy(final TrafficType trafficType, final Mode mode, final BroadcastDomainType broadcastType, final long networkOfferingId, final long dataCenterId) {
+        final SearchCriteria<NetworkVO> sc = AllFieldsSearch.create();
         sc.setParameters("trafficType", trafficType);
         sc.setParameters("broadcastType", broadcastType);
         sc.setParameters("offering", networkOfferingId);
@@ -282,8 +281,8 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
     }
 
     @Override
-    public List<NetworkVO> listBy(long accountId, long offeringId, long dataCenterId) {
-        SearchCriteria<NetworkVO> sc = AccountSearch.create();
+    public List<NetworkVO> listBy(final long accountId, final long offeringId, final long dataCenterId) {
+        final SearchCriteria<NetworkVO> sc = AccountSearch.create();
         sc.setParameters("offering", offeringId);
         sc.setJoinParameters("accounts", "account", accountId);
         sc.setParameters("datacenter", dataCenterId);
@@ -292,8 +291,8 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
     }
 
     @Override
-    public List<NetworkVO> listBy(long accountId, long dataCenterId, String cidr, boolean skipVpc) {
-        SearchCriteria<NetworkVO> sc = AccountSearch.create();
+    public List<NetworkVO> listBy(final long accountId, final long dataCenterId, final String cidr, final boolean skipVpc) {
+        final SearchCriteria<NetworkVO> sc = AccountSearch.create();
         sc.setJoinParameters("accounts", "account", accountId);
         sc.setParameters("datacenter", dataCenterId);
         sc.setParameters("cidr", cidr);
@@ -306,16 +305,16 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
 
     @Override
     @DB
-    public NetworkVO persist(NetworkVO network, boolean gc, Map<String, String> serviceProviderMap) {
-        TransactionLegacy txn = TransactionLegacy.currentTxn();
+    public NetworkVO persist(final NetworkVO network, final boolean gc, final Map<String, String> serviceProviderMap) {
+        final TransactionLegacy txn = TransactionLegacy.currentTxn();
         txn.start();
 
         // 1) create network
-        NetworkVO newNetwork = super.persist(network);
+        final NetworkVO newNetwork = super.persist(network);
         // 2) add account to the network
         addAccountToNetwork(network.getId(), network.getAccountId(), true);
         // 3) add network to gc monitor table
-        NetworkOpVO op = new NetworkOpVO(network.getId(), gc);
+        final NetworkOpVO op = new NetworkOpVO(network.getId(), gc);
         _opDao.persist(op);
         // 4) add services/providers for the network
         persistNetworkServiceProviders(newNetwork.getId(), serviceProviderMap);
@@ -326,8 +325,8 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
 
     @Override
     @DB
-    public boolean update(Long networkId, NetworkVO network, Map<String, String> serviceProviderMap) {
-        TransactionLegacy txn = TransactionLegacy.currentTxn();
+    public boolean update(final Long networkId, final NetworkVO network, final Map<String, String> serviceProviderMap) {
+        final TransactionLegacy txn = TransactionLegacy.currentTxn();
         txn.start();
 
         super.update(networkId, network);
@@ -342,18 +341,18 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
 
     @Override
     @DB
-    public void persistNetworkServiceProviders(long networkId, Map<String, String> serviceProviderMap) {
-        TransactionLegacy txn = TransactionLegacy.currentTxn();
+    public void persistNetworkServiceProviders(final long networkId, final Map<String, String> serviceProviderMap) {
+        final TransactionLegacy txn = TransactionLegacy.currentTxn();
         txn.start();
-        for (String service : serviceProviderMap.keySet()) {
-            NetworkServiceMapVO serviceMap = new NetworkServiceMapVO(networkId, Service.getService(service), Provider.getProvider(serviceProviderMap.get(service)));
+        for (final String service : serviceProviderMap.keySet()) {
+            final NetworkServiceMapVO serviceMap = new NetworkServiceMapVO(networkId, Service.getService(service), Provider.getProvider(serviceProviderMap.get(service)));
             _ntwkSvcMap.persist(serviceMap);
         }
         txn.commit();
     }
 
-    protected void addAccountToNetwork(long networkId, long accountId, boolean isOwner) {
-        NetworkAccountVO account = new NetworkAccountVO(networkId, accountId, isOwner);
+    protected void addAccountToNetwork(final long networkId, final long accountId, final boolean isOwner) {
+        final NetworkAccountVO account = new NetworkAccountVO(networkId, accountId, isOwner);
         _accountsDao.persist(account);
     }
 
@@ -363,8 +362,8 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
     }
 
     @Override
-    public List<NetworkVO> getNetworksForOffering(long offeringId, long dataCenterId, long accountId) {
-        SearchCriteria<NetworkVO> sc = RelatedConfigSearch.create();
+    public List<NetworkVO> getNetworksForOffering(final long offeringId, final long dataCenterId, final long accountId) {
+        final SearchCriteria<NetworkVO> sc = RelatedConfigSearch.create();
         sc.setParameters("offering", offeringId);
         sc.setParameters("dc", dataCenterId);
         sc.setJoinParameters("account", "account", accountId);
@@ -372,26 +371,26 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
     }
 
     @Override
-    public String getNextAvailableMacAddress(long networkConfigId) {
-        SequenceFetcher fetch = SequenceFetcher.getInstance();
+    public String getNextAvailableMacAddress(final long networkConfigId) {
+        final SequenceFetcher fetch = SequenceFetcher.getInstance();
 
         long seq = fetch.getNextSequence(Long.class, _tgMacAddress, networkConfigId);
-        seq = seq | _prefix << 40 | ((_rand.nextInt(Short.MAX_VALUE) << 16) & 0x00000000ffff0000l);
+        seq = seq | _prefix << 40 | _rand.nextInt(Short.MAX_VALUE) << 16 & 0x00000000ffff0000l;
         return NetUtils.long2Mac(seq);
     }
 
     @Override
-    public List<NetworkVO> listBy(long accountId, long networkId) {
-        SearchCriteria<NetworkVO> sc = AccountNetworkSearch.create();
+    public List<NetworkVO> listBy(final long accountId, final long networkId) {
+        final SearchCriteria<NetworkVO> sc = AccountNetworkSearch.create();
         sc.setParameters("networkId", networkId);
         sc.setJoinParameters("networkSearch", "accountId", accountId);
         return listBy(sc);
     }
 
     @Override
-    public long countByZoneAndUri(long zoneId, String broadcastUri) {
+    public long countByZoneAndUri(final long zoneId, final String broadcastUri) {
 
-        SearchCriteria<Long> sc = CountByZoneAndURI.create();
+        final SearchCriteria<Long> sc = CountByZoneAndURI.create();
         sc.setParameters("dataCenterId", zoneId);
         sc.setParameters("broadcastUri", broadcastUri);
 
@@ -399,15 +398,15 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
     }
 
     @Override
-    public List<NetworkVO> listByZone(long zoneId) {
-        SearchCriteria<NetworkVO> sc = ZoneBroadcastUriSearch.create();
+    public List<NetworkVO> listByZone(final long zoneId) {
+        final SearchCriteria<NetworkVO> sc = ZoneBroadcastUriSearch.create();
         sc.setParameters("dataCenterId", zoneId);
         return search(sc, null);
     }
 
     @Override
-    public long countByZoneUriAndGuestType(long zoneId, String broadcastUri, GuestType guestType) {
-        SearchCriteria<Long> sc = CountByZoneAndURI.create();
+    public long countByZoneUriAndGuestType(final long zoneId, final String broadcastUri, final GuestType guestType) {
+        final SearchCriteria<Long> sc = CountByZoneAndURI.create();
         sc.setParameters("dataCenterId", zoneId);
         sc.setParameters("broadcastUri", broadcastUri);
         sc.setParameters("guestType", guestType);
@@ -415,8 +414,8 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
     }
 
     @Override
-    public List<NetworkVO> listByZoneSecurityGroup(Long zoneId) {
-        SearchCriteria<NetworkVO> sc = ZoneSecurityGroupSearch.create();
+    public List<NetworkVO> listByZoneSecurityGroup(final Long zoneId) {
+        final SearchCriteria<NetworkVO> sc = ZoneSecurityGroupSearch.create();
         if (zoneId != null) {
             sc.setParameters("dataCenterId", zoneId);
         }
@@ -425,18 +424,18 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
     }
 
     @Override
-    public void changeActiveNicsBy(long networkId, int count) {
+    public void changeActiveNicsBy(final long networkId, final int count) {
         _opDao.changeActiveNicsBy(networkId, count);
     }
 
     @Override
-    public int getActiveNicsIn(long networkId) {
+    public int getActiveNicsIn(final long networkId) {
         return _opDao.getActiveNics(networkId);
     }
 
     @Override
     public List<Long> findNetworksToGarbageCollect() {
-        SearchCriteria<Long> sc = GarbageCollectedSearch.create();
+        final SearchCriteria<Long> sc = GarbageCollectedSearch.create();
         sc.setJoinParameters("ntwkOffGC", "isPersistent", false);
         sc.setJoinParameters("ntwkOpGC", "activenics", 0);
         sc.setJoinParameters("ntwkOpGC", "gc", true);
@@ -445,73 +444,73 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
     }
 
     @Override
-    public void clearCheckForGc(long networkId) {
+    public void clearCheckForGc(final long networkId) {
         _opDao.clearCheckForGc(networkId);
     }
 
     @Override
-    public void setCheckForGc(long networkId) {
+    public void setCheckForGc(final long networkId) {
         _opDao.setCheckForGc(networkId);
     }
 
     @Override
-    public List<NetworkVO> listByOwner(long ownerId) {
-        SearchCriteria<NetworkVO> sc = AllFieldsSearch.create();
+    public List<NetworkVO> listByOwner(final long ownerId) {
+        final SearchCriteria<NetworkVO> sc = AllFieldsSearch.create();
         sc.setParameters("account", ownerId);
         return listBy(sc);
     }
 
     @Override
-    public void addDomainToNetwork(long networkId, long domainId, Boolean subdomainAccess) {
+    public void addDomainToNetwork(final long networkId, final long domainId, final Boolean subdomainAccess) {
         addDomainToNetworknetwork(networkId, domainId, subdomainAccess);
     }
 
-    protected void addDomainToNetworknetwork(long networkId, long domainId, Boolean subdomainAccess) {
-        NetworkDomainVO domain = new NetworkDomainVO(networkId, domainId, subdomainAccess);
+    protected void addDomainToNetworknetwork(final long networkId, final long domainId, final Boolean subdomainAccess) {
+        final NetworkDomainVO domain = new NetworkDomainVO(networkId, domainId, subdomainAccess);
         _domainsDao.persist(domain);
     }
 
     @Override
-    public int getNetworkCountByVpcId(long vpcId) {
-        SearchCriteria<Integer> sc = CountBy.create();
+    public int getNetworkCountByVpcId(final long vpcId) {
+        final SearchCriteria<Integer> sc = CountBy.create();
         sc.setParameters("vpcId", vpcId);
-        List<Integer> results = customSearch(sc, null);
+        final List<Integer> results = customSearch(sc, null);
         return results.get(0);
     }
 
     @Override
     public List<NetworkVO> listSecurityGroupEnabledNetworks() {
-        SearchCriteria<NetworkVO> sc = SecurityGroupSearch.create();
+        final SearchCriteria<NetworkVO> sc = SecurityGroupSearch.create();
         sc.setJoinParameters("services", "service", Service.SecurityGroup.getName());
         return listBy(sc);
     }
 
     @Override
-    public List<NetworkVO> listByPhysicalNetwork(long physicalNetworkId) {
-        SearchCriteria<NetworkVO> sc = PhysicalNetworkSearch.create();
+    public List<NetworkVO> listByPhysicalNetwork(final long physicalNetworkId) {
+        final SearchCriteria<NetworkVO> sc = PhysicalNetworkSearch.create();
         sc.setParameters("physicalNetworkId", physicalNetworkId);
         return listBy(sc);
     }
 
     @Override
-    public List<NetworkVO> listByPhysicalNetworkTrafficType(long physicalNetworkId, TrafficType trafficType) {
-        SearchCriteria<NetworkVO> sc = AllFieldsSearch.create();
+    public List<NetworkVO> listByPhysicalNetworkTrafficType(final long physicalNetworkId, final TrafficType trafficType) {
+        final SearchCriteria<NetworkVO> sc = AllFieldsSearch.create();
         sc.setParameters("trafficType", trafficType);
         sc.setParameters("physicalNetworkId", physicalNetworkId);
         return listBy(sc);
     }
 
     @Override
-    public List<NetworkVO> listByPhysicalNetworkAndProvider(long physicalNetworkId, String providerName) {
-        SearchBuilder<NetworkServiceMapVO> svcProviderMapSearch = _ntwkSvcMap.createSearchBuilder();
-        NetworkServiceMapVO svcProviderEntry = svcProviderMapSearch.entity();
+    public List<NetworkVO> listByPhysicalNetworkAndProvider(final long physicalNetworkId, final String providerName) {
+        final SearchBuilder<NetworkServiceMapVO> svcProviderMapSearch = _ntwkSvcMap.createSearchBuilder();
+        final NetworkServiceMapVO svcProviderEntry = svcProviderMapSearch.entity();
         svcProviderMapSearch.and("Provider", svcProviderMapSearch.entity().getProvider(), SearchCriteria.Op.EQ);
 
-        SearchBuilder<NetworkVO> networksSearch = createSearchBuilder();
+        final SearchBuilder<NetworkVO> networksSearch = createSearchBuilder();
         networksSearch.and("physicalNetworkId", networksSearch.entity().getPhysicalNetworkId(), Op.EQ);
         networksSearch.join("svcProviderMapSearch", svcProviderMapSearch, networksSearch.entity().getId(), svcProviderEntry.getNetworkId(), JoinBuilder.JoinType.INNER);
 
-        SearchCriteria<NetworkVO> sc = networksSearch.create();
+        final SearchCriteria<NetworkVO> sc = networksSearch.create();
         sc.setJoinParameters("svcProviderMapSearch", "Provider", providerName);
         sc.setParameters("physicalNetworkId", physicalNetworkId);
 
@@ -519,8 +518,8 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
     }
 
     @Override
-    public List<NetworkVO> listBy(long accountId, long dataCenterId, Network.GuestType type, TrafficType trafficType) {
-        SearchCriteria<NetworkVO> sc = AllFieldsSearch.create();
+    public List<NetworkVO> listBy(final long accountId, final long dataCenterId, final Network.GuestType type, final TrafficType trafficType) {
+        final SearchCriteria<NetworkVO> sc = AllFieldsSearch.create();
         sc.setParameters("datacenter", dataCenterId);
         sc.setParameters("account", accountId);
         sc.setParameters("guestType", type);
@@ -530,8 +529,8 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
     }
 
     @Override
-    public List<NetworkVO> listByZoneAndTrafficType(long zoneId, TrafficType trafficType) {
-        SearchCriteria<NetworkVO> sc = AllFieldsSearch.create();
+    public List<NetworkVO> listByZoneAndTrafficType(final long zoneId, final TrafficType trafficType) {
+        final SearchCriteria<NetworkVO> sc = AllFieldsSearch.create();
         sc.setParameters("datacenter", zoneId);
         sc.setParameters("trafficType", trafficType);
 
@@ -539,16 +538,16 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
     }
 
     @Override
-    public int getNetworkCountByNetworkOffId(long networkOfferingId) {
-        SearchCriteria<Integer> sc = NetworksCount.create();
+    public int getNetworkCountByNetworkOffId(final long networkOfferingId) {
+        final SearchCriteria<Integer> sc = NetworksCount.create();
         sc.setParameters("networkOfferingId", networkOfferingId);
-        List<Integer> count = customSearch(sc, null);
+        final List<Integer> count = customSearch(sc, null);
         return count.get(0);
     }
 
     @Override
-    public long countNetworksUserCanCreate(long ownerId) {
-        SearchCriteria<Long> sc = NetworksRegularUserCanCreateSearch.create();
+    public long countNetworksUserCanCreate(final long ownerId) {
+        final SearchCriteria<Long> sc = NetworksRegularUserCanCreateSearch.create();
         sc.setParameters("aclType", ACLType.Account);
         sc.setParameters("displayNetwork", 1);
         sc.setJoinParameters("accounts", "account", ownerId);
@@ -557,8 +556,8 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
     }
 
     @Override
-    public List<NetworkVO> listSourceNATEnabledNetworks(long accountId, long dataCenterId, Network.GuestType type) {
-        SearchCriteria<NetworkVO> sc = SourceNATSearch.create();
+    public List<NetworkVO> listSourceNATEnabledNetworks(final long accountId, final long dataCenterId, final Network.GuestType type) {
+        final SearchCriteria<NetworkVO> sc = SourceNATSearch.create();
         sc.setParameters("datacenter", dataCenterId);
         sc.setParameters("account", accountId);
         sc.setParameters("guestType", type);
@@ -567,19 +566,19 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
     }
 
     @Override
-    public List<NetworkVO> listByVpc(long vpcId) {
-        SearchCriteria<NetworkVO> sc = AllFieldsSearch.create();
+    public List<NetworkVO> listByVpc(final long vpcId) {
+        final SearchCriteria<NetworkVO> sc = AllFieldsSearch.create();
         sc.setParameters("vpcId", vpcId);
 
         return listBy(sc, null);
     }
 
     @Override
-    public NetworkVO getPrivateNetwork(String broadcastUri, String cidr, long accountId, long zoneId, Long networkOfferingId) {
+    public NetworkVO getPrivateNetwork(final String broadcastUri, final String cidr, final long accountId, final long zoneId, Long networkOfferingId) {
         if (networkOfferingId == null) {
             networkOfferingId = _ntwkOffDao.findByUniqueName(NetworkOffering.SystemPrivateGatewayNetworkOffering).getId();
         }
-        SearchCriteria<NetworkVO> sc = AllFieldsSearch.create();
+        final SearchCriteria<NetworkVO> sc = AllFieldsSearch.create();
         sc.setParameters("datacenter", zoneId);
         sc.setParameters("broadcastUri", broadcastUri);
         sc.setParameters("cidr", cidr);
@@ -590,21 +589,21 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
 
     @Override
     @DB
-    public boolean remove(Long id) {
-        TransactionLegacy txn = TransactionLegacy.currentTxn();
+    public boolean remove(final Long id) {
+        final TransactionLegacy txn = TransactionLegacy.currentTxn();
         txn.start();
-        NetworkVO entry = findById(id);
+        final NetworkVO entry = findById(id);
         if (entry != null) {
             _tagsDao.removeByIdAndType(id, ResourceObjectType.Network);
         }
-        boolean result = super.remove(id);
+        final boolean result = super.remove(id);
         txn.commit();
         return result;
     }
 
     @Override
-    public long countVpcNetworks(long vpcId) {
-        SearchCriteria<Long> sc = VpcNetworksCount.create();
+    public long countVpcNetworks(final long vpcId) {
+        final SearchCriteria<Long> sc = VpcNetworksCount.create();
         sc.setParameters("vpcId", vpcId);
         //offering shouldn't be system (the one used by the private gateway)
         sc.setJoinParameters("offerings", "isSystem", false);
@@ -612,12 +611,12 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
     }
 
     @Override
-    public boolean updateState(State currentState, Event event, State nextState, Network vo, Object data) {
+    public boolean updateState(final State currentState, final Event event, final State nextState, final Network vo, final Object data) {
         // TODO: ensure this update is correct
-        TransactionLegacy txn = TransactionLegacy.currentTxn();
+        final TransactionLegacy txn = TransactionLegacy.currentTxn();
         txn.start();
 
-        NetworkVO networkVo = (NetworkVO)vo;
+        final NetworkVO networkVo = (NetworkVO)vo;
         networkVo.setState(nextState);
         super.update(networkVo.getId(), networkVo);
 
@@ -626,38 +625,49 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
     }
 
     @Override
-    public List<NetworkVO> listNetworksByAccount(long accountId, long zoneId, Network.GuestType type, boolean isSystem) {
-        SearchCriteria<NetworkVO> sc = OfferingAccountNetworkSearch.create();
+    public List<NetworkVO> listNetworksByAccount(final long accountId, final long zoneId, final Network.GuestType type, final boolean isSystem) {
+        final SearchCriteria<NetworkVO> sc = OfferingAccountNetworkSearch.create();
         sc.setJoinParameters("ntwkOfferingSearch", "isSystem", isSystem);
         sc.setJoinParameters("ntwkAccountSearch", "accountId", accountId);
         sc.setParameters("zoneId", zoneId);
         sc.setParameters("type", type);
 
-        List<NetworkVO> networks = search(sc, null);
+        final List<NetworkVO> networks = search(sc, null);
         return networks;
     }
 
     @Override
     public List<NetworkVO> listRedundantNetworks() {
-        SearchCriteria<NetworkVO> sc = AllFieldsSearch.create();
+        final SearchCriteria<NetworkVO> sc = AllFieldsSearch.create();
         sc.setJoinParameters("offerings", "isRedundant", true);
         return listBy(sc, null);
     }
 
     @Override
-    public List<NetworkVO> listByAclId(long aclId) {
-        SearchCriteria<NetworkVO> sc = AllFieldsSearch.create();
+    public List<NetworkVO> listVpcNetworks() {
+        final SearchBuilder<NetworkVO> sb = createSearchBuilder();
+        sb.and("vpcId", sb.entity().getVpcId(), Op.NNULL);
+        sb.done();
+
+        final SearchCriteria<NetworkVO> sc = sb.create();
+
+        return listBy(sc);
+    }
+
+    @Override
+    public List<NetworkVO> listByAclId(final long aclId) {
+        final SearchCriteria<NetworkVO> sc = AllFieldsSearch.create();
         sc.setParameters("aclId", aclId);
 
         return listBy(sc, null);
     }
 
     @Override
-    public int getNonSystemNetworkCountByVpcId(long vpcId) {
-        SearchCriteria<Integer> sc = CountBy.create();
+    public int getNonSystemNetworkCountByVpcId(final long vpcId) {
+        final SearchCriteria<Integer> sc = CountBy.create();
         sc.setParameters("vpcId", vpcId);
         sc.setJoinParameters("offerings", "isSystem", false);
-        List<Integer> results = customSearch(sc, null);
+        final List<Integer> results = customSearch(sc, null);
         return results.get(0);
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0a133c06/engine/schema/src/com/cloud/vm/dao/DomainRouterDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/vm/dao/DomainRouterDaoImpl.java b/engine/schema/src/com/cloud/vm/dao/DomainRouterDaoImpl.java
index fca1ff8..9f4d17a 100644
--- a/engine/schema/src/com/cloud/vm/dao/DomainRouterDaoImpl.java
+++ b/engine/schema/src/com/cloud/vm/dao/DomainRouterDaoImpl.java
@@ -85,7 +85,7 @@ public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO, Long> im
         AllFieldsSearch.and("lastHost", AllFieldsSearch.entity().getLastHostId(), Op.EQ);
         AllFieldsSearch.and("state", AllFieldsSearch.entity().getState(), Op.EQ);
         AllFieldsSearch.and("states", AllFieldsSearch.entity().getState(), Op.IN);
-        SearchBuilder<RouterNetworkVO> joinRouterNetwork = _routerNetworkDao.createSearchBuilder();
+        final SearchBuilder<RouterNetworkVO> joinRouterNetwork = _routerNetworkDao.createSearchBuilder();
         joinRouterNetwork.and("networkId", joinRouterNetwork.entity().getNetworkId(), Op.EQ);
         AllFieldsSearch.join("networkRouter", joinRouterNetwork, joinRouterNetwork.entity().getRouterId(), AllFieldsSearch.entity().getId(), JoinType.INNER);
         AllFieldsSearch.and("podId", AllFieldsSearch.entity().getPodIdToDeployIn(), Op.EQ);
@@ -100,10 +100,10 @@ public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO, Long> im
 
         IdNetworkIdStatesSearch = createSearchBuilder();
         IdNetworkIdStatesSearch.and("id", IdNetworkIdStatesSearch.entity().getId(), Op.EQ);
-        SearchBuilder<RouterNetworkVO> joinRouterNetwork1 = _routerNetworkDao.createSearchBuilder();
+        final SearchBuilder<RouterNetworkVO> joinRouterNetwork1 = _routerNetworkDao.createSearchBuilder();
         joinRouterNetwork1.and("networkId", joinRouterNetwork1.entity().getNetworkId(), Op.EQ);
         IdNetworkIdStatesSearch.join("networkRouter", joinRouterNetwork1, joinRouterNetwork1.entity().getRouterId(), IdNetworkIdStatesSearch.entity().getId(),
-            JoinType.INNER);
+                JoinType.INNER);
         IdNetworkIdStatesSearch.and("states", IdNetworkIdStatesSearch.entity().getState(), Op.IN);
         IdNetworkIdStatesSearch.done();
 
@@ -111,7 +111,7 @@ public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO, Long> im
         HostUpSearch.select(null, Func.DISTINCT, HostUpSearch.entity().getId());
         HostUpSearch.and("host", HostUpSearch.entity().getHostId(), Op.EQ);
         HostUpSearch.and("states", HostUpSearch.entity().getState(), Op.NIN);
-        SearchBuilder<RouterNetworkVO> joinRouterNetwork3 = _routerNetworkDao.createSearchBuilder();
+        final SearchBuilder<RouterNetworkVO> joinRouterNetwork3 = _routerNetworkDao.createSearchBuilder();
         joinRouterNetwork3.and("networkId", joinRouterNetwork3.entity().getNetworkId(), Op.EQ);
         joinRouterNetwork3.and("type", joinRouterNetwork3.entity().getGuestType(), Op.EQ);
         HostUpSearch.join("networkRouter", joinRouterNetwork3, joinRouterNetwork3.entity().getRouterId(), HostUpSearch.entity().getId(), JoinType.INNER);
@@ -120,13 +120,13 @@ public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO, Long> im
         StateNetworkTypeSearch = createSearchBuilder();
         StateNetworkTypeSearch.select(null, Func.DISTINCT, StateNetworkTypeSearch.entity().getId());
         StateNetworkTypeSearch.and("state", StateNetworkTypeSearch.entity().getState(), Op.EQ);
-        SearchBuilder<RouterNetworkVO> joinRouterNetwork4 = _routerNetworkDao.createSearchBuilder();
+        final SearchBuilder<RouterNetworkVO> joinRouterNetwork4 = _routerNetworkDao.createSearchBuilder();
         joinRouterNetwork4.and("networkId", joinRouterNetwork4.entity().getNetworkId(), Op.EQ);
         joinRouterNetwork4.and("type", joinRouterNetwork4.entity().getGuestType(), Op.EQ);
         StateNetworkTypeSearch.join("networkRouter", joinRouterNetwork4, joinRouterNetwork4.entity().getRouterId(), StateNetworkTypeSearch.entity().getId(),
-            JoinType.INNER);
+                JoinType.INNER);
 
-        SearchBuilder<HostVO> joinHost = _hostsDao.createSearchBuilder();
+        final SearchBuilder<HostVO> joinHost = _hostsDao.createSearchBuilder();
         joinHost.and("mgmtServerId", joinHost.entity().getManagementServerId(), Op.EQ);
         StateNetworkTypeSearch.join("host", joinHost, joinHost.entity().getId(), StateNetworkTypeSearch.entity().getHostId(), JoinType.INNER);
         StateNetworkTypeSearch.done();
@@ -134,13 +134,13 @@ public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO, Long> im
         SearchByStateAndManagementServerId = createSearchBuilder();
         SearchByStateAndManagementServerId.and("state", SearchByStateAndManagementServerId.entity().getState(), Op.EQ);
 
-        SearchBuilder<HostVO> joinHost2 = _hostsDao.createSearchBuilder();
+        final SearchBuilder<HostVO> joinHost2 = _hostsDao.createSearchBuilder();
         joinHost2.and("mgmtServerId", joinHost2.entity().getManagementServerId(), Op.EQ);
         SearchByStateAndManagementServerId.join("host", joinHost2, joinHost2.entity().getId(), SearchByStateAndManagementServerId.entity().getHostId(), JoinType.INNER);
         SearchByStateAndManagementServerId.done();
 
         OutsidePodSearch = createSearchBuilder();
-        SearchBuilder<RouterNetworkVO> joinRouterNetwork2 = _routerNetworkDao.createSearchBuilder();
+        final SearchBuilder<RouterNetworkVO> joinRouterNetwork2 = _routerNetworkDao.createSearchBuilder();
         joinRouterNetwork2.and("networkId", joinRouterNetwork2.entity().getNetworkId(), Op.EQ);
         OutsidePodSearch.join("networkRouter", joinRouterNetwork2, joinRouterNetwork2.entity().getRouterId(), OutsidePodSearch.entity().getId(), JoinType.INNER);
         OutsidePodSearch.and("podId", OutsidePodSearch.entity().getPodIdToDeployIn(), Op.NEQ);
@@ -150,7 +150,7 @@ public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO, Long> im
 
         clusterSearch = createSearchBuilder();
         clusterSearch.and("state", clusterSearch.entity().getState(), Op.EQ);
-        SearchBuilder<HostVO> clusterHost = _hostsDao.createSearchBuilder();
+        final SearchBuilder<HostVO> clusterHost = _hostsDao.createSearchBuilder();
         clusterHost.and("clusterId", clusterHost.entity().getClusterId(), Op.EQ);
         clusterSearch.join("host", clusterHost, clusterSearch.entity().getHostId(), clusterHost.entity().getId(), JoinType.INNER);
         clusterSearch.done();
@@ -165,30 +165,30 @@ public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO, Long> im
     }
 
     @Override
-    public boolean remove(Long id) {
-        TransactionLegacy txn = TransactionLegacy.currentTxn();
+    public boolean remove(final Long id) {
+        final TransactionLegacy txn = TransactionLegacy.currentTxn();
         txn.start();
-        DomainRouterVO router = createForUpdate();
+        final DomainRouterVO router = createForUpdate();
         router.setPublicIpAddress(null);
-        UpdateBuilder ub = getUpdateBuilder(router);
+        final UpdateBuilder ub = getUpdateBuilder(router);
         ub.set(router, "state", State.Destroyed);
         update(id, ub, router);
 
-        boolean result = super.remove(id);
+        final boolean result = super.remove(id);
         txn.commit();
         return result;
     }
 
     @Override
-    public List<DomainRouterVO> listByDataCenter(long dcId) {
-        SearchCriteria<DomainRouterVO> sc = AllFieldsSearch.create();
+    public List<DomainRouterVO> listByDataCenter(final long dcId) {
+        final SearchCriteria<DomainRouterVO> sc = AllFieldsSearch.create();
         sc.setParameters("dc", dcId);
         return listBy(sc);
     }
 
     @Override
-    public List<DomainRouterVO> findBy(long accountId, long dcId) {
-        SearchCriteria<DomainRouterVO> sc = AllFieldsSearch.create();
+    public List<DomainRouterVO> findBy(final long accountId, final long dcId) {
+        final SearchCriteria<DomainRouterVO> sc = AllFieldsSearch.create();
         sc.setParameters("account", accountId);
         sc.setParameters("dc", dcId);
         sc.setParameters("role", Role.VIRTUAL_ROUTER);
@@ -196,8 +196,8 @@ public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO, Long> im
     }
 
     @Override
-    public List<DomainRouterVO> findBy(long accountId, long dcId, Role role) {
-        SearchCriteria<DomainRouterVO> sc = AllFieldsSearch.create();
+    public List<DomainRouterVO> findBy(final long accountId, final long dcId, final Role role) {
+        final SearchCriteria<DomainRouterVO> sc = AllFieldsSearch.create();
         sc.setParameters("account", accountId);
         sc.setParameters("dc", dcId);
         sc.setParameters("role", role);
@@ -205,106 +205,106 @@ public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO, Long> im
     }
 
     @Override
-    public List<DomainRouterVO> listBy(long accountId) {
-        SearchCriteria<DomainRouterVO> sc = AllFieldsSearch.create();
+    public List<DomainRouterVO> listBy(final long accountId) {
+        final SearchCriteria<DomainRouterVO> sc = AllFieldsSearch.create();
         sc.setParameters("account", accountId);
         return listBy(sc);
     }
 
     @Override
-    public List<DomainRouterVO> listByHostId(Long hostId) {
-        SearchCriteria<DomainRouterVO> sc = AllFieldsSearch.create();
+    public List<DomainRouterVO> listByHostId(final Long hostId) {
+        final SearchCriteria<DomainRouterVO> sc = AllFieldsSearch.create();
         sc.setParameters("host", hostId);
         return listBy(sc);
     }
 
     @Override
-    public List<DomainRouterVO> listRunningByPodId(Long podId) {
-        SearchCriteria<DomainRouterVO> sc = RunningSearch.create();
+    public List<DomainRouterVO> listRunningByPodId(final Long podId) {
+        final SearchCriteria<DomainRouterVO> sc = RunningSearch.create();
         sc.setParameters("state", State.Running);
         sc.setParameters("podId", podId);
         return listBy(sc);
     }
 
     @Override
-    public List<DomainRouterVO> listRunningByClusterId(Long clusterId) {
-        SearchCriteria<DomainRouterVO> sc = clusterSearch.create();
+    public List<DomainRouterVO> listRunningByClusterId(final Long clusterId) {
+        final SearchCriteria<DomainRouterVO> sc = clusterSearch.create();
         sc.setParameters("state", State.Running);
         sc.setJoinParameters("host", "clusterId", clusterId);
         return listBy(sc);
     }
 
     @Override
-    public List<DomainRouterVO> listByPodIdAndStates(Long podId, State... states) {
-        SearchCriteria<DomainRouterVO> sc = AllFieldsSearch.create();
+    public List<DomainRouterVO> listByPodIdAndStates(final Long podId, final State... states) {
+        final SearchCriteria<DomainRouterVO> sc = AllFieldsSearch.create();
         sc.setParameters("podId", podId);
         sc.setParameters("states", (Object[])states);
         return listBy(sc);
     }
 
     @Override
-    public List<DomainRouterVO> listIsolatedByHostId(Long hostId) {
-        SearchCriteria<DomainRouterVO> sc = HostUpSearch.create();
+    public List<DomainRouterVO> listIsolatedByHostId(final Long hostId) {
+        final SearchCriteria<DomainRouterVO> sc = HostUpSearch.create();
         if (hostId != null) {
             sc.setParameters("host", hostId);
         }
         sc.setJoinParameters("networkRouter", "type", Network.GuestType.Isolated);
-        List<DomainRouterVO> routerIds = listBy(sc);
-        List<DomainRouterVO> routers = new ArrayList<DomainRouterVO>();
-        for (DomainRouterVO router : routerIds) {
+        final List<DomainRouterVO> routerIds = listBy(sc);
+        final List<DomainRouterVO> routers = new ArrayList<DomainRouterVO>();
+        for (final DomainRouterVO router : routerIds) {
             routers.add(findById(router.getId()));
         }
         return routers;
     }
 
     @Override
-    public List<DomainRouterVO> listRunningByDomain(Long domainId) {
-        SearchCriteria<DomainRouterVO> sc = RunningSearch.create();
+    public List<DomainRouterVO> listRunningByDomain(final Long domainId) {
+        final SearchCriteria<DomainRouterVO> sc = RunningSearch.create();
         sc.setParameters("state", State.Running);
         sc.setParameters("domainId", domainId);
         return listBy(sc);
     }
 
     @Override
-    public List<DomainRouterVO> findByNetwork(long networkId) {
-        SearchCriteria<DomainRouterVO> sc = AllFieldsSearch.create();
+    public List<DomainRouterVO> findByNetwork(final long networkId) {
+        final SearchCriteria<DomainRouterVO> sc = AllFieldsSearch.create();
         sc.setJoinParameters("networkRouter", "networkId", networkId);
         return listBy(sc);
     }
 
     @Override
-    public List<DomainRouterVO> listByLastHostId(Long hostId) {
-        SearchCriteria<DomainRouterVO> sc = AllFieldsSearch.create();
+    public List<DomainRouterVO> listByLastHostId(final Long hostId) {
+        final SearchCriteria<DomainRouterVO> sc = AllFieldsSearch.create();
         sc.setParameters("lastHost", hostId);
         sc.setParameters("state", State.Stopped);
         return listBy(sc);
     }
 
     @Override
-    public List<DomainRouterVO> listActive(long networkId) {
-        SearchCriteria<DomainRouterVO> sc = IdNetworkIdStatesSearch.create();
+    public List<DomainRouterVO> listActive(final long networkId) {
+        final SearchCriteria<DomainRouterVO> sc = IdNetworkIdStatesSearch.create();
         sc.setJoinParameters("networkRouter", "networkId", networkId);
         sc.setParameters("states", State.Running, State.Migrating, State.Stopping, State.Starting);
         return listBy(sc);
     }
 
     @Override
-    public List<DomainRouterVO> listByStateAndNetworkType(State state, Network.GuestType type, long mgmtSrvrId) {
-        SearchCriteria<DomainRouterVO> sc = StateNetworkTypeSearch.create();
+    public List<DomainRouterVO> listByStateAndNetworkType(final State state, final Network.GuestType type, final long mgmtSrvrId) {
+        final SearchCriteria<DomainRouterVO> sc = StateNetworkTypeSearch.create();
         sc.setParameters("state", state);
         sc.setJoinParameters("networkRouter", "type", type);
         sc.setJoinParameters("host", "mgmtServerId", mgmtSrvrId);
-        List<DomainRouterVO> routerIds = listBy(sc);
-        List<DomainRouterVO> routers = new ArrayList<DomainRouterVO>();
-        for (DomainRouterVO router : routerIds) {
+        final List<DomainRouterVO> routerIds = listBy(sc);
+        final List<DomainRouterVO> routers = new ArrayList<DomainRouterVO>();
+        for (final DomainRouterVO router : routerIds) {
             routers.add(findById(router.getId()));
         }
         return routers;
     }
 
     @Override
-    public List<DomainRouterVO> listByStateAndManagementServer(State state, long mgmtSrvrId) {
-        SearchCriteria<DomainRouterVO> sc = SearchByStateAndManagementServerId.create();
+    public List<DomainRouterVO> listByStateAndManagementServer(final State state, final long mgmtSrvrId) {
+        final SearchCriteria<DomainRouterVO> sc = SearchByStateAndManagementServerId.create();
         sc.setParameters("state", state);
         sc.setJoinParameters("host", "mgmtServerId", mgmtSrvrId);
 
@@ -312,8 +312,8 @@ public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO, Long> im
     }
 
     @Override
-    public List<DomainRouterVO> findByNetworkOutsideThePod(long networkId, long podId, State state, Role role) {
-        SearchCriteria<DomainRouterVO> sc = OutsidePodSearch.create();
+    public List<DomainRouterVO> findByNetworkOutsideThePod(final long networkId, final long podId, final State state, final Role role) {
+        final SearchCriteria<DomainRouterVO> sc = OutsidePodSearch.create();
         sc.setJoinParameters("networkRouter", "networkId", networkId);
         sc.setParameters("podId", podId);
         sc.setParameters("state", state);
@@ -322,8 +322,8 @@ public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO, Long> im
     }
 
     @Override
-    public List<DomainRouterVO> listByNetworkAndPodAndRole(long networkId, long podId, Role role) {
-        SearchCriteria<DomainRouterVO> sc = AllFieldsSearch.create();
+    public List<DomainRouterVO> listByNetworkAndPodAndRole(final long networkId, final long podId, final Role role) {
+        final SearchCriteria<DomainRouterVO> sc = AllFieldsSearch.create();
         sc.setJoinParameters("networkRouter", "networkId", networkId);
         sc.setParameters("podId", podId);
         sc.setParameters("role", role);
@@ -331,32 +331,32 @@ public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO, Long> im
     }
 
     @Override
-    public List<DomainRouterVO> listByNetworkAndRole(long networkId, Role role) {
-        SearchCriteria<DomainRouterVO> sc = AllFieldsSearch.create();
+    public List<DomainRouterVO> listByNetworkAndRole(final long networkId, final Role role) {
+        final SearchCriteria<DomainRouterVO> sc = AllFieldsSearch.create();
         sc.setJoinParameters("networkRouter", "networkId", networkId);
         sc.setParameters("role", role);
         return listBy(sc);
     }
 
     @Override
-    public List<DomainRouterVO> listByElementId(long elementId) {
-        SearchCriteria<DomainRouterVO> sc = AllFieldsSearch.create();
+    public List<DomainRouterVO> listByElementId(final long elementId) {
+        final SearchCriteria<DomainRouterVO> sc = AllFieldsSearch.create();
         sc.setParameters("elementId", elementId);
         return listBy(sc);
     }
 
     @Override
     @DB
-    public DomainRouterVO persist(DomainRouterVO router, List<Network> guestNetworks) {
-        TransactionLegacy txn = TransactionLegacy.currentTxn();
+    public DomainRouterVO persist(final DomainRouterVO router, final List<Network> guestNetworks) {
+        final TransactionLegacy txn = TransactionLegacy.currentTxn();
         txn.start();
 
         // 1) create network
-        DomainRouterVO newRouter = super.persist(router);
+        final DomainRouterVO newRouter = super.persist(router);
 
         if (guestNetworks != null && !guestNetworks.isEmpty()) {
             // 2) add router to the network
-            for (Network guestNetwork : guestNetworks) {
+            for (final Network guestNetwork : guestNetworks) {
                 addRouterToGuestNetwork(router, guestNetwork);
             }
         }
@@ -367,21 +367,21 @@ public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO, Long> im
 
     @Override
     @DB
-    public void addRouterToGuestNetwork(VirtualRouter router, Network guestNetwork) {
+    public void addRouterToGuestNetwork(final VirtualRouter router, final Network guestNetwork) {
         if (_routerNetworkDao.findByRouterAndNetwork(router.getId(), guestNetwork.getId()) == null) {
-            NetworkOffering off = _offDao.findById(guestNetwork.getNetworkOfferingId());
-            if (!(off.getName().equalsIgnoreCase(NetworkOffering.SystemPrivateGatewayNetworkOffering))) {
-                TransactionLegacy txn = TransactionLegacy.currentTxn();
+            final NetworkOffering off = _offDao.findById(guestNetwork.getNetworkOfferingId());
+            if (!off.getName().equalsIgnoreCase(NetworkOffering.SystemPrivateGatewayNetworkOffering)) {
+                final TransactionLegacy txn = TransactionLegacy.currentTxn();
                 txn.start();
                 //1) add router to network
-                RouterNetworkVO routerNtwkMap = new RouterNetworkVO(router.getId(), guestNetwork.getId(), guestNetwork.getGuestType());
+                final RouterNetworkVO routerNtwkMap = new RouterNetworkVO(router.getId(), guestNetwork.getId(), guestNetwork.getGuestType());
                 _routerNetworkDao.persist(routerNtwkMap);
                 //2) create user stats entry for the network
                 UserStatisticsVO stats =
-                    _userStatsDao.findBy(router.getAccountId(), router.getDataCenterId(), guestNetwork.getId(), null, router.getId(), router.getType().toString());
+                        _userStatsDao.findBy(router.getAccountId(), router.getDataCenterId(), guestNetwork.getId(), null, router.getId(), router.getType().toString());
                 if (stats == null) {
                     stats =
-                        new UserStatisticsVO(router.getAccountId(), router.getDataCenterId(), null, router.getId(), router.getType().toString(), guestNetwork.getId());
+                            new UserStatisticsVO(router.getAccountId(), router.getDataCenterId(), null, router.getId(), router.getType().toString(), guestNetwork.getId());
                     _userStatsDao.persist(stats);
                 }
                 txn.commit();
@@ -390,45 +390,45 @@ public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO, Long> im
     }
 
     @Override
-    public void removeRouterFromGuestNetwork(long routerId, long guestNetworkId) {
-        RouterNetworkVO routerNtwkMap = _routerNetworkDao.findByRouterAndNetwork(routerId, guestNetworkId);
+    public void removeRouterFromGuestNetwork(final long routerId, final long guestNetworkId) {
+        final RouterNetworkVO routerNtwkMap = _routerNetworkDao.findByRouterAndNetwork(routerId, guestNetworkId);
         if (routerNtwkMap != null) {
             _routerNetworkDao.remove(routerNtwkMap.getId());
         }
     }
 
     @Override
-    public List<Long> getRouterNetworks(long routerId) {
+    public List<Long> getRouterNetworks(final long routerId) {
         return _routerNetworkDao.getRouterNetworks(routerId);
     }
 
     @Override
-    public List<DomainRouterVO> listByVpcId(long vpcId) {
-        SearchCriteria<DomainRouterVO> sc = VpcSearch.create();
+    public List<DomainRouterVO> listByVpcId(final long vpcId) {
+        final SearchCriteria<DomainRouterVO> sc = VpcSearch.create();
         sc.setParameters("vpcId", vpcId);
         sc.setParameters("role", Role.VIRTUAL_ROUTER);
         return listBy(sc);
     }
 
     @Override
-    public List<DomainRouterVO> listRunningByAccountId(long accountId) {
-        SearchCriteria<DomainRouterVO> sc = RunningSearch.create();
+    public List<DomainRouterVO> listRunningByAccountId(final long accountId) {
+        final SearchCriteria<DomainRouterVO> sc = RunningSearch.create();
         sc.setParameters("state", State.Running);
         sc.setParameters("account", accountId);
         return listBy(sc);
     }
 
     @Override
-    public List<DomainRouterVO> listRunningByDataCenter(long dcId) {
-        SearchCriteria<DomainRouterVO> sc = RunningSearch.create();
+    public List<DomainRouterVO> listRunningByDataCenter(final long dcId) {
+        final SearchCriteria<DomainRouterVO> sc = RunningSearch.create();
         sc.setParameters("state", State.Running);
         sc.setParameters("dc", dcId);
         return listBy(sc);
     }
 
     @Override
-    public List<DomainRouterVO> listStopped(long networkId) {
-        SearchCriteria<DomainRouterVO> sc = IdNetworkIdStatesSearch.create();
+    public List<DomainRouterVO> listStopped(final long networkId) {
+        final SearchCriteria<DomainRouterVO> sc = IdNetworkIdStatesSearch.create();
         sc.setJoinParameters("networkRouter", "networkId", networkId);
         sc.setParameters("states", State.Stopped);
         return listBy(sc);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0a133c06/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 61fa918..1ad7a9f 100644
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -1137,9 +1137,17 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
         protected void runInContext() {
             while (true) {
                 try {
-                    final Long networkId = _vrUpdateQueue.take();
-                    // This is a blocking call so this thread won't run all the time if no work item in queue.
-                    final List<DomainRouterVO> routers = _routerDao.listByNetworkAndRole(networkId, Role.VIRTUAL_ROUTER);
+                    final Long networkId = _vrUpdateQueue.take(); // This is a blocking call so this thread won't run all the time if no work item in queue.
+
+                    final NetworkVO network = _networkDao.findById(networkId);
+                    final Long vpcId = network.getVpcId();
+
+                    final List<DomainRouterVO> routers;
+                    if (vpcId != null) {
+                        routers = _routerDao.listByVpcId(vpcId);
+                    } else {
+                        routers = _routerDao.listByNetworkAndRole(networkId, Role.VIRTUAL_ROUTER);
+                    }
 
                     if (routers.size() != 2) {
                         continue;
@@ -1189,18 +1197,26 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
 
                 updateSite2SiteVpnConnectionState(routers);
 
-                final List<NetworkVO> networks = _networkDao.listRedundantNetworks();
+                List<NetworkVO> networks = _networkDao.listVpcNetworks();
+                s_logger.debug("Found " + networks.size() + " VPC networks to update Redundant State. ");
+                pushToUpdateQueue(networks);
+
+                networks = _networkDao.listRedundantNetworks();
                 s_logger.debug("Found " + networks.size() + " networks to update RvR status. ");
-                for (final NetworkVO network : networks) {
-                    if (!_vrUpdateQueue.offer(network.getId(), 500, TimeUnit.MILLISECONDS)) {
-                        s_logger.warn("Cannot insert into virtual router update queue! Adjustment of router.check.interval and router.check.poolsize maybe needed.");
-                        break;
-                    }
-                }
+                pushToUpdateQueue(networks);
             } catch (final Exception ex) {
                 s_logger.error("Fail to complete the CheckRouterTask! ", ex);
             }
         }
+
+        protected void pushToUpdateQueue(final List<NetworkVO> networks) throws InterruptedException {
+            for (final NetworkVO network : networks) {
+                if (!_vrUpdateQueue.offer(network.getId(), 500, TimeUnit.MILLISECONDS)) {
+                    s_logger.warn("Cannot insert into virtual router update queue! Adjustment of router.check.interval and router.check.poolsize maybe needed.");
+                    break;
+                }
+            }
+        }
     }
 
     protected class CheckRouterAlertsTask extends ManagedContextRunnable {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0a133c06/server/test/com/cloud/vpc/dao/MockNetworkDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vpc/dao/MockNetworkDaoImpl.java b/server/test/com/cloud/vpc/dao/MockNetworkDaoImpl.java
index 0b22db4..cf4fc35 100644
--- a/server/test/com/cloud/vpc/dao/MockNetworkDaoImpl.java
+++ b/server/test/com/cloud/vpc/dao/MockNetworkDaoImpl.java
@@ -40,7 +40,7 @@ public class MockNetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implemen
      * @see com.cloud.network.dao.NetworkDao#listByOwner(long)
      */
     @Override
-    public List<NetworkVO> listByOwner(long ownerId) {
+    public List<NetworkVO> listByOwner(final long ownerId) {
         // TODO Auto-generated method stub
         return null;
     }
@@ -49,7 +49,7 @@ public class MockNetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implemen
      * @see com.cloud.network.dao.NetworkDao#listBy(long, long, long)
      */
     @Override
-    public List<NetworkVO> listBy(long accountId, long offeringId, long dataCenterId) {
+    public List<NetworkVO> listBy(final long accountId, final long offeringId, final long dataCenterId) {
         // TODO Auto-generated method stub
         return null;
     }
@@ -58,7 +58,7 @@ public class MockNetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implemen
      * @see com.cloud.network.dao.NetworkDao#listBy(long, long, java.lang.String, boolean)
      */
     @Override
-    public List<NetworkVO> listBy(long accountId, long dataCenterId, String cidr, boolean skipVpc) {
+    public List<NetworkVO> listBy(final long accountId, final long dataCenterId, final String cidr, final boolean skipVpc) {
         // TODO Auto-generated method stub
         return null;
     }
@@ -67,7 +67,7 @@ public class MockNetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implemen
      * @see com.cloud.network.dao.NetworkDao#listByZoneAndGuestType(long, long, com.cloud.network.Network.GuestType, java.lang.Boolean)
      */
     @Override
-    public List<NetworkVO> listByZoneAndGuestType(long accountId, long dataCenterId, GuestType type, Boolean isSystem) {
+    public List<NetworkVO> listByZoneAndGuestType(final long accountId, final long dataCenterId, final GuestType type, final Boolean isSystem) {
         // TODO Auto-generated method stub
         return null;
     }
@@ -76,7 +76,7 @@ public class MockNetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implemen
      * @see com.cloud.network.dao.NetworkDao#persist(com.cloud.network.NetworkVO, boolean, java.util.Map)
      */
     @Override
-    public NetworkVO persist(NetworkVO network, boolean gc, Map<String, String> serviceProviderMap) {
+    public NetworkVO persist(final NetworkVO network, final boolean gc, final Map<String, String> serviceProviderMap) {
         // TODO Auto-generated method stub
         return null;
     }
@@ -94,7 +94,7 @@ public class MockNetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implemen
      * @see com.cloud.network.dao.NetworkDao#getNetworksForOffering(long, long, long)
      */
     @Override
-    public List<NetworkVO> getNetworksForOffering(long offeringId, long dataCenterId, long accountId) {
+    public List<NetworkVO> getNetworksForOffering(final long offeringId, final long dataCenterId, final long accountId) {
         // TODO Auto-generated method stub
         return null;
     }
@@ -103,7 +103,7 @@ public class MockNetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implemen
      * @see com.cloud.network.dao.NetworkDao#getNextAvailableMacAddress(long)
      */
     @Override
-    public String getNextAvailableMacAddress(long networkConfigId) {
+    public String getNextAvailableMacAddress(final long networkConfigId) {
         // TODO Auto-generated method stub
         return null;
     }
@@ -112,7 +112,7 @@ public class MockNetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implemen
      * @see com.cloud.network.dao.NetworkDao#listBy(long, long)
      */
     @Override
-    public List<NetworkVO> listBy(long accountId, long networkId) {
+    public List<NetworkVO> listBy(final long accountId, final long networkId) {
         // TODO Auto-generated method stub
         return null;
     }
@@ -121,7 +121,7 @@ public class MockNetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implemen
      * @see com.cloud.network.dao.NetworkDao#countByZoneAndUri(long, java.lang.String)
      */
     @Override
-    public long countByZoneAndUri(long zoneId, String broadcastUri) {
+    public long countByZoneAndUri(final long zoneId, final String broadcastUri) {
         // TODO Auto-generated method stub
         return 0;
     }
@@ -130,7 +130,7 @@ public class MockNetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implemen
      * @see com.cloud.network.dao.NetworkDao#countByZoneUriAndGuestType(long, java.lang.String, com.cloud.network.Network.GuestType)
      */
     @Override
-    public long countByZoneUriAndGuestType(long zoneId, String broadcastUri, GuestType guestType) {
+    public long countByZoneUriAndGuestType(final long zoneId, final String broadcastUri, final GuestType guestType) {
         // TODO Auto-generated method stub
         return 0;
     }
@@ -139,7 +139,7 @@ public class MockNetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implemen
      * @see com.cloud.network.dao.NetworkDao#listByZone(long)
      */
     @Override
-    public List<NetworkVO> listByZone(long zoneId) {
+    public List<NetworkVO> listByZone(final long zoneId) {
         // TODO Auto-generated method stub
         return null;
     }
@@ -148,7 +148,7 @@ public class MockNetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implemen
      * @see com.cloud.network.dao.NetworkDao#changeActiveNicsBy(long, int)
      */
     @Override
-    public void changeActiveNicsBy(long networkId, int nicsCount) {
+    public void changeActiveNicsBy(final long networkId, final int nicsCount) {
         // TODO Auto-generated method stub
 
     }
@@ -157,7 +157,7 @@ public class MockNetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implemen
      * @see com.cloud.network.dao.NetworkDao#getActiveNicsIn(long)
      */
     @Override
-    public int getActiveNicsIn(long networkId) {
+    public int getActiveNicsIn(final long networkId) {
         // TODO Auto-generated method stub
         return 0;
     }
@@ -175,7 +175,7 @@ public class MockNetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implemen
      * @see com.cloud.network.dao.NetworkDao#clearCheckForGc(long)
      */
     @Override
-    public void clearCheckForGc(long networkId) {
+    public void clearCheckForGc(final long networkId) {
         // TODO Auto-generated method stub
 
     }
@@ -184,7 +184,7 @@ public class MockNetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implemen
      * @see com.cloud.network.dao.NetworkDao#listByZoneSecurityGroup(java.lang.Long)
      */
     @Override
-    public List<NetworkVO> listByZoneSecurityGroup(Long zoneId) {
+    public List<NetworkVO> listByZoneSecurityGroup(final Long zoneId) {
         // TODO Auto-generated method stub
         return null;
     }
@@ -193,7 +193,7 @@ public class MockNetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implemen
      * @see com.cloud.network.dao.NetworkDao#addDomainToNetwork(long, long, java.lang.Boolean)
      */
     @Override
-    public void addDomainToNetwork(long networkId, long domainId, Boolean subdomainAccess) {
+    public void addDomainToNetwork(final long networkId, final long domainId, final Boolean subdomainAccess) {
         // TODO Auto-generated method stub
 
     }
@@ -202,7 +202,7 @@ public class MockNetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implemen
      * @see com.cloud.network.dao.NetworkDao#listByPhysicalNetwork(long)
      */
     @Override
-    public List<NetworkVO> listByPhysicalNetwork(long physicalNetworkId) {
+    public List<NetworkVO> listByPhysicalNetwork(final long physicalNetworkId) {
         // TODO Auto-generated method stub
         return null;
     }
@@ -220,7 +220,7 @@ public class MockNetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implemen
      * @see com.cloud.network.dao.NetworkDao#listByPhysicalNetworkTrafficType(long, com.cloud.network.Networks.TrafficType)
      */
     @Override
-    public List<NetworkVO> listByPhysicalNetworkTrafficType(long physicalNetworkId, TrafficType trafficType) {
+    public List<NetworkVO> listByPhysicalNetworkTrafficType(final long physicalNetworkId, final TrafficType trafficType) {
         // TODO Auto-generated method stub
         return null;
     }
@@ -229,7 +229,7 @@ public class MockNetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implemen
      * @see com.cloud.network.dao.NetworkDao#listBy(long, long, com.cloud.network.Network.GuestType, com.cloud.network.Networks.TrafficType)
      */
     @Override
-    public List<NetworkVO> listBy(long accountId, long dataCenterId, GuestType type, TrafficType trafficType) {
+    public List<NetworkVO> listBy(final long accountId, final long dataCenterId, final GuestType type, final TrafficType trafficType) {
         // TODO Auto-generated method stub
         return null;
     }
@@ -238,7 +238,7 @@ public class MockNetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implemen
      * @see com.cloud.network.dao.NetworkDao#listByPhysicalNetworkAndProvider(long, java.lang.String)
      */
     @Override
-    public List<NetworkVO> listByPhysicalNetworkAndProvider(long physicalNetworkId, String providerName) {
+    public List<NetworkVO> listByPhysicalNetworkAndProvider(final long physicalNetworkId, final String providerName) {
         // TODO Auto-generated method stub
         return null;
     }
@@ -247,7 +247,7 @@ public class MockNetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implemen
      * @see com.cloud.network.dao.NetworkDao#persistNetworkServiceProviders(long, java.util.Map)
      */
     @Override
-    public void persistNetworkServiceProviders(long networkId, Map<String, String> serviceProviderMap) {
+    public void persistNetworkServiceProviders(final long networkId, final Map<String, String> serviceProviderMap) {
         // TODO Auto-generated method stub
 
     }
@@ -256,7 +256,7 @@ public class MockNetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implemen
      * @see com.cloud.network.dao.NetworkDao#update(java.lang.Long, com.cloud.network.NetworkVO, java.util.Map)
      */
     @Override
-    public boolean update(Long networkId, NetworkVO network, Map<String, String> serviceProviderMap) {
+    public boolean update(final Long networkId, final NetworkVO network, final Map<String, String> serviceProviderMap) {
         // TODO Auto-generated method stub
         return false;
     }
@@ -265,7 +265,7 @@ public class MockNetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implemen
      * @see com.cloud.network.dao.NetworkDao#listByZoneAndTrafficType(long, com.cloud.network.Networks.TrafficType)
      */
     @Override
-    public List<NetworkVO> listByZoneAndTrafficType(long zoneId, TrafficType trafficType) {
+    public List<NetworkVO> listByZoneAndTrafficType(final long zoneId, final TrafficType trafficType) {
         // TODO Auto-generated method stub
         return null;
     }
@@ -274,7 +274,7 @@ public class MockNetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implemen
      * @see com.cloud.network.dao.NetworkDao#setCheckForGc(long)
      */
     @Override
-    public void setCheckForGc(long networkId) {
+    public void setCheckForGc(final long networkId) {
         // TODO Auto-generated method stub
 
     }
@@ -283,7 +283,7 @@ public class MockNetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implemen
      * @see com.cloud.network.dao.NetworkDao#getNetworkCountByNetworkOffId(long)
      */
     @Override
-    public int getNetworkCountByNetworkOffId(long networkOfferingId) {
+    public int getNetworkCountByNetworkOffId(final long networkOfferingId) {
         // TODO Auto-generated method stub
         return 0;
     }
@@ -292,7 +292,7 @@ public class MockNetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implemen
      * @see com.cloud.network.dao.NetworkDao#countNetworksUserCanCreate(long)
      */
     @Override
-    public long countNetworksUserCanCreate(long ownerId) {
+    public long countNetworksUserCanCreate(final long ownerId) {
         // TODO Auto-generated method stub
         return 0;
     }
@@ -301,7 +301,7 @@ public class MockNetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implemen
      * @see com.cloud.network.dao.NetworkDao#listSourceNATEnabledNetworks(long, long, com.cloud.network.Network.GuestType)
      */
     @Override
-    public List<NetworkVO> listSourceNATEnabledNetworks(long accountId, long dataCenterId, GuestType type) {
+    public List<NetworkVO> listSourceNATEnabledNetworks(final long accountId, final long dataCenterId, final GuestType type) {
         // TODO Auto-generated method stub
         return null;
     }
@@ -310,7 +310,7 @@ public class MockNetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implemen
      * @see com.cloud.network.dao.NetworkDao#getNetworkCountByVpcId(long)
      */
     @Override
-    public int getNetworkCountByVpcId(long vpcId) {
+    public int getNetworkCountByVpcId(final long vpcId) {
         // TODO Auto-generated method stub
         return 0;
     }
@@ -319,8 +319,8 @@ public class MockNetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implemen
      * @see com.cloud.network.dao.NetworkDao#listByVpc(long)
      */
     @Override
-    public List<NetworkVO> listByVpc(long vpcId) {
-        List<NetworkVO> networks = new ArrayList<NetworkVO>();
+    public List<NetworkVO> listByVpc(final long vpcId) {
+        final List<NetworkVO> networks = new ArrayList<NetworkVO>();
         networks.add(new NetworkVO());
         return networks;
     }
@@ -329,7 +329,7 @@ public class MockNetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implemen
      * @see com.cloud.network.dao.NetworkDao#getPrivateNetwork(java.lang.String, java.lang.String, long, long)
      */
     @Override
-    public NetworkVO getPrivateNetwork(String broadcastUri, String cidr, long accountId, long zoneId, Long netofferid) {
+    public NetworkVO getPrivateNetwork(final String broadcastUri, final String cidr, final long accountId, final long zoneId, final Long netofferid) {
         // TODO Auto-generated method stub
         return null;
     }
@@ -338,13 +338,13 @@ public class MockNetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implemen
      * @see com.cloud.network.dao.NetworkDao#countVpcNetworks(long)
      */
     @Override
-    public long countVpcNetworks(long vpcId) {
+    public long countVpcNetworks(final long vpcId) {
         // TODO Auto-generated method stub
         return 0;
     }
 
     @Override
-    public boolean updateState(Network.State currentState, Network.Event event, Network.State nextState, Network vo, Object data) {
+    public boolean updateState(final Network.State currentState, final Network.Event event, final Network.State nextState, final Network vo, final Object data) {
         return true;
     }
 
@@ -352,7 +352,7 @@ public class MockNetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implemen
      * @see com.cloud.network.dao.NetworkDao#listNetworksByAccount(long, long, com.cloud.network.Network.GuestType, boolean)
      */
     @Override
-    public List<NetworkVO> listNetworksByAccount(long accountId, long zoneId, GuestType type, boolean isSystem) {
+    public List<NetworkVO> listNetworksByAccount(final long accountId, final long zoneId, final GuestType type, final boolean isSystem) {
         // TODO Auto-generated method stub
         return null;
     }
@@ -364,12 +364,18 @@ public class MockNetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implemen
     }
 
     @Override
-    public List<NetworkVO> listByAclId(long aclId) {
+    public List<NetworkVO> listVpcNetworks() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public List<NetworkVO> listByAclId(final long aclId) {
         return null;
     }
 
     @Override
-    public int getNonSystemNetworkCountByVpcId(long vpcId) {
+    public int getNonSystemNetworkCountByVpcId(final long vpcId) {
         return 0;
     }
 }


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

Posted by bh...@apache.org.
Another correction


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

Branch: refs/heads/master
Commit: c828653a0ab816f18b7cd14540d753a9ee00f8b3
Parents: 267bc52
Author: Ian Southam <is...@schubergphilis.com>
Authored: Wed Jan 28 17:36:56 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:39:54 2015 +0100

----------------------------------------------------------------------
 systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c828653a/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 94faeb6..2fa4160 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
@@ -107,8 +107,7 @@ class CsRedundant(object):
         file.greplace("[RROUTER_BIN_PATH]", self.CS_ROUTER_DIR)
 # If there is no guest network still bring up the public interface
 # Maybe necessary for things like VPNs and private gateways
-        if self.address.get_guest_if():
-            file.section("virtual_ipaddress {", "}", self._collect_ips())
+        file.section("virtual_ipaddress {", "}", self._collect_ips())
         # if self.cl.get_state() == 'MASTER':
             # file.search(" priority ", "    priority %s" % 100)
         file.commit()


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

Posted by bh...@apache.org.
Fix array index problems on the ACL command.


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

Branch: refs/heads/master
Commit: 159088cb9044d09d4bddf3b4cf93b493f21828fe
Parents: c828653
Author: wilderrodrigues <wr...@schubergphilis.com>
Authored: Thu Jan 29 14:55:06 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:39:55 2015 +0100

----------------------------------------------------------------------
 .../facade/SetNetworkAclConfigItem.java               | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/159088cb/core/src/com/cloud/agent/resource/virtualnetwork/facade/SetNetworkAclConfigItem.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/resource/virtualnetwork/facade/SetNetworkAclConfigItem.java b/core/src/com/cloud/agent/resource/virtualnetwork/facade/SetNetworkAclConfigItem.java
index d1afb7c..7247766 100644
--- a/core/src/com/cloud/agent/resource/virtualnetwork/facade/SetNetworkAclConfigItem.java
+++ b/core/src/com/cloud/agent/resource/virtualnetwork/facade/SetNetworkAclConfigItem.java
@@ -22,6 +22,8 @@ package com.cloud.agent.resource.virtualnetwork.facade;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.log4j.Logger;
+
 import com.cloud.agent.api.routing.NetworkElementCommand;
 import com.cloud.agent.api.routing.SetNetworkACLCommand;
 import com.cloud.agent.api.to.NicTO;
@@ -39,6 +41,8 @@ import com.cloud.utils.net.NetUtils;
 
 public class SetNetworkAclConfigItem extends AbstractConfigItemFacade {
 
+    public static final Logger s_logger = Logger.getLogger(SetNetworkAclConfigItem.class.getName());
+
     @Override
     public List<ConfigItem> generateConfig(final NetworkElementCommand cmd) {
         final SetNetworkACLCommand command = (SetNetworkACLCommand) cmd;
@@ -71,7 +75,15 @@ public class SetNetworkAclConfigItem extends AbstractConfigItemFacade {
                 aclRule = new AllAclRule(ruleParts[4], "ACCEPT".equals(ruleParts[5]));
                 break;
             default:
-                aclRule = new ProtocolAclRule(ruleParts[4], "ACCEPT".equals(ruleParts[5]), Integer.parseInt(ruleParts[1]));
+                // Fuzzy logic in cloudstack: if we do not handle it here, it will throw an exception and work okay (with a stack trace on the console).
+                // If we check the size of the array, it will fail to setup the network.
+                // So, let's catch the exception and continue in the loop.
+                try {
+                    aclRule = new ProtocolAclRule(ruleParts[5], false, Integer.parseInt(ruleParts[1]));
+                } catch (final Exception e) {
+                    s_logger.warn("Problem occured when reading the entries in the ruleParts array. Actual array size is '" + ruleParts.length + "', but trying to read from index 5.");
+                    continue;
+                }
             }
             if ("Ingress".equals(ruleParts[0])) {
                 ingressRules.add(aclRule);


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

Posted by bh...@apache.org.
Fixed Port forwarding (DNAT/SNAT) for isolated networks
Fixed failure on using eth10 (which CS now supports)
Refactored CSForward to us CsInterface object instead of teh way it was kludged together
Fixed hex conversion for device numbers and iptables marks


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

Branch: refs/heads/master
Commit: 7bfccd699b1d17eb2b8c681b11d1f10c21bb2516
Parents: 6fc680b
Author: Ian Southam <is...@schubergphilis.com>
Authored: Thu Mar 5 17:12:21 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:40:12 2015 +0100

----------------------------------------------------------------------
 .../debian/config/opt/cloud/bin/configure.py    | 90 +++++++++++++++++---
 .../debian/config/opt/cloud/bin/cs/CsAddress.py | 26 ++++--
 .../debian/config/opt/cloud/bin/cs/CsDatabag.py | 23 ++---
 .../debian/config/opt/cloud/bin/cs/CsDhcp.py    |  2 +-
 .../debian/config/opt/cloud/bin/cs/CsRoute.py   |  2 +-
 .../debian/config/opt/cloud/bin/cs/CsRule.py    |  4 +-
 6 files changed, 111 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7bfccd69/systemvm/patches/debian/config/opt/cloud/bin/configure.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/configure.py b/systemvm/patches/debian/config/opt/cloud/bin/configure.py
index 399c9c4..246c995 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/configure.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/configure.py
@@ -496,15 +496,22 @@ class CsForwardingRules(CsDataBag):
                 elif rule["type"] == "staticnat":
                     self.processStaticNatRule(rule)
 
-    def getDeviceByIp(self, ip):
-        ips = CsDataBag("ips")
-        dbag = ips.get_bag()
-        for device in dbag:
-            if device == "id":
-                continue
-            for addy in dbag[device]:
-                if addy["public_ip"] == ip:
-                    return device
+    def getDeviceByIp(self, ipa):
+        for ip in self.config.address().get_ips():
+            if ip.ip_in_subnet(ipa):
+                return ip.get_device()
+        return None
+
+    def getNetworkByIp(self, ipa):
+        for ip in self.config.address().get_ips():
+            if ip.ip_in_subnet(ipa):
+                return ip.get_network()
+        return None
+
+    def getGatewayByIp(self, ipa):
+        for ip in self.config.address().get_ips():
+            if ip.ip_in_subnet(ipa):
+                return ip.get_gateway()
         return None
 
     def portsToString(self, ports, delimiter):
@@ -515,7 +522,70 @@ class CsForwardingRules(CsDataBag):
             return "%s%s%s" % (ports_parts[0], delimiter, ports_parts[1])
 
     def processForwardRule(self, rule):
-        # FIXME this seems to be different for regular VRs?
+        if self.config.is_vpc():
+            self.forward_vpc(rule)
+        else:
+            self.forward_vr(rule)
+
+    def forward_vr(self, rule):
+        fw1 = "-A PREROUTING -d %s/32 -i %s -p %s -m %s --dport %s -j DNAT --to-destination %s:%s" % \
+              ( rule['public_ip'],
+                self.getDeviceByIp(rule['public_ip']),
+                rule['protocol'],
+                rule['protocol'],
+                self.portsToString(rule['public_ports'], ':'),
+                rule['internal_ip'],
+                self.portsToString(rule['internal_ports'], '-')
+              )
+        fw2 = "-A PREROUTING -d %s/32 -i %s -p %s -m %s --dport %s -j DNAT --to-destination %s:%s" % \
+              ( rule['public_ip'],
+                self.getDeviceByIp(rule['internal_ip']),
+                rule['protocol'],
+                rule['protocol'],
+                self.portsToString(rule['public_ports'], ':'),
+                rule['internal_ip'],
+                self.portsToString(rule['internal_ports'], '-')
+              )
+        fw3 = "-A OUTPUT -d %s/32 -p %s -m %s --dport %s -j DNAT --to-destination %s:%s" % \
+              ( rule['public_ip'],
+                rule['protocol'],
+                rule['protocol'],
+                self.portsToString(rule['public_ports'], ':'),
+                rule['internal_ip'],
+                self.portsToString(rule['internal_ports'], '-')
+              )
+        fw4 = "-j SNAT --to-source %s -A POSTROUTING -s %s -d %s/32 -o %s -p %s -m %s --dport %s" % \
+              ( self.getGatewayByIp(rule['internal_ip']),
+                self.getNetworkByIp(rule['internal_ip']),
+                rule['internal_ip'],
+                self.getDeviceByIp(rule['internal_ip']),
+                rule['protocol'],
+                rule['protocol'],
+                self.portsToString(rule['internal_ports'], ':')
+              )  
+        fw5 = "-A PREROUTING -d %s/32 -i %s -p %s -m %s --dport %s -j MARK --set-xmark %s/0xffffffff" % \
+              ( rule['public_ip'],
+                self.getDeviceByIp(rule['public_ip']),
+                rule['protocol'],
+                rule['protocol'],
+                self.portsToString(rule['public_ports'], ':'),
+                hex(int(self.getDeviceByIp(rule['public_ip'])[3:]))
+              )  
+        fw6 = "-A PREROUTING -d %s/32 -i %s -p %s -m %s --dport %s -m state --state NEW -j CONNMARK --save-mark --nfmask 0xffffffff --ctmask 0xffffffff" % \
+              ( rule['public_ip'],
+                self.getDeviceByIp(rule['public_ip']),
+                rule['protocol'],
+                rule['protocol'],
+                self.portsToString(rule['public_ports'], ':'),
+              )  
+        self.fw.append(["nat", "", fw1])
+        self.fw.append(["nat", "", fw2])
+        self.fw.append(["nat", "", fw3])
+        self.fw.append(["nat", "", fw4])
+        self.fw.append(["nat", "", fw5])
+        self.fw.append(["nat", "", fw6])
+
+    def forward_vpc(self, rule):
         fwrule = "-A PREROUTING -d %s/32" % rule["public_ip"]
         if not rule["protocol"] == "any":
             fwrule += " -m %s -p %s" % (rule["protocol"], rule["protocol"])

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7bfccd69/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
index f675a655..7dc357b 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
@@ -19,6 +19,7 @@ from CsDatabag import CsDataBag, CsCmdLine
 from CsApp import CsApache, CsDnsmasq, CsPasswdSvc
 import CsHelper
 import logging
+from netaddr import IPAddress, IPNetwork
 import CsHelper
 
 import subprocess
@@ -118,6 +119,9 @@ class CsInterface:
     def get_ip(self):
         return self.get_attr("public_ip")
 
+    def get_network(self):
+        return self.get_attr("network")
+
     def get_netmask(self):
         return self.get_attr("netmask")
 
@@ -125,7 +129,15 @@ class CsInterface:
         if self.config.is_vpc():
             return self.get_attr("gateway")
         else:
-            return self.config.cmdline().get_guest_gw()
+            if self.config.cmdline().is_redundant():
+                return self.config.cmdline().get_guest_gw()
+            else:
+                return self.get_ip()
+
+    def ip_in_subnet(self, ip):
+        ipo = IPAddress(ip)
+        net = IPNetwork("%s/%s" % (self.get_ip(), self.get_size()))
+        return ipo in list(net)
 
     def get_gateway_cidr(self):
         return "%s/%s" % (self.get_gateway(), self.get_size())
@@ -185,7 +197,7 @@ class CsDevice:
         self.table = ''
         self.tableNo = ''
         if dev != '':
-            self.tableNo = dev[3]
+            self.tableNo = dev[3:]
             self.table = "Table_%s" % dev
         self.fw = config.get_fw()
         self.cl = config.cmdline()
@@ -228,7 +240,7 @@ class CsIP:
 
     def __init__(self, dev, config):
         self.dev = dev
-        self.dnum = dev[3]
+        self.dnum = hex(int(dev[3:]))
         self.iplist = {}
         self.address = {}
         self.list()
@@ -275,8 +287,8 @@ class CsIP:
                     CsHelper.execute(cmd2)
 
     def set_mark(self):
-        cmd = "-A PREROUTING -i %s -m state --state NEW -j CONNMARK --set-xmark 0x%s/0xffffffff" % \
-              (self.getDevice(), self.getDevice()[3])
+        cmd = "-A PREROUTING -i %s -m state --state NEW -j CONNMARK --set-xmark %s/0xffffffff" % \
+                (self.getDevice(), self.dnum)
         self.fw.append(["mangle", "", cmd])
 
     def get_type(self):
@@ -327,7 +339,7 @@ class CsIP:
                             "-A POSTROUTING -o eth2 -j SNAT --to-source %s" % self.address['public_ip']])
             self.fw.append(["mangle", "",
                             "-A PREROUTING -i %s -m state --state NEW " % self.dev +
-                            "-j CONNMARK --set-xmark 0x%s/0xffffffff" % self.dnum])
+                            "-j CONNMARK --set-xmark %s/0xffffffff" % self.dnum])
             self.fw.append(["mangle", "", "-A FIREWALL_%s -j DROP" % self.address['public_ip']])
 
         self.fw.append(["filter", "", "-A INPUT -d 224.0.0.18/32 -j ACCEPT"])
@@ -350,7 +362,7 @@ class CsIP:
             self.fw.append(["filter", "", "-A FORWARD -i eth0 -o eth2 -j FW_OUTBOUND"])
             self.fw.append(["mangle", "",
                             "-A PREROUTING -i %s -m state --state NEW " % self.dev +
-                            "-j CONNMARK --set-xmark 0x%s/0xffffffff" % self.dnum])
+                            "-j CONNMARK --set-xmark %s/0xffffffff" % self.dnum])
 
         if self.get_type() in ["control"]:
             self.fw.append(["filter", "", "-A FW_OUTBOUND -m state --state RELATED,ESTABLISHED -j ACCEPT"])

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7bfccd69/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 035e864..e8f15fe 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDatabag.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDatabag.py
@@ -62,6 +62,14 @@ class CsCmdLine(CsDataBag):
             return self.idata()['router_pr']
         return 99
 
+    def set_guest_gw(self, val):
+        self.idata()['guestgw'] = val
+
+    def get_guest_gw(self):
+        if "guestgw" in self.idata():
+            return self.idata()['guestgw']
+        return False
+
     def set_priority(self, val):
         self.idata()['router_pr'] = val
 
@@ -73,21 +81,6 @@ class CsCmdLine(CsDataBag):
     def set_redundant(self, val="true"):
         self.idata()['redundant_router'] = val
 
-    def set_guest_gw(self, val):
-        self.idata()['guestgw'] = val
-
-    def get_guest_gw(self):
-        if "guestgw" in self.idata():
-            return self.idata()['guestgw']
-        else:
-            return "1.2.3.4"
-
-    def get_guest_gw_cidr(self):
-        if "guestgw" in self.idata():
-            return "%s/%s" % (self.idata()['guestgw'], self.idata()['guestcidrsize'])
-        else:
-            return "1.2.3.4/8"
-
     def get_name(self):
         if "name" in self.idata():
             return self.idata()['name']

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7bfccd69/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDhcp.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDhcp.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDhcp.py
index 821444f..234ed4c 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDhcp.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDhcp.py
@@ -98,7 +98,7 @@ class CsDhcp(CsDataBag):
                 to = {"device": bits[0],
                       "mac": bits[1],
                       "ip": bits[2],
-                      "host": bits[3],
+                      "host": bits[3:],
                       "del": False
                       }
                 changed.append(to)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7bfccd69/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRoute.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRoute.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRoute.py
index f44ce58..6fb6e1c 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRoute.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRoute.py
@@ -24,7 +24,7 @@ class CsRoute:
 
     def __init__(self, dev):
         self.dev = dev
-        self.tableNo = dev[3]
+        self.tableNo = dev[3:]
         self.table = "Table_%s" % (dev)
 
     def routeTable(self):

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7bfccd69/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRule.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRule.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRule.py
index e2ca806..ed164b3 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRule.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRule.py
@@ -27,7 +27,7 @@ class CsRule:
 
     def __init__(self, dev):
         self.dev = dev
-        self.tableNo = dev[3]
+        self.tableNo = int(dev[3:])
         self.table = "Table_%s" % (dev)
 
     def addMark(self):
@@ -37,7 +37,7 @@ class CsRule:
             logging.info("Added fwmark rule for %s" % (self.table))
 
     def findMark(self):
-        srch = "from all fwmark 0x%s lookup %s" % (self.tableNo, self.table)
+        srch = "from all fwmark %s lookup %s" % (hex(self.tableNo), self.table)
         for i in CsHelper.execute("ip rule show"):
             if srch in i.strip():
                 return True


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

Posted by bh...@apache.org.
Switch control interface for vrrp to guest network
Fix rRouter that was deleting the gateway interface


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

Branch: refs/heads/master
Commit: 7a9a3560941e0f6d31fd8a3ed4c20edc32f826c8
Parents: e350f1e
Author: Ian Southam <is...@schubergphilis.com>
Authored: Tue Feb 3 17:21:11 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:39:57 2015 +0100

----------------------------------------------------------------------
 .../patches/debian/config/opt/cloud/bin/cs/CsAddress.py |  4 +++-
 .../debian/config/opt/cloud/bin/cs/CsRedundant.py       | 12 +++++++-----
 2 files changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7a9a3560/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
index 193c6f6..9e4e687 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
@@ -502,10 +502,12 @@ class CsIP:
 
     def is_guest_gateway(self, bag, ip):
         """ Exclude the vrrp maintained addresses on a redundant router """
+        interface = CsInterface(bag, self.config)
         if not self.config.cl.is_redundant():
             return False
         rip = ip.split('/')[0]
-        if bag['nw_type'] == "guest" and rip == bag['gateway']:
+        gw = interface.get_gateway()
+        if bag['nw_type'] == "guest" and rip == gw:
             return True
         return False
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7a9a3560/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 aed19d1..8561e8d 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
@@ -78,6 +78,11 @@ class CsRedundant(object):
         CsHelper.rm(self.KEEPALIVED_CONF)
 
     def _redundant_on(self):
+        guest = self.address.get_guest_if()
+        # No redundancy if there is no guest network
+        if guest is None:
+            self._redundant_off()
+            return
         CsHelper.mkdir(self.CS_RAMDISK_DIR, 0755, False)
         CsHelper.mount_tmpfs(self.CS_RAMDISK_DIR)
         CsHelper.mkdir(self.CS_ROUTER_DIR, 0755, False)
@@ -107,7 +112,8 @@ class CsRedundant(object):
             i = i + 1
         file.search(" router_id ", "    router_id %s" % self.cl.get_name())
         file.search(" priority ", "    priority %s" % self.cl.get_priority())
-        file.search(" weight ", "    weight %s" % 2)
+        file.search(" interface ", "    interface %s" % guest.get_device())
+        #file.search(" weight ", "    weight %s" % 2)
         # file.search(" state ", "    state %s" % self.cl.get_state())
         file.search(" state ", "    state %s" % "EQUAL")
         # file.search(" virtual_router_id ", "    virtual_router_id %s" % self.cl.get_router_id())
@@ -116,7 +122,6 @@ class CsRedundant(object):
         file.commit()
 
         # conntrackd configuration
-        guest = self.address.get_guest_if()
         connt = CsFile(self.CONNTRACKD_CONF)
         if guest is not None:
             connt.section("Multicast {", "}", [
@@ -136,9 +141,6 @@ class CsRedundant(object):
         if file.is_changed():
             CsHelper.service("keepalived", "restart")
 
-        # FIXME
-        # enable/disable_pubip/master/slave etc. will need rewriting to use the new python config
-
         # Configure heartbeat cron job
         cron = CsFile("/etc/cron.d/heartbeat")
         cron.add("SHELL=/bin/bash", 0)


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

Posted by bh...@apache.org.
Remove the priority checks from the code
  - We do not use it anymore


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

Branch: refs/heads/master
Commit: 8edeca179bc6f2e9e736b6c1b62241d3197526af
Parents: 3cc0915
Author: wilderrodrigues <wr...@schubergphilis.com>
Authored: Tue Feb 24 12:20:38 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:40:09 2015 +0100

----------------------------------------------------------------------
 .../network/router/VirtualNetworkApplianceManagerImpl.java     | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8edeca17/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 42537c1..383381e 100644
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -991,7 +991,6 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
             final RedundantState prevState = router.getRedundantState();
             if (router.getState() != State.Running) {
                 router.setRedundantState(RedundantState.UNKNOWN);
-                router.setIsPriorityBumpUp(false);
                 updated = true;
             } else {
                 final String privateIP = router.getPrivateIpAddress();
@@ -1012,13 +1011,12 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
                         s_logger.warn("Unable to update router " + router.getHostName() + "'s status");
                     }
                     RedundantState state = RedundantState.UNKNOWN;
-                    boolean isBumped = router.getIsPriorityBumpUp();
                     if (answer != null && answer.getResult()) {
                         state = answer.getState();
-                        isBumped = answer.isBumped();
+                    } else {
+                        s_logger.info("Agent response doesn't seem to be correct ==> " + answer.getResult());
                     }
                     router.setRedundantState(state);
-                    router.setIsPriorityBumpUp(isBumped);
                     updated = true;
                 }
             }


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

Posted by bh...@apache.org.
Set to EQUAL and noprempt - let keppalived decide who is boss
Also removed bump as we really do not need this


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

Branch: refs/heads/master
Commit: 6d34f1f797d1826c313d1312b1996ed0214c4516
Parents: 3b1dd68
Author: Ian Southam <is...@schubergphilis.com>
Authored: Wed Jan 28 15:19:48 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:39:53 2015 +0100

----------------------------------------------------------------------
 .../patches/debian/config/opt/cloud/templates/keepalived.conf.templ | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6d34f1f7/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 e5bdc7c..957b913 100644
--- a/systemvm/patches/debian/config/opt/cloud/templates/keepalived.conf.templ
+++ b/systemvm/patches/debian/config/opt/cloud/templates/keepalived.conf.templ
@@ -35,6 +35,7 @@ vrrp_instance inside_network {
     interface eth0
     virtual_router_id 51
     priority [PRIORITY]
+		nopreempt
 
     advert_int 1
     authentication {


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

Posted by bh...@apache.org.
{ip: hosts} syntax goes wrong if ip contains 1::
Needs to anchore regexp


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

Branch: refs/heads/master
Commit: 639126da8b2d49e03482799a34541bdea3534dfc
Parents: aa6fdf8
Author: Ian Southam <is...@schubergphilis.com>
Authored: Mon Feb 9 15:40:36 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:40:05 2015 +0100

----------------------------------------------------------------------
 systemvm/patches/debian/config/opt/cloud/bin/cs/CsDhcp.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/639126da/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDhcp.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDhcp.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDhcp.py
index 7278785..0a1c8e2 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDhcp.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDhcp.py
@@ -130,7 +130,7 @@ class CsDhcp(CsDataBag):
     def write_hosts(self):
         file = CsFile("/etc/hosts")
         for ip in self.hosts:
-            file.search("%s" % ip, "%s\t%s" % (ip, self.hosts[ip]))
+            file.search("^%s" % ip, "%s\t%s" % (ip, self.hosts[ip]))
         file.commit()
         if file.is_changed():
             logging.info("Updated hosts file")
@@ -155,4 +155,4 @@ class CsDhcp(CsDataBag):
                 v['gateway'] = entry['default_gateway']
 
     def add_host(self, ip, hosts):
-        self.hosts.update({ip: hosts})
+        self.hosts[ip] = hosts


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

Posted by bh...@apache.org.
Who changed my condition!
De Morgans laws chaps
The negation of a conjunction is the disjunction of the negations.
The negation of a disjunction is the conjunction of the negations.


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

Branch: refs/heads/master
Commit: 87d4171c536cbbcd06eb843b03d55399d4c6a414
Parents: db48a99
Author: Ian Southam <is...@schubergphilis.com>
Authored: Thu Jan 29 16:30:58 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:39:56 2015 +0100

----------------------------------------------------------------------
 .../patches/debian/config/opt/cloud/bin/cs/CsAddress.py     | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/87d4171c/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
index 0b5cca9..193c6f6 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
@@ -298,9 +298,12 @@ class CsIP:
         for i in CsHelper.execute(cmd):
             if " DOWN " in i:
                 cmd2 = "ip link set %s up" % self.getDevice()
-                # Do not change the state of ips on a redundant router that are managed by vrrp or CsRedundant
-                # the guest networks interfaces should be up and running.
-                if not self.config.cmdline().is_redundant() and not self.is_public():
+                # If redundant do not bring up public interfaces 
+                # master.py and keepalived deal with tham
+                if self.config.cmdline().is_redundant() and not self.is_public():
+                    CsHelper.execute(cmd2)
+                # if not redundant bring everything up
+                if not self.config.cmdline().is_redundant():
                     CsHelper.execute(cmd2)
 
     def set_mark(self):


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

Posted by bh...@apache.org.
Restart keepalived if a pub interface gets added or removed


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

Branch: refs/heads/master
Commit: db48a9967841130a5248f764380eca29a0f46fa2
Parents: 159088c
Author: Ian Southam <is...@schubergphilis.com>
Authored: Thu Jan 29 15:50:36 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:39:55 2015 +0100

----------------------------------------------------------------------
 .../debian/config/opt/cloud/bin/cs/CsRedundant.py        | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/db48a996/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 2fa4160..aed19d1 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
@@ -98,6 +98,13 @@ class CsRedundant(object):
 
         # keepalived configuration
         file = CsFile(self.KEEPALIVED_CONF)
+        ads = [o for o in self.address.get_ips() if o.is_public()]
+        # Add a comment for each public IP.  If any change this will cause keepalived to restart
+        # As things stand keepalived will be configured before the IP is added or deleted
+        i = 0
+        for o in ads:
+            file.addeq("! %s=%s" % (i, o.get_cidr()))
+            i = i + 1
         file.search(" router_id ", "    router_id %s" % self.cl.get_name())
         file.search(" priority ", "    priority %s" % self.cl.get_priority())
         file.search(" weight ", "    weight %s" % 2)
@@ -105,11 +112,7 @@ class CsRedundant(object):
         file.search(" state ", "    state %s" % "EQUAL")
         # file.search(" virtual_router_id ", "    virtual_router_id %s" % self.cl.get_router_id())
         file.greplace("[RROUTER_BIN_PATH]", self.CS_ROUTER_DIR)
-# If there is no guest network still bring up the public interface
-# Maybe necessary for things like VPNs and private gateways
         file.section("virtual_ipaddress {", "}", self._collect_ips())
-        # if self.cl.get_state() == 'MASTER':
-            # file.search(" priority ", "    priority %s" % 100)
         file.commit()
 
         # conntrackd configuration


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

Posted by bh...@apache.org.
Check both ip and hosts when building dhcp bag


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

Branch: refs/heads/master
Commit: 748e2e51a9ead7be4047e112aad2ed07a3d7a2c9
Parents: c1ec5b0
Author: Ian Southam <is...@schubergphilis.com>
Authored: Wed Feb 18 18:36:59 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:40:08 2015 +0100

----------------------------------------------------------------------
 .../patches/debian/config/opt/cloud/bin/cs_dhcp.py  | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/748e2e51/systemvm/patches/debian/config/opt/cloud/bin/cs_dhcp.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs_dhcp.py b/systemvm/patches/debian/config/opt/cloud/bin/cs_dhcp.py
index 64d8f8d..d9f30e5 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs_dhcp.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs_dhcp.py
@@ -21,6 +21,7 @@ from netaddr import *
 
 def merge(dbag, data):
 
+    search(dbag, data['host_name'])
     # A duplicate ip address wil clobber the old value
     # This seems desirable ....
     if "add" in data and data['add'] is False and \
@@ -31,3 +32,18 @@ def merge(dbag, data):
     else:
         dbag[data['ipv4_adress']] = data
     return dbag
+
+
+def search(dbag, name):
+    """
+    Dirty hack because CS does not deprovision hosts
+    """
+    hosts = []
+    for o in dbag:
+        if o == 'id':
+            continue
+        print "%s %s" % (dbag[o]['host_name'], name)
+        if dbag[o]['host_name'] == name:
+            hosts.append(o)
+    for o in hosts:
+        del(dbag[o])


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

Posted by bh...@apache.org.
Remove vpc_router_svcs because they will be the same as any other router (soon)
One question is apache2


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

Branch: refs/heads/master
Commit: 3b1dd68ae9fa8a1195bd455c1c430c4ce8376503
Parents: 88129ad
Author: Ian Southam <is...@schubergphilis.com>
Authored: Wed Jan 28 15:15:10 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:39:52 2015 +0100

----------------------------------------------------------------------
 .../config/opt/cloud/bin/patchsystemvm.sh       | 24 --------------------
 1 file changed, 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3b1dd68a/systemvm/patches/debian/config/opt/cloud/bin/patchsystemvm.sh
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/patchsystemvm.sh b/systemvm/patches/debian/config/opt/cloud/bin/patchsystemvm.sh
index 9cb0250..9a47f8e 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/patchsystemvm.sh
+++ b/systemvm/patches/debian/config/opt/cloud/bin/patchsystemvm.sh
@@ -95,20 +95,6 @@ routing_svcs() {
    fi
 }
 
-vpcrouting_svcs() {
-   chkconfig cloud off
-   chkconfig haproxy on ; 
-   chkconfig ssh on
-   chkconfig nfs-common off
-   chkconfig portmap off
-   chkconfig dnsmasq on
-   chkconfig keepalived off
-   chkconfig conntrackd off
-   chkconfig apache2 off
-   echo "ssh haproxy dnsmasq" > /var/cache/cloud/enabled_svcs
-   echo "cloud cloud-passwd-srvr apache2 nfs-common portmap keepalived conntrackd" > /var/cache/cloud/disabled_svcs
-}
-
 dhcpsrvr_svcs() {
    chkconfig cloud off
    chkconfig cloud-passwd-srvr on ; 
@@ -215,16 +201,6 @@ then
   fi
 fi
 
-if [ "$TYPE" == "vpcrouter" ]
-then
-  vpcrouting_svcs
-  if [ $? -gt 0 ]
-  then
-    printf "Failed to execute vpcrouting_svcs\n" >$logfile
-    exit 6
-  fi
-fi
-
 if [ "$TYPE" == "dhcpsrvr" ]
 then
   dhcpsrvr_svcs


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

Posted by bh...@apache.org.
Fixed password server, fixed more firewall issues
Fixed issues with real IP and not virtual (gateway) IP being opened on the firewall
DNS now works on the vms


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

Branch: refs/heads/master
Commit: 57d3ffaef893e00bf751fa0a516fb210bf4b478c
Parents: e6b3ee3
Author: Ian Southam <is...@schubergphilis.com>
Authored: Fri Feb 6 13:53:08 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:40:03 2015 +0100

----------------------------------------------------------------------
 .../debian/config/opt/cloud/bin/configure.py    |  2 +-
 .../debian/config/opt/cloud/bin/cs/CsAddress.py | 10 ++++---
 .../debian/config/opt/cloud/bin/cs/CsApp.py     | 28 +++++++++++++-------
 .../debian/config/opt/cloud/bin/cs/CsProcess.py | 10 +++++++
 .../config/opt/cloud/bin/cs/CsRedundant.py      | 15 ++++++++---
 .../config/opt/cloud/bin/passwd_server_ip       |  1 +
 6 files changed, 49 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/57d3ffae/systemvm/patches/debian/config/opt/cloud/bin/configure.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/configure.py b/systemvm/patches/debian/config/opt/cloud/bin/configure.py
index b693477..43b01b6 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/configure.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/configure.py
@@ -36,7 +36,7 @@ from cs.CsNetfilter import CsNetfilters
 from cs.CsDhcp import CsDhcp
 from cs.CsRedundant import *
 from cs.CsFile import CsFile
-from cs.CsApp import CsApache, CsPasswdSvc, CsDnsmasq
+from cs.CsApp import CsApache, CsDnsmasq
 from cs.CsMonitor import CsMonitor
 from cs.CsLoadBalancer import CsLoadBalancer
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/57d3ffae/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
index 54a40a1..df6fdc7 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
@@ -341,9 +341,8 @@ class CsIP:
             self.fw.append(["filter", "", "-A INPUT -i %s -p udp -m udp --dport 67 -j ACCEPT" % self.dev])
             self.fw.append(["filter", "", "-A INPUT -i %s -p udp -m udp --dport 53 -j ACCEPT" % self.dev])
             self.fw.append(["filter", "", "-A INPUT -i %s -p tcp -m tcp --dport 53 -j ACCEPT" % self.dev])
-            self.fw.append(["filter", "",
-                            "-A INPUT -s %s -i %s -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT" % (self.address['network'], self.dev)])
             self.fw.append(["filter", "", "-A INPUT -i %s -p tcp -m tcp --dport 80 -m state --state NEW -j ACCEPT" % self.dev])
+            self.fw.append(["filter", "", "-A INPUT -i %s -p tcp -m tcp --dport 8080 -m state --state NEW -j ACCEPT" % self.dev])
             self.fw.append(["filter", "", "-A FORWARD -i %s -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT" % self.dev])
             self.fw.append(["filter", "", "-A FORWARD -i %s -o %s -m state --state NEW -j ACCEPT" % (self.dev, self.dev)])
             self.fw.append(["filter", "", "-A FORWARD -i eth2 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT"])
@@ -367,6 +366,8 @@ class CsIP:
             self.fw.append(["filter", "", "-A INPUT -i %s -p udp -m udp --dport 67 -j ACCEPT" % self.dev])
             self.fw.append(["filter", "", "-A INPUT -i %s -p udp -m udp --dport 53 -j ACCEPT" % self.dev])
             self.fw.append(["filter", "", "-A INPUT -i %s -p tcp -m tcp --dport 53 -j ACCEPT" % self.dev])
+            self.fw.append(["filter", "", "-A INPUT -i %s -p tcp -m tcp --dport 80 -m state --state NEW -j ACCEPT" % self.dev])
+            self.fw.append(["filter", "", "-A INPUT -i %s -p tcp -m tcp --dport 8080 -m state --state NEW -j ACCEPT" % self.dev])
             self.fw.append(["mangle", "",
                             "-A PREROUTING -m state --state NEW -i %s -s %s ! -d %s/32 -j ACL_OUTBOUND_%s" %
                             (self.dev, self.address['network'], self.address['gateway'], self.dev)
@@ -417,7 +418,10 @@ class CsIP:
             dns.add_firewall_rules()
             app = CsApache(self)
             app.setup()
-            pwdsvc = CsPasswdSvc(self).setup()
+
+        # If redundant then this is dealt with by the master backup functions
+        if self.get_type() in ["guest"] and not self.config.cl.is_redundant():
+            pwdsvc = CsPasswdSvc(self.address['public_ip']).start()
 
         if self.get_type() == "public" and self.config.is_vpc():
             if self.address["source_nat"]:

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/57d3ffae/systemvm/patches/debian/config/opt/cloud/bin/cs/CsApp.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsApp.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsApp.py
index d680bde..cceb464 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsApp.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsApp.py
@@ -59,19 +59,29 @@ class CsApache(CsApp):
                         ])
 
 
-class CsPasswdSvc(CsApp):
+class CsPasswdSvc():
     """
       nohup bash /opt/cloud/bin/vpc_passwd_server $ip >/dev/null 2>&1 &
     """
 
-    def setup(self):
-        self.fw.append(["", "front",
-                        "-A INPUT -i %s -d %s/32 -p tcp -m tcp -m state --state NEW --dport 8080 -j ACCEPT" % (self.dev, self.ip)
-                        ])
-
-        proc = CsProcess(['/opt/cloud/bin/vpc_passwd_server', self.ip])
-        if not proc.find():
-            proc.start("/usr/bin/nohup", ">/dev/null 2>&1 &")
+    def __init__(self, ip):
+        self.ip = ip
+
+    def start(self):
+        proc = CsProcess(["dummy"])
+        if proc.grep("passwd_service %s" % self.ip) == -1:
+            proc.start("/opt/cloud/bin/passwd_server_ip %s >> /var/log/cloud.log 2>&1" % self.ip, "&")
+
+    def stop(self):
+        proc = CsProcess(["Password Service"])
+        pid = proc.grep("passwd_server_ip %s" % self.ip)
+        proc.kill(pid)
+        pid = proc.grep("8080,reuseaddr,fork,crnl,bind=%s" % self.ip)
+        proc.kill(pid)
+
+    def restart(self):
+        self.stop()
+        self.start()
 
 
 class CsDnsmasq(CsApp):

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/57d3ffae/systemvm/patches/debian/config/opt/cloud/bin/cs/CsProcess.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsProcess.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsProcess.py
index afa6310..19d030b 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsProcess.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsProcess.py
@@ -51,3 +51,13 @@ class CsProcess(object):
     def find(self):
         has_pid = len(self.find_pid()) > 0
         return has_pid
+
+    def kill(self, pid):
+        if pid > 1:
+            CsHelper.execute("kill -9 %s" % pid)
+
+    def grep(self, str):
+        for i in CsHelper.execute("ps aux"):
+            if i.find(str) != -1:
+                return re.split("\s+", i)[1]
+        return -1

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/57d3ffae/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 56902f0..5054f76 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
@@ -39,6 +39,7 @@ import CsHelper
 from CsFile import CsFile
 from CsConfig import CsConfig
 from CsProcess import CsProcess
+from CsApp import CsPasswdSvc
 
 
 class CsRedundant(object):
@@ -161,15 +162,17 @@ class CsRedundant(object):
             logging.error("Set fault called on non-redundant router")
             return
         logging.info("Router switched to fault mode")
-        ads = [o for o in self.address.get_ips() if o.needs_vrrp()]
+        ads = [o for o in self.address.get_ips() if o.is_public()]
         for o in ads:
             CsHelper.execute("ifconfig %s down" % o.get_device())
         cmd = "%s -C %s" % (self.CONNTRACKD_BIN, self.CONNTRACKD_CONF)
         CsHelper.execute("%s -s" % cmd)
         CsHelper.service("ipsec", "stop")
         CsHelper.service("xl2tpd", "stop")
-        CsHelper.service("cloud-passwd-srvr", "stop")
         CsHelper.service("dnsmasq", "stop")
+        ads = [o for o in self.address.get_ips() if o.needs_vrrp()]
+        for o in ads:
+            pwdsvc = CsPasswdSvc(o.get_gateway()).stop()
         cl.dbag['config']['redundant_master'] = "false"
         cl.save()
         logging.info("Router switched to fault mode")
@@ -192,7 +195,9 @@ class CsRedundant(object):
         CsHelper.execute("%s -d" % cmd)
         CsHelper.service("ipsec", "stop")
         CsHelper.service("xl2tpd", "stop")
-        CsHelper.service("cloud-passwd-srvr", "stop")
+        ads = [o for o in self.address.get_ips() if o.needs_vrrp()]
+        for o in ads:
+            pwdsvc = CsPasswdSvc(o.get_gateway()).stop()
         CsHelper.service("dnsmasq", "stop")
         # self._set_priority(self.CS_PRIO_DOWN)
         self.cl.dbag['config']['redundant_master'] = "false"
@@ -225,7 +230,9 @@ class CsRedundant(object):
         CsHelper.execute("%s -B" % cmd)
         CsHelper.service("ipsec", "restart")
         CsHelper.service("xl2tpd", "restart")
-        CsHelper.service("cloud-passwd-srvr", "restart")
+        ads = [o for o in self.address.get_ips() if o.needs_vrrp()]
+        for o in ads:
+            pwdsvc = CsPasswdSvc(o.get_gateway()).restart()
         CsHelper.service("dnsmasq", "restart")
         self.cl.dbag['config']['redundant_master'] = "true"
         self.cl.save()

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/57d3ffae/systemvm/patches/debian/config/opt/cloud/bin/passwd_server_ip
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/passwd_server_ip b/systemvm/patches/debian/config/opt/cloud/bin/passwd_server_ip
index 5e15a19..a408a1e 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/passwd_server_ip
+++ b/systemvm/patches/debian/config/opt/cloud/bin/passwd_server_ip
@@ -18,6 +18,7 @@
 
 . /etc/default/cloud-passwd-srvr
 addr=$1;
+ENABLED=1
 while [ "$ENABLED" == "1" ]
 do
     python /opt/cloud/bin/passwd_server_ip.py $addr >/dev/null 2>/dev/null


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

Posted by bh...@apache.org.
Use reload on keepalived
restart causes the master status to flip unecessarily during provisioning tasks


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

Branch: refs/heads/master
Commit: 5ddf87b2fd81cb19f85ea304dd28ed3f9a37c9a2
Parents: c38f0b9
Author: Ian Southam <is...@schubergphilis.com>
Authored: Tue Mar 3 13:55:42 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:40:11 2015 +0100

----------------------------------------------------------------------
 systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5ddf87b2/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 dc08b85..a2a1793 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
@@ -144,7 +144,7 @@ class CsRedundant(object):
             CsHelper.service("conntrackd", "restart")
 
         if file.is_changed():
-            CsHelper.service("keepalived", "restart")
+            CsHelper.service("keepalived", "reload")
 
         # Configure heartbeat cron job
         cron = CsFile("/etc/cron.d/heartbeat")


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

Posted by bh...@apache.org.
Add network stats for isalated networks


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

Branch: refs/heads/master
Commit: b3da2c54c261edd564f80bc6ad1a276b31a44dc2
Parents: aa585e3
Author: Ian Southam <is...@schubergphilis.com>
Authored: Fri Feb 6 16:34:38 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:40:04 2015 +0100

----------------------------------------------------------------------
 systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b3da2c54/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
index df6fdc7..80dfcdc 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
@@ -355,6 +355,13 @@ class CsIP:
         if self.get_type() in ["control"]:
             self.fw.append(["filter", "", "-A FW_OUTBOUND -m state --state RELATED,ESTABLISHED -j ACCEPT"])
             self.fw.append(["filter", "", "-A INPUT -i %s -p tcp -m tcp --dport 3922 -m state --state NEW -j ACCEPT" % self.dev])
+  		self.fw.append(['', 'front', '-A FORWARD -j NETWORK_STATS'])
+  		self.fw.append(['', 'front', '-A INPUT -j NETWORK_STATS'])
+  		self.fw.append(['', 'front', '-A OUTPUT -j NETWORK_STATS'])
+  		self.fw.append(['', '', '-A NETWORK_STATS -i eth0 -o eth2'])
+  		self.fw.append(['', '', '-A NETWORK_STATS -i eth2 -o eth0'])
+  		self.fw.append(['', '', '-A NETWORK_STATS -o eth2 ! -i eth0 -p tcp'])
+  		self.fw.append(['', '', '-A NETWORK_STATS -i eth2 ! -o eth0 -p tcp'])
 
     def fw_vpcrouter(self):
         if not self.config.is_vpc():


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

Posted by bh...@apache.org.
Removing trailing spaces


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

Branch: refs/heads/master
Commit: aa585e3428eac44418e891d8cdf2fc926bb10e6c
Parents: 3af2ce3
Author: wilderrodrigues <wr...@schubergphilis.com>
Authored: Fri Feb 6 14:49:32 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:40:04 2015 +0100

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/aa585e34/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 588a354..5d59813 100644
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -1077,19 +1077,19 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
                         continue;
                     }
                     checkedNetwork.add(routerGuestNtwkId);
-                    
+
                     final List<DomainRouterVO> checkingRouters;
-                    Long vpcId = router.getVpcId();
+                    final Long vpcId = router.getVpcId();
                     if (vpcId != null) {
                         checkingRouters = _routerDao.listByVpcId(vpcId);
                     } else {
                         checkingRouters = _routerDao.listByNetworkAndRole(routerGuestNtwkId, Role.VIRTUAL_ROUTER);
                     }
-                    
+
                     if (checkingRouters.size() != 2) {
                         continue;
                     }
-                    
+
                     DomainRouterVO masterRouter = null;
                     DomainRouterVO backupRouter = null;
                     for (final DomainRouterVO r : checkingRouters) {


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

Posted by bh...@apache.org.
Disable this for now - causes too much grief
Is also the root cause of the status UNKNOWN


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

Branch: refs/heads/master
Commit: c38f0b91e333708d6416947832c3c016a23328ef
Parents: 585f5f7
Author: Ian Southam <is...@schubergphilis.com>
Authored: Thu Feb 26 17:09:13 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:40:10 2015 +0100

----------------------------------------------------------------------
 .../network/router/VirtualNetworkApplianceManagerImpl.java     | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c38f0b91/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 383381e..905a041 100644
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -1104,7 +1104,7 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
                             } else {
                                 // Wilder Rodrigues (wrodrigues@schubergphilis.com
                                 // Force a restart in order to fix the conflict
-                                recoverRedundantNetwork(masterRouter, r);
+                                // recoverRedundantNetwork(masterRouter, r);
                                 break;
                             }
                         } else if (r.getRedundantState() == RedundantState.BACKUP) {
@@ -1113,7 +1113,7 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
                             } else {
                                 // Wilder Rodrigues (wrodrigues@schubergphilis.com
                                 // Do we have 2 routers in Backup state? Perhaps a restart of 1 router is needed.
-                                recoverRedundantNetwork(backupRouter, r);
+                                // recoverRedundantNetwork(backupRouter, r);
                                 break;
                             }
                         }
@@ -2746,4 +2746,4 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
     public boolean completeAggregatedExecution(final Network network, final List<DomainRouterVO> routers) throws AgentUnavailableException, ResourceUnavailableException {
         return aggregationExecution(Action.Finish, network, routers);
     }
-}
\ No newline at end of file
+}


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

Posted by bh...@apache.org.
This change breaks stuff
This id is used to define the groups and will prevent the two vrrp instances from talking to each other
Result = MASTER MASTER


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

Branch: refs/heads/master
Commit: 9bec4b64e7ad408e2b214c1f803b0b8795f8a369
Parents: b7a1428
Author: Ian Southam <is...@schubergphilis.com>
Authored: Wed Jan 28 12:17:16 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:39:52 2015 +0100

----------------------------------------------------------------------
 systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9bec4b64/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 4312462..a1bef3a 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
@@ -102,7 +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.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())
         if self.cl.get_state() == 'MASTER':


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

Posted by bh...@apache.org.
Utterley stupid


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

Branch: refs/heads/master
Commit: baa758acccb1fb5ad53be5334b941205b3ebef8d
Parents: 639126d
Author: Ian Southam <is...@schubergphilis.com>
Authored: Tue Feb 10 14:05:13 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:40:06 2015 +0100

----------------------------------------------------------------------
 systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/baa758ac/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
index 0bf98df..cd2d9f1 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
@@ -370,6 +370,7 @@ class CsIP:
                         "-m state --state RELATED,ESTABLISHED " +
                         "-j CONNMARK --restore-mark --nfmask 0xffffffff --ctmask 0xffffffff"])
         if self.get_type() in ["guest"]:
+            self.fw.append(["filter", "", "-A FORWARD -d %s -o %s -j ACL_INBOUND_%s" % (self.address['network'], self.dev, self.dev)])
             self.fw.append(["filter", "", "-A INPUT -i %s -p udp -m udp --dport 67 -j ACCEPT" % self.dev])
             self.fw.append(["filter", "", "-A INPUT -i %s -p udp -m udp --dport 53 -j ACCEPT" % self.dev])
             self.fw.append(["filter", "", "-A INPUT -i %s -p tcp -m tcp --dport 53 -j ACCEPT" % self.dev])


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

Posted by bh...@apache.org.
ACL issues
ACL order issues
Do not block multicast traffic for vrrp
Many smaller bug fixes
checkrouter provided in /opt/cloud/bin


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

Branch: refs/heads/master
Commit: 585f5f7000d876d96bb17cc0996efc98f22a840e
Parents: 8edeca1
Author: Ian Southam <is...@schubergphilis.com>
Authored: Thu Feb 26 14:07:36 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:40:10 2015 +0100

----------------------------------------------------------------------
 .../debian/config/opt/cloud/bin/checkrouter.sh  |  8 +++++
 .../debian/config/opt/cloud/bin/configure.py    | 19 ++++++++----
 .../debian/config/opt/cloud/bin/cs/CsAddress.py |  5 ++++
 .../debian/config/opt/cloud/bin/cs/CsApp.py     |  0
 .../debian/config/opt/cloud/bin/cs/CsConfig.py  |  0
 .../debian/config/opt/cloud/bin/cs/CsDatabag.py | 14 ++++++---
 .../debian/config/opt/cloud/bin/cs/CsDhcp.py    |  0
 .../debian/config/opt/cloud/bin/cs/CsFile.py    |  0
 .../config/opt/cloud/bin/cs/CsGuestNetwork.py   |  0
 .../debian/config/opt/cloud/bin/cs/CsHelper.py  |  0
 .../config/opt/cloud/bin/cs/CsLoadBalancer.py   |  0
 .../debian/config/opt/cloud/bin/cs/CsMonitor.py |  0
 .../config/opt/cloud/bin/cs/CsNetfilter.py      | 31 ++++++++++++++++++--
 .../debian/config/opt/cloud/bin/cs/CsProcess.py |  0
 .../config/opt/cloud/bin/cs/CsRedundant.py      |  8 ++---
 .../debian/config/opt/cloud/bin/cs/CsRoute.py   |  0
 .../debian/config/opt/cloud/bin/cs/CsRule.py    |  0
 .../debian/config/opt/cloud/bin/cs/__init__.py  |  0
 .../debian/config/opt/cloud/bin/cs_cmdline.py   |  0
 .../debian/config/opt/cloud/bin/cs_dhcp.py      |  0
 .../config/opt/cloud/bin/cs_firewallrules.py    |  0
 .../config/opt/cloud/bin/cs_forwardingrules.py  |  0
 .../config/opt/cloud/bin/cs_guestnetwork.py     |  0
 .../debian/config/opt/cloud/bin/cs_ip.py        |  0
 .../config/opt/cloud/bin/cs_loadbalancer.py     |  0
 .../config/opt/cloud/bin/cs_monitorservice.py   |  0
 .../config/opt/cloud/bin/cs_network_acl.py      |  0
 .../config/opt/cloud/bin/cs_site2sitevpn.py     |  0
 .../debian/config/opt/cloud/bin/cs_vmdata.py    |  0
 .../debian/config/opt/cloud/bin/cs_vmp.py       |  0
 .../opt/cloud/bin/get_template_version.sh       |  2 +-
 31 files changed, 69 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/585f5f70/systemvm/patches/debian/config/opt/cloud/bin/checkrouter.sh
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/checkrouter.sh b/systemvm/patches/debian/config/opt/cloud/bin/checkrouter.sh
new file mode 100755
index 0000000..4b50f9b
--- /dev/null
+++ b/systemvm/patches/debian/config/opt/cloud/bin/checkrouter.sh
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+
+STATUS=$(cat /etc/cloudstack/cmdline.json | grep redundant_state | awk '{print $2;}' | sed -e 's/[,\"]//g')
+if [ "$?" -ne "0" ]
+then
+	   STATUS=MASTER
+fi
+echo "Status: ${STATUS}&Bumped: NO"

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/585f5f70/systemvm/patches/debian/config/opt/cloud/bin/configure.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/configure.py b/systemvm/patches/debian/config/opt/cloud/bin/configure.py
index 43b01b6..399c9c4 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/configure.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/configure.py
@@ -141,6 +141,9 @@ class CsAcl(CsDataBag):
     class AclDevice():
         """ A little class for each list of acls per device """
 
+        FIXED_RULES_INGRESS = 3
+        FIXED_RULES_EGRESS = 3
+
         def __init__(self, obj, config):
             self.ingess = []
             self.egress = []
@@ -156,23 +159,27 @@ class CsAcl(CsDataBag):
             self.fw = config.get_fw()
 
         def create(self):
-            self.process("ingress", self.ingress)
-            self.process("egress", self.egress)
+            self.process("ingress", self.ingress, self.FIXED_RULES_INGRESS)
+            self.process("egress", self.egress, self.FIXED_RULES_EGRESS)
 
-        def process(self, direction, rule_list):
+        def process(self, direction, rule_list, base):
+            count = base
             for i in rule_list:
-                r = self.AclRule(direction, self, i, self.config)
+                r = self.AclRule(direction, self, i, self.config, count)
                 r.create()
+                count += 1
 
         class AclRule():
 
-            def __init__(self, direction, acl, rule, config):
+            def __init__(self, direction, acl, rule, config, count):
+                self.count = count
                 if config.is_vpc():
                     self.init_vpc(direction, acl, rule, config)
 
             def init_vpc(self, direction, acl, rule, config):
                 self.table = ""
                 self.device = acl.device
+                self.direction = direction
                 # acl is an object of the AclDevice type. So, its fw attribute is already a list.
                 self.fw = acl.fw
                 self.chain = config.get_ingress_chain(self.device, acl.ip)
@@ -210,7 +217,7 @@ class CsAcl(CsDataBag):
                     rstr = "%s -m icmp --icmp-type %s" % (rstr, self.icmp_type)
                 rstr = "%s %s -j %s" % (rstr, self.dport, self.action)
                 rstr = rstr.replace("  ", " ").lstrip()
-                self.fw.append([self.table, "front", rstr])
+                self.fw.append([self.table, self.count, rstr])
 
     def process(self):
         for item in self.dbag:

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/585f5f70/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
old mode 100644
new mode 100755
index 04d642e..8f4d511
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
@@ -371,9 +371,14 @@ class CsIP:
                         "-j CONNMARK --restore-mark --nfmask 0xffffffff --ctmask 0xffffffff"])
         if self.get_type() in ["guest"]:
             self.fw.append(["filter", "", "-A FORWARD -d %s -o %s -j ACL_INBOUND_%s" % (self.address['network'], self.dev, self.dev)])
+            self.fw.append(["filter", "front", "-A ACL_INBOUND_%s -d 224.0.0.18/32 -j ACCEPT" % self.dev])
+            self.fw.append(["filter", "front", "-A ACL_INBOUND_%s -d 225.0.0.50/32 -j ACCEPT" % self.dev])
+            self.fw.append(["mangle", "front", "-A ACL_OUTBOUND_%s -d 225.0.0.50/32 -j ACCEPT" % self.dev])
+            self.fw.append(["mangle", "front", "-A ACL_OUTBOUND_%s -d 224.0.0.18/32 -j ACCEPT" % self.dev])
             self.fw.append(["filter", "", "-A INPUT -i %s -p udp -m udp --dport 67 -j ACCEPT" % self.dev])
             self.fw.append(["filter", "", "-A INPUT -i %s -p udp -m udp --dport 53 -j ACCEPT" % self.dev])
             self.fw.append(["filter", "", "-A INPUT -i %s -p tcp -m tcp --dport 53 -j ACCEPT" % self.dev])
+
             self.fw.append(["filter", "", "-A INPUT -i %s -p tcp -m tcp --dport 80 -m state --state NEW -j ACCEPT" % self.dev])
             self.fw.append(["filter", "", "-A INPUT -i %s -p tcp -m tcp --dport 8080 -m state --state NEW -j ACCEPT" % self.dev])
             self.fw.append(["mangle", "",

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/585f5f70/systemvm/patches/debian/config/opt/cloud/bin/cs/CsApp.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsApp.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsApp.py
old mode 100644
new mode 100755

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/585f5f70/systemvm/patches/debian/config/opt/cloud/bin/cs/CsConfig.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsConfig.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsConfig.py
old mode 100644
new mode 100755

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/585f5f70/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
old mode 100644
new mode 100755
index a3818e5..035e864
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDatabag.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDatabag.py
@@ -119,10 +119,16 @@ class CsCmdLine(CsDataBag):
             return self.idata()['redundant_state'] == "MASTER"
         return False
 
-    def get_state(self):
-        if "redundant_state" in self.idata():
-            return self.idata()['redundant_state']
-        return "MASTER"
+    def set_fault_state(self):
+        self.idata()['redundant_state'] = "FAULT"
+        self.idata()['redundant_master'] = False
+
+    def set_master_state(self, value):
+        if value:
+            self.idata()['redundant_state'] = "MASTER"
+        else:
+            self.idata()['redundant_state'] = "BACKUP"
+        self.idata()['redundant_master'] = value
 
     def get_router_id(self):
         if "router_id" in self.idata():

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/585f5f70/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDhcp.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDhcp.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDhcp.py
old mode 100644
new mode 100755

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/585f5f70/systemvm/patches/debian/config/opt/cloud/bin/cs/CsFile.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsFile.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsFile.py
old mode 100644
new mode 100755

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/585f5f70/systemvm/patches/debian/config/opt/cloud/bin/cs/CsGuestNetwork.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsGuestNetwork.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsGuestNetwork.py
old mode 100644
new mode 100755

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/585f5f70/systemvm/patches/debian/config/opt/cloud/bin/cs/CsHelper.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsHelper.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsHelper.py
old mode 100644
new mode 100755

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/585f5f70/systemvm/patches/debian/config/opt/cloud/bin/cs/CsLoadBalancer.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsLoadBalancer.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsLoadBalancer.py
old mode 100644
new mode 100755

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/585f5f70/systemvm/patches/debian/config/opt/cloud/bin/cs/CsMonitor.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsMonitor.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsMonitor.py
old mode 100644
new mode 100755

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/585f5f70/systemvm/patches/debian/config/opt/cloud/bin/cs/CsNetfilter.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsNetfilter.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsNetfilter.py
index 6a546a4..6c1d091 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsNetfilter.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsNetfilter.py
@@ -26,19 +26,28 @@ class CsChain(object):
     def __init__(self):
         self.chain = {}
         self.last_added = ''
+        self.count = {}
 
     def add(self, table, chain):
         if table not in self.chain.keys():
             self.chain.setdefault(table, []).append(chain)
         else:
             self.chain[table].append(chain)
-        self.last_added = chain
+        if self.last_added != chain:
+            self.last_added = chain
+            self.count[chain] = 0
+
+    def add_rule(self, chain):
+        self.count[chain] += 1
 
     def get(self, table):
         if table not in self.chain.keys():
             return {}
         return self.chain[table]
 
+    def get_count(self, chain):
+        return self.count[chain]
+
     def last(self):
         return self.last_added
 
@@ -84,9 +93,12 @@ class CsNetfilters(object):
             if i.startswith(':'):  # Chain
                 self.chain.add(self.table.last(), i[1:].split(' ')[0])
             if i.startswith('-A'):  # Rule
+                self.chain.add_rule(i.split()[1])
                 rule = CsNetfilter()
                 rule.parse(i)
                 rule.set_table(self.table.last())
+                rule.set_chain(i.split()[1])
+                rule.set_count(self.chain.get_count(i.split()[1]))
                 self.save(rule)
 
     def save(self, rule):
@@ -104,6 +116,8 @@ class CsNetfilters(object):
     def has_rule(self, new_rule):
         for r in self.get():
             if new_rule == r:
+                if new_rule.get_count() > 0:
+                    continue
                 r.mark_seen()
                 return True
         return False
@@ -119,8 +133,8 @@ class CsNetfilters(object):
     def compare(self, list):
         """ Compare reality with what is needed """
         for c in self.chain.get("filter"):
-            # Ensure all inbound chains have a default drop rule
-            if c.startswith("ACL_INBOUND"):
+            # Ensure all inbound/outbound chains have a default drop rule
+            if c.startswith("ACL_INBOUND") or c.startswith("ACL_OUTBOUND"):
                 list.append(["filter", "", "-A %s -j DROP" % c])
         # PASS 1:  Ensure all chains are present
         for fw in list:
@@ -133,6 +147,8 @@ class CsNetfilters(object):
             new_rule = CsNetfilter()
             new_rule.parse(fw[2])
             new_rule.set_table(fw[0])
+            if isinstance(fw[1], int):
+                new_rule.set_count(fw[1])
             if self.has_rule(new_rule):
                 logging.debug("rule %s exists in table %s", fw[2], new_rule.get_table())
             else:
@@ -142,6 +158,8 @@ class CsNetfilters(object):
                 cpy = fw[2]
                 if fw[1] == "front":
                     cpy = cpy.replace('-A', '-I')
+                if isinstance(fw[1], int):
+                    cpy = cpy.replace("-A %s" % new_rule.get_chain(), '-I %s %s' % (new_rule.get_chain(), fw[1]))
 
                 CsHelper.execute("iptables -t %s %s" % (new_rule.get_table(), cpy))
         self.del_standard()
@@ -189,6 +207,7 @@ class CsNetfilter(object):
         self.table = ''
         self.chain = ''
         self.seen = False
+        self.count = 0
 
     def parse(self, rule):
         self.rule = self.__convert_to_dict(rule)
@@ -227,6 +246,12 @@ class CsNetfilter(object):
     def set_chain(self, chain):
         self.chain = chain
 
+    def set_count(self, count=0):
+        self.count = count
+
+    def get_count(self):
+        return self.count
+
     def get_chain(self):
         return self.chain
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/585f5f70/systemvm/patches/debian/config/opt/cloud/bin/cs/CsProcess.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsProcess.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsProcess.py
old mode 100644
new mode 100755

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/585f5f70/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
old mode 100644
new mode 100755
index 7ada710..dc08b85
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
@@ -174,8 +174,8 @@ class CsRedundant(object):
         ads = [o for o in self.address.get_ips() if o.needs_vrrp()]
         for o in ads:
             pwdsvc = CsPasswdSvc(o.get_gateway()).stop()
-        cl.dbag['config']['redundant_master'] = "false"
-        cl.save()
+        self.cl.set_fault_state()
+        self.cl.save()
         logging.info("Router switched to fault mode")
 
     def set_backup(self):
@@ -201,7 +201,7 @@ class CsRedundant(object):
             pwdsvc = CsPasswdSvc(o.get_gateway()).stop()
         CsHelper.service("dnsmasq", "stop")
         # self._set_priority(self.CS_PRIO_DOWN)
-        self.cl.dbag['config']['redundant_master'] = "false"
+        self.cl.set_master_state(False)
         # CsHelper.service("keepalived", "restart")
         self.cl.save()
         logging.info("Router switched to backup mode")
@@ -235,7 +235,7 @@ class CsRedundant(object):
         for o in ads:
             pwdsvc = CsPasswdSvc(o.get_gateway()).restart()
         CsHelper.service("dnsmasq", "restart")
-        self.cl.dbag['config']['redundant_master'] = "true"
+        self.cl.set_master_state(True)
         self.cl.save()
         # CsHelper.service("keepalived", "restart")
         logging.info("Router switched to master mode")

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/585f5f70/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRoute.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRoute.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRoute.py
old mode 100644
new mode 100755

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/585f5f70/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRule.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRule.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRule.py
old mode 100644
new mode 100755

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/585f5f70/systemvm/patches/debian/config/opt/cloud/bin/cs/__init__.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/__init__.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/__init__.py
old mode 100644
new mode 100755

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/585f5f70/systemvm/patches/debian/config/opt/cloud/bin/cs_cmdline.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs_cmdline.py b/systemvm/patches/debian/config/opt/cloud/bin/cs_cmdline.py
old mode 100644
new mode 100755

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/585f5f70/systemvm/patches/debian/config/opt/cloud/bin/cs_dhcp.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs_dhcp.py b/systemvm/patches/debian/config/opt/cloud/bin/cs_dhcp.py
old mode 100644
new mode 100755

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/585f5f70/systemvm/patches/debian/config/opt/cloud/bin/cs_firewallrules.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs_firewallrules.py b/systemvm/patches/debian/config/opt/cloud/bin/cs_firewallrules.py
old mode 100644
new mode 100755

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/585f5f70/systemvm/patches/debian/config/opt/cloud/bin/cs_forwardingrules.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs_forwardingrules.py b/systemvm/patches/debian/config/opt/cloud/bin/cs_forwardingrules.py
old mode 100644
new mode 100755

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/585f5f70/systemvm/patches/debian/config/opt/cloud/bin/cs_guestnetwork.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs_guestnetwork.py b/systemvm/patches/debian/config/opt/cloud/bin/cs_guestnetwork.py
old mode 100644
new mode 100755

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/585f5f70/systemvm/patches/debian/config/opt/cloud/bin/cs_ip.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs_ip.py b/systemvm/patches/debian/config/opt/cloud/bin/cs_ip.py
old mode 100644
new mode 100755

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/585f5f70/systemvm/patches/debian/config/opt/cloud/bin/cs_loadbalancer.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs_loadbalancer.py b/systemvm/patches/debian/config/opt/cloud/bin/cs_loadbalancer.py
old mode 100644
new mode 100755

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/585f5f70/systemvm/patches/debian/config/opt/cloud/bin/cs_monitorservice.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs_monitorservice.py b/systemvm/patches/debian/config/opt/cloud/bin/cs_monitorservice.py
old mode 100644
new mode 100755

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/585f5f70/systemvm/patches/debian/config/opt/cloud/bin/cs_network_acl.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs_network_acl.py b/systemvm/patches/debian/config/opt/cloud/bin/cs_network_acl.py
old mode 100644
new mode 100755

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/585f5f70/systemvm/patches/debian/config/opt/cloud/bin/cs_site2sitevpn.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs_site2sitevpn.py b/systemvm/patches/debian/config/opt/cloud/bin/cs_site2sitevpn.py
old mode 100644
new mode 100755

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/585f5f70/systemvm/patches/debian/config/opt/cloud/bin/cs_vmdata.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs_vmdata.py b/systemvm/patches/debian/config/opt/cloud/bin/cs_vmdata.py
old mode 100644
new mode 100755

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/585f5f70/systemvm/patches/debian/config/opt/cloud/bin/cs_vmp.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs_vmp.py b/systemvm/patches/debian/config/opt/cloud/bin/cs_vmp.py
old mode 100644
new mode 100755

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/585f5f70/systemvm/patches/debian/config/opt/cloud/bin/get_template_version.sh
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/get_template_version.sh b/systemvm/patches/debian/config/opt/cloud/bin/get_template_version.sh
index 233ec98..996e9dd 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/get_template_version.sh
+++ b/systemvm/patches/debian/config/opt/cloud/bin/get_template_version.sh
@@ -18,7 +18,7 @@
 
 # As the last command send to router before any rules operation, wait until boot up done
 
-__TIMEOUT=60
+__TIMEOUT=240
 __FLAGFILE=/var/cache/cloud/boot_up_done
 done=0
 for i in `seq 1 $(($__TIMEOUT * 10))`


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

Posted by bh...@apache.org.
Fixed rules for dhcp towards v,
Fixed fw rules for a bunch of things
Bring public interface up if no tier has been defined


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

Branch: refs/heads/master
Commit: 9e82281cc1a2be4e2c00499a62bc79548b7ed202
Parents: 4c9f4fc
Author: Ian Southam <is...@schubergphilis.com>
Authored: Wed Feb 4 17:44:05 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:39:58 2015 +0100

----------------------------------------------------------------------
 .../debian/config/opt/cloud/bin/cs/CsAddress.py | 92 +++++++++-----------
 .../debian/config/opt/cloud/bin/cs/CsDatabag.py |  4 +-
 .../config/opt/cloud/bin/cs/CsRedundant.py      |  8 +-
 3 files changed, 49 insertions(+), 55 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9e82281c/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
index 9e4e687..54a40a1 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
@@ -96,7 +96,6 @@ class CsAddress(CsDataBag):
             if dev == "id":
                 continue
             ip = CsIP(dev, self.config)
-            addcnt = 0
             for address in self.dbag[dev]:
                 if not address["nw_type"] == "control":
                     CsRoute(dev).add(address)
@@ -108,37 +107,6 @@ class CsAddress(CsDataBag):
                     logging.info("Address %s on device %s not configured", ip.ip(), dev)
                     if CsDevice(dev, self.config).waitfordevice():
                         ip.configure()
-                # This could go one level up but the ip type is stored in the
-                # ip address object and not in the device object
-                # Call only once
-                if addcnt == 0:
-                    self.add_netstats(address)
-                addcnt += 1
-
-    def add_netstats(self, address):
-        # add in the network stats iptables rules
-        dev = "eth%s" % address['nic_dev_id']
-        if address["nw_type"] == "public":
-            self.fw.append(["", "front", "-A FORWARD -j NETWORK_STATS"])
-            self.fw.append(["", "front", "-A INPUT -j NETWORK_STATS"])
-            self.fw.append(["", "front", "-A OUTPUT -j NETWORK_STATS"])
-            # it is not possible to calculate these devices
-            # When the vrouter and the vpc router are combined this silliness can go
-            self.fw.append(["", "", "-A NETWORK_STATS -i %s -o eth0 -p tcp" % dev])
-            self.fw.append(["", "", "-A NETWORK_STATS -o %s -i eth0 -p tcp" % dev])
-            self.fw.append(["", "", "-A NETWORK_STATS -o %s ! -i eth0 -p tcp" % dev])
-            self.fw.append(["", "", "-A NETWORK_STATS -i %s ! -o eth0 -p tcp" % dev])
-
-        # Netstats per interface only used on VPC
-        if address["nw_type"] == "guest" and self.config.is_vpc():
-            self.fw.append(["", "front", "-A FORWARD -j NETWORK_STATS_%s" % dev])
-            self.fw.append(["", "front", "-A NETWORK_STATS_%s -o %s -s %s" % (dev, dev, address['network'])])
-            self.fw.append(["", "front", "-A NETWORK_STATS_%s -o %s -d %s" % (dev, dev, address['network'])])
-            # Only relevant if there is a VPN configured so will have to move
-            # at some stage
-            self.fw.append(["mangle", "", "-A FORWARD -j VPN_STATS_%s" % dev])
-            self.fw.append(["mangle", "", "-A VPN_STATS_%s -o %s -m mark --set-xmark 0x525/0xffffffff" % (dev, dev)])
-            self.fw.append(["mangle", "", "-A VPN_STATS_%s -i %s -m mark --set-xmark 0x524/0xffffffff" % (dev, dev)])
 
 
 class CsInterface:
@@ -298,7 +266,7 @@ class CsIP:
         for i in CsHelper.execute(cmd):
             if " DOWN " in i:
                 cmd2 = "ip link set %s up" % self.getDevice()
-                # If redundant do not bring up public interfaces 
+                # If redundant do not bring up public interfaces
                 # master.py and keepalived deal with tham
                 if self.config.cmdline().is_redundant() and not self.is_public():
                     CsHelper.execute(cmd2)
@@ -392,7 +360,46 @@ class CsIP:
     def fw_vpcrouter(self):
         if not self.config.is_vpc():
             return
-        # TODO seperate out vpc rules
+        self.fw.append(["mangle", "front", "-A PREROUTING " +
+                        "-m state --state RELATED,ESTABLISHED " +
+                        "-j CONNMARK --restore-mark --nfmask 0xffffffff --ctmask 0xffffffff"])
+        if self.get_type() in ["guest"]:
+            self.fw.append(["filter", "", "-A INPUT -i %s -p udp -m udp --dport 67 -j ACCEPT" % self.dev])
+            self.fw.append(["filter", "", "-A INPUT -i %s -p udp -m udp --dport 53 -j ACCEPT" % self.dev])
+            self.fw.append(["filter", "", "-A INPUT -i %s -p tcp -m tcp --dport 53 -j ACCEPT" % self.dev])
+            self.fw.append(["mangle", "",
+                            "-A PREROUTING -m state --state NEW -i %s -s %s ! -d %s/32 -j ACL_OUTBOUND_%s" %
+                            (self.dev, self.address['network'], self.address['gateway'], self.dev)
+                            ])
+            self.fw.append(["", "front", "-A NETWORK_STATS_%s -o %s -s %s" % ("eth1", "eth1", self.address['network'])])
+            self.fw.append(["", "front", "-A NETWORK_STATS_%s -o %s -d %s" % ("eth1", "eth1", self.address['network'])])
+
+        if self.get_type() in ["public"]:
+            self.fw.append(["nat", "front",
+                            "-A POSTROUTING -o %s -j SNAT --to-source %s" %
+                           (self.dev, self.address['public_ip'])
+                            ])
+            self.fw.append(["nat", "front",
+                            "-A POSTROUTING -s %s -o %s -j SNAT --to-source %s" %
+                           (self.address['network'], self.dev,
+                            self.address['public_ip'])
+                            ])
+            self.fw.append(["", "front",
+                            "-A FORWARD -o %s -d %s -j ACL_INBOUND_%s" % (self.dev, self.address['network'], self.dev)
+                            ])
+            self.fw.append(["mangle", "", "-A FORWARD -j VPN_STATS_%s" % self.dev])
+            self.fw.append(["mangle", "", "-A VPN_STATS_%s -o %s -m mark --mark 0x525/0xffffffff" % (self.dev, self.dev)])
+            self.fw.append(["mangle", "", "-A VPN_STATS_%s -i %s -m mark --mark 0x524/0xffffffff" % (self.dev, self.dev)])
+            self.fw.append(["", "front", "-A FORWARD -j NETWORK_STATS_%s" % self.dev])
+
+        self.fw.append(["", "front", "-A FORWARD -j NETWORK_STATS"])
+        self.fw.append(["", "front", "-A INPUT -j NETWORK_STATS"])
+        self.fw.append(["", "front", "-A OUTPUT -j NETWORK_STATS"])
+
+        self.fw.append(["", "", "-A NETWORK_STATS -i eth0 -o eth2 -p tcp"])
+        self.fw.append(["", "", "-A NETWORK_STATS -i eth2 -o eth0 -p tcp"])
+        self.fw.append(["", "", "-A NETWORK_STATS ! -i eth0 -o eth2 -p tcp"])
+        self.fw.append(["", "", "-A NETWORK_STATS -i eth2 ! -o eth0 -p tcp"])
 
     def post_config_change(self, method):
         route = CsRoute(self.dev)
@@ -402,24 +409,9 @@ class CsIP:
         self.fw_vpcrouter()
         # On deletion nw_type will no longer be known
         if self.get_type() in ["guest"] and self.config.is_vpc():
-            devChain = self.config.get_ingress_chain(self.dev, self.address['public_ip'])
-            CsDevice(self.dev, self.config).configure_rp()
 
-            self.fw.append(["nat", "front",
-                            "-A POSTROUTING -s %s -o %s -j SNAT --to-source %s" %
-                           (self.address['network'], self.dev,
-                            self.address['public_ip'])
-                            ])
-            self.fw.append(["mangle", "front", "-A %s -j ACCEPT" % devChain])
+            CsDevice(self.dev, self.config).configure_rp()
 
-            self.fw.append(["", "front",
-                            "-A FORWARD -o %s -d %s -j %s" % (self.dev, self.address['network'], devChain)
-                            ])
-            self.fw.append(["", "", "-A %s -j DROP" % devChain])
-            self.fw.append(["mangle", "",
-                            "-A PREROUTING -m state --state NEW -i %s -s %s ! -d %s/32 -j %s" %
-                            (self.dev, self.address['network'], self.address['public_ip'], devChain)
-                            ])
             logging.error("Not able to setup sourcenat for a regular router yet")
             dns = CsDnsmasq(self)
             dns.add_firewall_rules()

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9e82281c/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 e6ad6e5..4ace7bb 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDatabag.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDatabag.py
@@ -114,8 +114,8 @@ class CsCmdLine(CsDataBag):
     def is_master(self):
         if not self.is_redundant():
             return False
-        if "redundant_master" in self.idata():
-            return self.idata()['redundant_master'] == "true"
+        if "redundant_state" in self.idata():
+            return self.idata()['redundant_state'] == "MASTER"
         return False
 
     def get_state(self):

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9e82281c/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 7e4dcab..56902f0 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
@@ -82,6 +82,11 @@ class CsRedundant(object):
         # No redundancy if there is no guest network
         if guest is None:
             self._redundant_off()
+            # Bring up the public Interface(s)
+            if self.cl.is_master():
+                for obj in [o for o in self.address.get_ips() if o.is_public()]:
+                    print obj.get_device()
+                    self.check_is_up(obj.get_device())
             return
         CsHelper.mkdir(self.CS_RAMDISK_DIR, 0755, False)
         CsHelper.mount_tmpfs(self.CS_RAMDISK_DIR)
@@ -113,8 +118,6 @@ class CsRedundant(object):
         file.search(" router_id ", "    router_id %s" % self.cl.get_name())
         file.search(" priority ", "    priority %s" % self.cl.get_priority())
         file.search(" interface ", "    interface %s" % guest.get_device())
-        #file.search(" weight ", "    weight %s" % 2)
-        # file.search(" state ", "    state %s" % self.cl.get_state())
         file.search(" state ", "    state %s" % "EQUAL")
         file.search(" virtual_router_id ", "    virtual_router_id %s" % self.cl.get_router_id())
         file.greplace("[RROUTER_BIN_PATH]", self.CS_ROUTER_DIR)
@@ -255,7 +258,6 @@ class CsRedundant(object):
             if o.needs_vrrp():
                 str = "        %s brd %s dev %s\n" % (o.get_gateway_cidr(), o.get_broadcast(), o.get_device())
                 lines.append(str)
-                # This is wrong set_master and set_backup need to do this
                 self.check_is_up(o.get_device())
         return lines
 


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

Posted by bh...@apache.org.
Implementing redundant router arguments to add redundant_state
Implementing the arguments on the python side


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

Branch: refs/heads/master
Commit: a5d6f90f666798e7575c6b7d3af5b3024af8768e
Parents: 279f1a2
Author: wilderrodrigues <wr...@schubergphilis.com>
Authored: Mon Jan 26 17:33:50 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:39:51 2015 +0100

----------------------------------------------------------------------
 .../VirtualNetworkApplianceManagerImpl.java     | 40 +++++++++++++-------
 .../VpcVirtualNetworkApplianceManagerImpl.java  | 16 ++------
 .../debian/config/opt/cloud/bin/cs/CsDatabag.py |  5 +++
 .../config/opt/cloud/bin/cs/CsRedundant.py      |  3 +-
 4 files changed, 38 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a5d6f90f/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 a3f56c6..f0730f5 100644
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -1060,8 +1060,8 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
 
         /*
          * In order to make fail-over works well at any time, we have to ensure:
-         * 1. Backup router's priority = Master's priority - DELTA + 1 2. Backup
-         * router's priority hasn't been bumped up.
+         * 1. Backup router's priority = Master's priority - DELTA + 1
+         * 2. Backup router's priority hasn't been bumped up.
          */
         private void checkSanity(final List<DomainRouterVO> routers) {
             final Set<Long> checkedNetwork = new HashSet<Long>();
@@ -1137,15 +1137,8 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
         protected void runInContext() {
             while (true) {
                 try {
-                    final Long networkId = _vrUpdateQueue.take(); // This is a
-                    // blocking
-                    // call so
-                    // this thread
-                    // won't run
-                    // all the
-                    // time if no
-                    // work item
-                    // in queue.
+                    final Long networkId = _vrUpdateQueue.take();
+                    // This is a blocking call so this thread won't run all the time if no work item in queue.
                     final List<DomainRouterVO> routers = _routerDao.listByNetworkAndRole(networkId, Role.VIRTUAL_ROUTER);
 
                     if (routers.size() != 2) {
@@ -1159,7 +1152,7 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
                     final DomainRouterVO router0 = routers.get(0);
                     final DomainRouterVO router1 = routers.get(1);
                     DomainRouterVO router = router0;
-                    if (router0.getId() < router1.getId() && router0.getHostId() != null) {
+                    if (router0.getId() < router1.getId()) {
                         router = router0;
                     } else {
                         router = router1;
@@ -1596,7 +1589,28 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
         final boolean isRedundant = router.getIsRedundantRouter();
         if (isRedundant) {
             buf.append(" redundant_router=1");
-            final List<DomainRouterVO> routers = _routerDao.listByNetworkAndRole(nic.getNetworkId(), Role.VIRTUAL_ROUTER);
+
+            final Long vpcId = router.getVpcId();
+            final List<DomainRouterVO> routers;
+            if (vpcId != null) {
+                routers = _routerDao.listByVpcId(vpcId);
+            } else {
+                routers = _routerDao.listByNetworkAndRole(nic.getNetworkId(), Role.VIRTUAL_ROUTER);
+            }
+
+            String redundantState = RedundantState.BACKUP.toString();
+            if (routers.size() == 0) {
+                redundantState = RedundantState.MASTER.toString();
+            } else {
+                final DomainRouterVO router0 = routers.get(0);
+
+                if (router.getId() == router0.getId()) {
+                    redundantState = RedundantState.MASTER.toString();
+                }
+            }
+
+            buf.append(" redundant_state=").append(redundantState);
+
             try {
                 final int priority = getUpdatedPriority(network, routers, router);
                 router.setPriority(priority);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a5d6f90f/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
index f06b1ba..77cc0de 100644
--- a/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
@@ -236,7 +236,9 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
     public boolean finalizeVirtualMachineProfile(final VirtualMachineProfile profile, final DeployDestination dest, final ReservationContext context) {
         final DomainRouterVO domainRouterVO = _routerDao.findById(profile.getId());
 
-        if (domainRouterVO.getVpcId() != null) {
+        final Long vpcId = domainRouterVO.getVpcId();
+
+        if (vpcId != null) {
             if (domainRouterVO.getState() == State.Starting || domainRouterVO.getState() == State.Running) {
                 String defaultDns1 = null;
                 String defaultDns2 = null;
@@ -257,7 +259,7 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
 
                 // add vpc cidr/dns/networkdomain to the boot load args
                 final StringBuilder buf = profile.getBootArgsBuilder();
-                final Vpc vpc = _entityMgr.findById(Vpc.class, domainRouterVO.getVpcId());
+                final Vpc vpc = _entityMgr.findById(Vpc.class, vpcId);
                 buf.append(" vpccidr=" + vpc.getCidr() + " domain=" + vpc.getNetworkDomain());
 
                 buf.append(" dns1=").append(defaultDns1);
@@ -689,16 +691,6 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
     }
 
     @Override
-    public boolean start() {
-        return true;
-    }
-
-    @Override
-    public boolean stop() {
-        return true;
-    }
-
-    @Override
     public boolean startRemoteAccessVpn(final RemoteAccessVpn vpn, final VirtualRouter router) throws ResourceUnavailableException {
         if (router.getState() != State.Running) {
             s_logger.warn("Unable to apply remote access VPN configuration, virtual router is not in the right state " + router.getState());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a5d6f90f/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 fbafad2..d1d899b 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDatabag.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDatabag.py
@@ -125,3 +125,8 @@ class CsCmdLine(CsDataBag):
         if "redundant_master" in self.idata():
             return self.idata()['redundant_master'] == "true"
         return False
+    
+    def get_state(self):
+        if "redundant_state" in self.idata():
+            return self.idata()['redundant_state']
+        return "MASTER"
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a5d6f90f/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 d9d36e2..267cc1c 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
@@ -101,6 +101,7 @@ class CsRedundant(object):
         file.search(" router_id ", "    router_id %s" % self.cl.get_name())
         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.greplace("[RROUTER_BIN_PATH]", self.CS_ROUTER_DIR)
         file.section("virtual_ipaddress {", "}", self._collect_ips())
         file.commit()
@@ -121,7 +122,7 @@ class CsRedundant(object):
         if connt.is_changed():
             CsHelper.service("conntrackd", "restart")
 
-        if file.is_changed():
+        if file.is_changed() and self.cl.get_state() == 'MASTER':
             CsHelper.service("keepalived", "restart")
 
         # FIXME


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

Posted by bh...@apache.org.
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);


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

Posted by bh...@apache.org.
generate random password for redundant VPC


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

Branch: refs/heads/master
Commit: 4b6604318dad00d92c0307a114ef7d84b9096e16
Parents: baa758a
Author: wilderrodrigues <wr...@schubergphilis.com>
Authored: Tue Feb 10 16:43:40 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:40:06 2015 +0100

----------------------------------------------------------------------
 .../VirtualNetworkApplianceManagerImpl.java     | 26 +++++++++++++++++++-
 .../VpcVirtualNetworkApplianceManagerImpl.java  |  3 ---
 .../debian/config/opt/cloud/bin/cs/CsDatabag.py |  5 ++++
 .../config/opt/cloud/bin/cs/CsRedundant.py      |  1 +
 .../opt/cloud/templates/keepalived.conf.templ   |  2 +-
 5 files changed, 32 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4b660431/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 234c745..5a97eb3 100644
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -17,6 +17,9 @@
 
 package com.cloud.network.router;
 
+import java.math.BigInteger;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
@@ -177,6 +180,8 @@ import com.cloud.network.rules.StaticNat;
 import com.cloud.network.rules.StaticNatImpl;
 import com.cloud.network.rules.StaticNatRule;
 import com.cloud.network.rules.dao.PortForwardingRulesDao;
+import com.cloud.network.vpc.Vpc;
+import com.cloud.network.vpc.dao.VpcDao;
 import com.cloud.network.vpn.Site2SiteVpnManager;
 import com.cloud.offering.NetworkOffering;
 import com.cloud.offering.ServiceOffering;
@@ -356,6 +361,8 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
     @Inject
     AsyncJobManager _asyncMgr;
     @Inject
+    protected VpcDao _vpcDao;
+    @Inject
     protected ApiAsyncJobDispatcher _asyncDispatcher;
     @Inject
     OpRouterMonitorServiceDao _opRouterMonitorServiceDao;
@@ -1174,7 +1181,7 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
                         router = router1;
                     }
                     // && router.getState() == State.Stopped
-                    if (router.getHostId() == null) {
+                    if (router.getHostId() == null && router.getState() == State.Running) {
                         s_logger.debug("Skip router pair (" + router0.getInstanceName() + "," + router1.getInstanceName() + ") due to can't find host");
                         continue;
                     }
@@ -1623,6 +1630,23 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
                 // 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);
+
+                // Will build the routers password based on the VPC ID and UUID.
+                final Vpc vpc = _vpcDao.findById(vpcId);
+
+                try {
+                    final MessageDigest digest = MessageDigest.getInstance("SHA-512");
+                    final byte [] rawDigest = vpc.getUuid().getBytes();
+                    digest.update(rawDigest);
+
+                    final BigInteger password = new BigInteger(1, digest.digest());
+                    buf.append(" router_password=").append(password);
+
+                } catch (final NoSuchAlgorithmException e) {
+                    s_logger.error("Failed to pssword! Will use the plan B instead.");
+                    buf.append(" router_password=").append(vpc.getUuid());
+                }
+
             } else {
                 routers = _routerDao.listByNetworkAndRole(nic.getNetworkId(), Role.VIRTUAL_ROUTER);
             }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4b660431/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
index 77cc0de..f10e5a1 100644
--- a/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
@@ -74,7 +74,6 @@ import com.cloud.network.vpc.VpcManager;
 import com.cloud.network.vpc.VpcVO;
 import com.cloud.network.vpc.dao.PrivateIpDao;
 import com.cloud.network.vpc.dao.StaticRouteDao;
-import com.cloud.network.vpc.dao.VpcDao;
 import com.cloud.network.vpc.dao.VpcGatewayDao;
 import com.cloud.network.vpn.Site2SiteVpnManager;
 import com.cloud.user.UserStatisticsVO;
@@ -100,8 +99,6 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
     private static final Logger s_logger = Logger.getLogger(VpcVirtualNetworkApplianceManagerImpl.class);
 
     @Inject
-    private VpcDao _vpcDao;
-    @Inject
     private NetworkACLManager _networkACLMgr;
     @Inject
     private VMInstanceDao _vmDao;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4b660431/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 4ace7bb..d58a642 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDatabag.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDatabag.py
@@ -127,3 +127,8 @@ class CsCmdLine(CsDataBag):
         if "router_id" in self.idata():
             return self.idata()['router_id']
         return 1
+
+    def get_router_password(self):
+        if "router_password" in self.idata():
+            return self.idata()['router_password']
+        return "k3ep@liv3D"

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4b660431/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 5054f76..a947fd1 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
@@ -122,6 +122,7 @@ class CsRedundant(object):
         file.search(" state ", "    state %s" % "EQUAL")
         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("authentication {", "}", [ "        auth_type AH \n", "        auth_pass %s\n" % self.cl.get_router_password()] )
         file.section("virtual_ipaddress {", "}", self._collect_ips())
         file.commit()
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4b660431/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 957b913..f494df0 100644
--- a/systemvm/patches/debian/config/opt/cloud/templates/keepalived.conf.templ
+++ b/systemvm/patches/debian/config/opt/cloud/templates/keepalived.conf.templ
@@ -40,7 +40,7 @@ vrrp_instance inside_network {
     advert_int 1
     authentication {
         auth_type AH
-        auth_pass k33p@live
+        auth_pass PASS
     }
 
     virtual_ipaddress {


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

Posted by bh...@apache.org.
Mistake no I set no priority!


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

Branch: refs/heads/master
Commit: 267bc525799abf048d1ac45a7f280d0a8bb2aaa0
Parents: 2b0c4c8
Author: Ian Southam <is...@schubergphilis.com>
Authored: Wed Jan 28 17:09:47 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:39:54 2015 +0100

----------------------------------------------------------------------
 systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/267bc525/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 1db27ad..94faeb6 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
@@ -99,7 +99,7 @@ class CsRedundant(object):
         # keepalived configuration
         file = CsFile(self.KEEPALIVED_CONF)
         file.search(" router_id ", "    router_id %s" % self.cl.get_name())
-        # file.search(" priority ", "    priority %s" % self.cl.get_priority())
+        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(" state ", "    state %s" % "EQUAL")


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

Posted by bh...@apache.org.
Better message about making the VPC redundant
Remove the labels in other languages: Hugo told me there is a team responsible for that


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

Branch: refs/heads/master
Commit: dfa37b31593a9be76f5af2beb5f381b1dd6b6b88
Parents: ca9deb7
Author: wilderrodrigues <wr...@schubergphilis.com>
Authored: Thu Feb 5 10:37:29 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:40:00 2015 +0100

----------------------------------------------------------------------
 client/WEB-INF/classes/resources/messages.properties       | 2 +-
 client/WEB-INF/classes/resources/messages_ar.properties    | 2 --
 client/WEB-INF/classes/resources/messages_es.properties    | 2 --
 client/WEB-INF/classes/resources/messages_fr_FR.properties | 2 --
 client/WEB-INF/classes/resources/messages_it_IT.properties | 2 --
 client/WEB-INF/classes/resources/messages_ja_JP.properties | 2 --
 client/WEB-INF/classes/resources/messages_ko_KR.properties | 2 --
 client/WEB-INF/classes/resources/messages_zh_CN.properties | 2 --
 8 files changed, 1 insertion(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dfa37b31/client/WEB-INF/classes/resources/messages.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages.properties b/client/WEB-INF/classes/resources/messages.properties
index 6beab8a..6acffd0 100644
--- a/client/WEB-INF/classes/resources/messages.properties
+++ b/client/WEB-INF/classes/resources/messages.properties
@@ -1035,7 +1035,7 @@ label.resources=Resources
 label.restart.network=Restart network
 label.restart.required=Restart required
 label.restart.vpc=Restart VPC
-message.restart.vpc.remark=Remark: making a single VPC redundant will force a clean up. The network will not be available for a couple of minutes.
+message.restart.vpc.remark=Please confirm that you want to restart the VPC <p><small><i>Remark: making a non-redundant VPC redundant will force a clean up. The networks will not be available for a couple of minutes</i></small></p>.
 label.restore=Restore
 label.retry.interval=Retry Interval
 label.review=Review

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dfa37b31/client/WEB-INF/classes/resources/messages_ar.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_ar.properties b/client/WEB-INF/classes/resources/messages_ar.properties
index 728b2d4..de90c43 100644
--- a/client/WEB-INF/classes/resources/messages_ar.properties
+++ b/client/WEB-INF/classes/resources/messages_ar.properties
@@ -47,7 +47,6 @@ label.change.value=\u062a\u063a\u064a\u0631 \u0627\u0644\u0642\u064a\u0645\u0629
 label.CIDR.list=\u0642\u0627\u0626\u0645\u0629 CIDR
 label.CIDR.of.destination.network=CIDR \u0627\u0644\u062e\u0627\u0635 \u0628\u0627\u0644\u0634\u0628\u0643\u0629 \u0627\u0644\u0645\u0648\u062c\u0647\u0629.
 label.clean.up=\u062a\u0646\u0638\u064a\u0641
-label.make.redundant=\u062c\u0639\u0644 \u0632\u0627\u0626\u062f\u0629 \u0639\u0646 \u0627\u0644\u062d\u0627\u062c\u0629
 label.clear.list=\u0645\u0633\u062d \u0627\u0644\u0642\u0627\u0626\u0645\u0629
 label.configuration=\u0627\u0644\u062a\u0643\u0648\u064a\u0646
 label.configure.network.ACLs=\u0636\u0628\u0637 \u0634\u0628\u0643\u0629 ACLs
@@ -160,7 +159,6 @@ label.reset.VPN.connection=\u0625\u0639\u0627\u062f\u0629 \u062a\u0639\u064a\u06
 label.restart.network=\u0625\u0639\u0627\u062f\u0629 \u062a\u0634\u063a\u064a\u0644 \u0627\u0644\u0634\u0628\u0643\u0629
 label.restart.required=\u0645\u0637\u0644\u0648\u0628 \u0625\u0639\u0627\u062f\u0629 \u0627\u0644\u062a\u0634\u063a\u064a\u0644
 label.restart.vpc=\u0625\u0639\u062f\u0627\u0629 \u062a\u0634\u063a\u064a\u0644 VPC
-message.restart.vpc.remark=\u0645\u0644\u0627\u062d\u0638\u0629\u003a \u062c\u0639\u0644 \u0632\u0627\u0626\u062f\u0629 \u0639\u0646 \u0627\u0644\u062d\u0627\u062c\u0629 \u0056\u0050\u0043 \u0633\u064a\u062c\u0628\u0631 \u0639\u0644\u0649 \u062a\u0646\u0638\u064a\u0641\u002e \u0644\u0646 \u062a\u0643\u0648\u0646 \u0627\u0644\u0634\u0628\u0643\u0629 \u0645\u062a\u0627\u062d\u0629 \u0644\u0628\u0636\u0639 \u062f\u0642\u0627\u0626\u0642\u002e
 label.restore=\u0625\u0633\u062a\u0639\u0627\u062f\u0629
 label.review=\u0645\u0631\u0627\u062c\u0639\u0629
 label.revoke.project.invite=\u0625\u0644\u063a\u0627\u0621 \u0627\u0644\u062f\u0639\u0648\u0629

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dfa37b31/client/WEB-INF/classes/resources/messages_es.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_es.properties b/client/WEB-INF/classes/resources/messages_es.properties
index c0c1b9b..b61485a 100644
--- a/client/WEB-INF/classes/resources/messages_es.properties
+++ b/client/WEB-INF/classes/resources/messages_es.properties
@@ -332,7 +332,6 @@ label.cidr=CIDR
 label.cidr.list=fuente CIDR
 label.CIDR.list=Lista CIDR
 label.clean.up=Limpiar
-label.make.redundant=\u0068\u0061\u0063\u0065\u0072 \u0072\u0065\u0064\u0075\u006e\u0064\u0061\u006e\u0074\u0065
 label.clear.list=Limpiar lista
 label.close=Cerrar
 label.cloud.console=Cloud Management Console
@@ -759,7 +758,6 @@ label.resource.state=Estado del recurso
 label.restart.network=Reiniciar red
 label.restart.required=Reiniciado requerido
 label.restart.vpc=Reiniciar VPC
-message.restart.vpc.remark=\u004f\u0062\u0073\u0065\u0072\u0076\u0061\u0063\u0069\u00f3\u006e\u003a \u0068\u0061\u0063\u0065\u0072 \u0075\u006e\u0061 \u0072\u0065\u0064\u0075\u006e\u0064\u0061\u006e\u0074\u0065 \u0056\u0050\u0043 \u006f\u0062\u006c\u0069\u0067\u0061\u0072\u00e1 \u0061 \u0075\u006e\u0061 \u006c\u0069\u006d\u0070\u0069\u0065\u007a\u0061\u002e \u004c\u0061 \u0072\u0065\u0064 \u006e\u006f \u0065\u0073\u0074\u0061\u0072\u00e1 \u0064\u0069\u0073\u0070\u006f\u006e\u0069\u0062\u006c\u0065 \u0064\u0075\u0072\u0061\u006e\u0074\u0065 \u0075\u006e \u0070\u0061\u0072 \u0064\u0065 \u006d\u0069\u006e\u0075\u0074\u006f\u0073\u002e
 label.restore=Restaurar
 label.role=Papel
 label.root.disk.offering=Root Disco Offering

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dfa37b31/client/WEB-INF/classes/resources/messages_fr_FR.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_fr_FR.properties b/client/WEB-INF/classes/resources/messages_fr_FR.properties
index 30dbe2e..c24fce3 100644
--- a/client/WEB-INF/classes/resources/messages_fr_FR.properties
+++ b/client/WEB-INF/classes/resources/messages_fr_FR.properties
@@ -455,7 +455,6 @@ label.cisco.nexus1000v.password=Mot de passe Nexus 1000v
 label.cisco.nexus1000v.username=Identifiant Nexus 1000v
 label.ciscovnmc.resource.details=D\u00e9tails ressource CiscoVNMC
 label.clean.up=Nettoyage
-label.make.redundant=\u006c\u0069\u0063\u0065\u006e\u0063\u0069\u0065\u0072
 label.clear.list=Purger la liste
 label.close=Fermer
 label.cloud.console=Console d\\'Administration du Cloud
@@ -1224,7 +1223,6 @@ label.response.timeout.in.sec=D\u00e9lai d\\'attente de r\u00e9ponse (sec)
 label.restart.network=Red\u00e9marrage du r\u00e9seau
 label.restart.required=Red\u00e9marrage n\u00e9cessaire
 label.restart.vpc=Red\u00e9marrer le VPC
-message.restart.vpc.remark=\u0052\u0065\u006d\u0061\u0072\u0071\u0075\u0065\u003a \u0066\u0061\u0069\u0072\u0065 \u0075\u006e\u0065 \u0072\u0065\u0064\u006f\u006e\u0064\u0061\u006e\u0074\u0065 \u0056\u0050\u0043 \u0076\u0061 \u0066\u006f\u0072\u0063\u0065\u0072 \u0075\u006e \u006e\u0065\u0074\u0074\u006f\u0079\u0061\u0067\u0065\u002e \u0052\u00e9\u0073\u0065\u0061\u0075 \u006e\u0065 \u0073\u0065\u0072\u0061 \u0070\u0061\u0073 \u0064\u0069\u0073\u0070\u006f\u006e\u0069\u0062\u006c\u0065 \u0070\u006f\u0075\u0072 \u0075\u006e \u0063\u006f\u0075\u0070\u006c\u0065 \u0064\u0065 \u006d\u0069\u006e\u0075\u0074\u0065\u0073\u002e
 label.restore=Restaurer
 label.retry.interval=Interval du nouvel essai
 label.review=Revoir

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dfa37b31/client/WEB-INF/classes/resources/messages_it_IT.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_it_IT.properties b/client/WEB-INF/classes/resources/messages_it_IT.properties
index a18126b..7a9a665 100644
--- a/client/WEB-INF/classes/resources/messages_it_IT.properties
+++ b/client/WEB-INF/classes/resources/messages_it_IT.properties
@@ -277,7 +277,6 @@ label.CIDR.of.destination.network=Valore CIDR della rete di destinazione
 label.clear.list=Pulizia dell\\'elenco
 label.cloud.console=Console di Gestione Cloud
 label.clean.up=Ripulire
-label.make.redundant=\u004e\u006f\u0074\u0061\u003a \u0066\u0061\u0063\u0065\u006e\u0064\u006f \u0075\u006e \u0072\u0069\u0064\u006f\u006e\u0064\u0061\u006e\u0074\u0065 \u0056\u0050\u0043 \u0066\u006f\u0072\u007a\u0065\u0072\u00e0 \u0075\u006e\u0061 \u0070\u0075\u006c\u0069\u007a\u0069\u0061\u002e \u004e\u0065\u0074\u0077\u006f\u0072\u006b \u006e\u006f\u006e \u0073\u0061\u0072\u00e0 \u0064\u0069\u0073\u0070\u006f\u006e\u0069\u0062\u0069\u006c\u0065 \u0070\u0065\u0072 \u0075\u006e \u0070\u0061\u0069\u006f \u0064\u0069 \u006d\u0069\u006e\u0075\u0074\u0069\u002e
 label.cluster=Cluster
 label.cluster.name=Nome del Cluster
 label.clusters=Cluster
@@ -519,7 +518,6 @@ label.resource.state=Stato della risorsa
 label.restart.network=Riavviare il servizio di rete
 label.restart.required=E\\' necessario un riavvio
 label.restart.vpc=Riavviare VPC
-message.restart.vpc.remark=
 label.restore=Restore
 label.review=Riesaminare
 label.revoke.project.invite=Revocare un invit

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dfa37b31/client/WEB-INF/classes/resources/messages_ja_JP.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_ja_JP.properties b/client/WEB-INF/classes/resources/messages_ja_JP.properties
index 46cc35d..7d6c6ae 100644
--- a/client/WEB-INF/classes/resources/messages_ja_JP.properties
+++ b/client/WEB-INF/classes/resources/messages_ja_JP.properties
@@ -445,7 +445,6 @@ label.cidr.list=\u9001\u4fe1\u5143 CIDR
 label.CIDR.of.destination.network=\u5b9b\u5148\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306e CIDR
 label.cidr=CIDR
 label.clean.up=\u30af\u30ea\u30fc\u30f3 \u30a2\u30c3\u30d7\u3059\u308b
-label.make.redundant=\u5197\u9577\u5316
 label.clear.list=\u4e00\u89a7\u306e\u6d88\u53bb
 label.close=\u9589\u3058\u308b
 label.cloud.console=\u30af\u30e9\u30a6\u30c9\u7ba1\u7406\u30b3\u30f3\u30bd\u30fc\u30eb
@@ -1025,7 +1024,6 @@ label.resources=\u30ea\u30bd\u30fc\u30b9
 label.restart.network=\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306e\u518d\u8d77\u52d5
 label.restart.required=\u518d\u8d77\u52d5\u304c\u5fc5\u8981
 label.restart.vpc=VPC \u306e\u518d\u8d77\u52d5
-message.restart.vpc.remark=\u5099\u8003\uff1a\u30af\u30ea\u30fc\u30f3\u30a2\u30c3\u30d7\u3092\u5f37\u5236\u7684\u306b\u0056\u0050\u0043\u306e\u5197\u9577\u5316\u3092\u884c\u3046\u3002\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u304c\u6570\u5206\u9593\u4f7f\u7528\u3067\u304d\u306a\u304f\u306a\u308a\u307e\u3059\u3002
 label.restore=\u5fa9\u5143
 label.retry.interval=\u518d\u8a66\u884c\u9593\u9694
 label.review=\u78ba\u8a8d

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dfa37b31/client/WEB-INF/classes/resources/messages_ko_KR.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_ko_KR.properties b/client/WEB-INF/classes/resources/messages_ko_KR.properties
index 7f29399..5886388 100644
--- a/client/WEB-INF/classes/resources/messages_ko_KR.properties
+++ b/client/WEB-INF/classes/resources/messages_ko_KR.properties
@@ -375,7 +375,6 @@ label.CIDR.list=CIDR \ubaa9\ub85d
 label.cidr.list=\uc804\uc1a1\uc6d0 CIDR
 label.CIDR.of.destination.network=\ub300\uc0c1 \ub124\ud2b8\uc6cc\ud06c CIDR
 label.clean.up=\uc0ad\uc81c\ud558\uae30
-label.make.redundant=\uc911\ubcf5 \ud655\uc778
 label.clear.list=\ubaa9\ub85d \uc0ad\uc81c
 label.close=\ub2eb\uae30
 label.cloud.console=\ud074\ub77c\uc6b0\ub4dc \uad00\ub9ac \ucf58\uc194
@@ -897,7 +896,6 @@ label.resource=\uc790\uc6d0
 label.restart.network=\ub124\ud2b8\uc6cc\ud06c \uc7ac\uc2dc\uc791
 label.restart.required=\uc7ac\uc2dc\uc791 \ud544\uc694
 label.restart.vpc=VPC \uc7ac\uc2dc\uc791
-message.restart.vpc.remark=\ube44\uace0 \u003a \uc815\ub9ac\ub97c \uac15\uc81c \u0056\u0050\u0043\uc758 \uc911\ubcf5\uc744\u002e \ub124\ud2b8\uc6cc\ud06c\ub294 \uba87 \ubd84\uc744 \uc0ac\uc6a9\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4\u002e
 label.review=\ud655\uc778
 label.revoke.project.invite=\ucd08\ub300 \ucde8\uc18c
 label.role=\uc5ed\ud560

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dfa37b31/client/WEB-INF/classes/resources/messages_zh_CN.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_zh_CN.properties b/client/WEB-INF/classes/resources/messages_zh_CN.properties
index 969391f..52e18cc 100644
--- a/client/WEB-INF/classes/resources/messages_zh_CN.properties
+++ b/client/WEB-INF/classes/resources/messages_zh_CN.properties
@@ -445,7 +445,6 @@ label.cidr.list=\u6e90 CIDR
 label.CIDR.of.destination.network=\u76ee\u7684\u5730\u7f51\u7edc\u7684 CIDR
 label.cidr=CIDR
 label.clean.up=\u6e05\u7406
-label.make.redundant=\u4f7f\u591a\u9918
 label.clear.list=\u6e05\u9664\u5217\u8868
 label.close=\u5173\u95ed
 label.cloud.console=\u4e91\u7ba1\u7406\u63a7\u5236\u53f0
@@ -1025,7 +1024,6 @@ label.resources=\u8d44\u6e90
 label.restart.network=\u91cd\u65b0\u542f\u52a8\u7f51\u7edc
 label.restart.required=\u9700\u8981\u91cd\u65b0\u542f\u52a8
 label.restart.vpc=\u91cd\u65b0\u542f\u52a8 VPC
-message.restart.vpc.remark=\u5099\u8a3b\uff1a\u88fd\u4f5c\u0056\u0050\u0043\u5197\u9918\u5c07\u5f37\u5236\u6e05\u7406\u3002\u8a72\u7db2\u7d61\u5c07\u4e0d\u53ef\u7528\u4e86\u5e7e\u5206\u9418\u3002
 label.restore=\u8fd8\u539f
 label.retry.interval=\u91cd\u8bd5\u65f6\u95f4\u95f4\u9694
 label.review=\u6838\u5bf9


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

Posted by bh...@apache.org.
nat rules added to incorrect interface


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

Branch: refs/heads/master
Commit: c1ec5b0b16d9fc49a07abca301f20fc9ca706cb7
Parents: 7700e94
Author: Ian Southam <is...@schubergphilis.com>
Authored: Wed Feb 18 14:39:00 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:40:07 2015 +0100

----------------------------------------------------------------------
 .../patches/debian/config/opt/cloud/bin/cs/CsAddress.py   | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c1ec5b0b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
index cd2d9f1..04d642e 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
@@ -382,17 +382,17 @@ class CsIP:
                             ])
             self.fw.append(["", "front", "-A NETWORK_STATS_%s -o %s -s %s" % ("eth1", "eth1", self.address['network'])])
             self.fw.append(["", "front", "-A NETWORK_STATS_%s -o %s -d %s" % ("eth1", "eth1", self.address['network'])])
+            self.fw.append(["nat", "front",
+                            "-A POSTROUTING -s %s -o %s -j SNAT --to-source %s" %
+                           (self.address['network'], self.dev,
+                            self.address['public_ip'])
+                            ])
 
         if self.get_type() in ["public"]:
             self.fw.append(["nat", "front",
                             "-A POSTROUTING -o %s -j SNAT --to-source %s" %
                            (self.dev, self.address['public_ip'])
                             ])
-            self.fw.append(["nat", "front",
-                            "-A POSTROUTING -s %s -o %s -j SNAT --to-source %s" %
-                           (self.address['network'], self.dev,
-                            self.address['public_ip'])
-                            ])
             self.fw.append(["", "front",
                             "-A FORWARD -o %s -d %s -j ACL_INBOUND_%s" % (self.dev, self.address['network'], self.dev)
                             ])


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

Posted by bh...@apache.org.
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/ae53d5ed
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ae53d5ed
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ae53d5ed

Branch: refs/heads/master
Commit: ae53d5ede1e40e624dffac99aaea721a804f7c34
Parents: a5d6f90
Author: wilderrodrigues <wr...@schubergphilis.com>
Authored: Tue Jan 27 14:05:38 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:39:51 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/ae53d5ed/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/ae53d5ed/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/ae53d5ed/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/ae53d5ed/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 {


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

Posted by bh...@apache.org.
A tab got in there somehow!


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

Branch: refs/heads/master
Commit: aa6fdf853b24fe5b56180cea27d02e3d6c5780d3
Parents: ae6b07a
Author: Ian Southam <is...@schubergphilis.com>
Authored: Mon Feb 9 15:20:36 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:40:05 2015 +0100

----------------------------------------------------------------------
 .../debian/config/opt/cloud/bin/cs/CsAddress.py       | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/aa6fdf85/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
index 80dfcdc..0bf98df 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
@@ -355,13 +355,13 @@ class CsIP:
         if self.get_type() in ["control"]:
             self.fw.append(["filter", "", "-A FW_OUTBOUND -m state --state RELATED,ESTABLISHED -j ACCEPT"])
             self.fw.append(["filter", "", "-A INPUT -i %s -p tcp -m tcp --dport 3922 -m state --state NEW -j ACCEPT" % self.dev])
-  		self.fw.append(['', 'front', '-A FORWARD -j NETWORK_STATS'])
-  		self.fw.append(['', 'front', '-A INPUT -j NETWORK_STATS'])
-  		self.fw.append(['', 'front', '-A OUTPUT -j NETWORK_STATS'])
-  		self.fw.append(['', '', '-A NETWORK_STATS -i eth0 -o eth2'])
-  		self.fw.append(['', '', '-A NETWORK_STATS -i eth2 -o eth0'])
-  		self.fw.append(['', '', '-A NETWORK_STATS -o eth2 ! -i eth0 -p tcp'])
-  		self.fw.append(['', '', '-A NETWORK_STATS -i eth2 ! -o eth0 -p tcp'])
+        self.fw.append(['', 'front', '-A FORWARD -j NETWORK_STATS'])
+        self.fw.append(['', 'front', '-A INPUT -j NETWORK_STATS'])
+        self.fw.append(['', 'front', '-A OUTPUT -j NETWORK_STATS'])
+        self.fw.append(['', '', '-A NETWORK_STATS -i eth0 -o eth2'])
+        self.fw.append(['', '', '-A NETWORK_STATS -i eth2 -o eth0'])
+        self.fw.append(['', '', '-A NETWORK_STATS -o eth2 ! -i eth0 -p tcp'])
+        self.fw.append(['', '', '-A NETWORK_STATS -i eth2 ! -o eth0 -p tcp'])
 
     def fw_vpcrouter(self):
         if not self.config.is_vpc():


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

Posted by bh...@apache.org.
Show all routers of a VPC
   - For redundant VPCs, we should see 2 routers
   - For single VPCs, we should see 1 router.


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

Branch: refs/heads/master
Commit: 05e4fe17e2a7d47c6b47f3f518859d9c087c06c6
Parents: 9e82281
Author: wilderrodrigues <wr...@schubergphilis.com>
Authored: Thu Feb 5 08:58:08 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:39:59 2015 +0100

----------------------------------------------------------------------
 ui/scripts/network.js | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/05e4fe17/ui/scripts/network.js
----------------------------------------------------------------------
diff --git a/ui/scripts/network.js b/ui/scripts/network.js
index e7ab5fc..33e85b8 100755
--- a/ui/scripts/network.js
+++ b/ui/scripts/network.js
@@ -5777,12 +5777,14 @@
                                         dataType: "json",
                                         async: true,
                                         success: function(json) {
-                                            var item = json.listroutersresponse.router[0];
+                                            for (var i = 0; i < json.listroutersresponse.router.length; i++) {
+                                                var item = json.listroutersresponse.router[i];
 
-                                            args.response.success({
-                                                actionFilter: cloudStack.sections.system.routerActionFilter,
-                                                data: item
-                                            });
+                                                args.response.success({
+                                                    actionFilter: cloudStack.sections.system.routerActionFilter,
+                                                    data: item
+                                                });
+                                            }
                                         }
                                     });
                                 }


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

Posted by bh...@apache.org.
Fix the checkrouter.sh script in order to report the routers state


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

Branch: refs/heads/master
Commit: e6b3ee318c048ece6afde4c45c17b3652a59f3c0
Parents: 0a133c0
Author: wilderrodrigues <wr...@schubergphilis.com>
Authored: Fri Feb 6 13:21:09 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:40:02 2015 +0100

----------------------------------------------------------------------
 .../debian/config/opt/cloud/templates/checkrouter.sh.templ   | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e6b3ee31/systemvm/patches/debian/config/opt/cloud/templates/checkrouter.sh.templ
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/templates/checkrouter.sh.templ b/systemvm/patches/debian/config/opt/cloud/templates/checkrouter.sh.templ
index fbf4f0f..35ba766 100755
--- a/systemvm/patches/debian/config/opt/cloud/templates/checkrouter.sh.templ
+++ b/systemvm/patches/debian/config/opt/cloud/templates/checkrouter.sh.templ
@@ -44,10 +44,14 @@ then
     bumped="Bumped: YES"
 fi
 
-stat=`tail -n 1 [RROUTER_LOG] | grep "Status"`
+state="Status: BACKUP"
+isMaster=`grep -Po '(?<="redundant_master": ")[^"]*' /etc/cloudstack/cmdline.json`
 if [ $? -eq 0 ]
 then
-    echo "$stat&$bumped"
+    if [ "$isMaster" = true ] ; then
+        state="Status: MASTER"
+    fi
+    echo "$state&$bumped"
 fi
 
 if [ $nolock -eq 0 ]


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

Posted by bh...@apache.org.
Vrrp will fail if your own code keeps killing it off


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

Branch: refs/heads/master
Commit: f5ef75ee7eca2b62e59395a5cbb94330d675471d
Parents: ae53d5e
Author: Ian Southam <is...@schubergphilis.com>
Authored: Tue Jan 27 16:58:16 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:39:51 2015 +0100

----------------------------------------------------------------------
 .../patches/debian/config/opt/cloud/bin/configure.py     |  7 +++++--
 .../patches/debian/config/opt/cloud/bin/cs/CsAddress.py  | 11 +++++++++++
 .../debian/config/opt/cloud/bin/cs/CsRedundant.py        |  3 ++-
 3 files changed, 18 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f5ef75ee/systemvm/patches/debian/config/opt/cloud/bin/configure.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/configure.py b/systemvm/patches/debian/config/opt/cloud/bin/configure.py
index b04da82..b693477 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/configure.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/configure.py
@@ -556,8 +556,8 @@ def main(argv):
     fwd = CsForwardingRules("forwardingrules", config)
     fwd.process()
 
-    vpns = CsSite2SiteVpn("site2sitevpn", config)
-    vpns.process()
+    nf = CsNetfilters()
+    nf.compare(config.get_fw())
 
     red = CsRedundant(config)
     red.set()
@@ -565,6 +565,9 @@ def main(argv):
     nf = CsNetfilters()
     nf.compare(config.get_fw())
 
+    vpns = CsSite2SiteVpn("site2sitevpn", config)
+    vpns.process()
+
     dhcp = CsDhcp("dhcpentry", config)
     dhcp.process()
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f5ef75ee/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
index 9362df1..a3ca801 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
@@ -491,9 +491,20 @@ class CsIP:
                     self.setAddress(address)
                     if self.hasIP(ip):
                         found = True
+                    if self.is_guest_gateway(address, ip):
+                        found = True
             if not found:
                 self.delete(ip)
 
+    def is_guest_gateway(self, bag, ip):
+        """ Exclude the vrrp maintained addresses on a redundant router """
+        if not self.config.cl.is_redundant():
+           return False
+        rip = ip.split('/')[0]
+        if bag['nw_type'] == "guest" and rip == bag['gateway']:
+           return True
+        return False
+
     def delete(self, ip):
         remove = []
         if ip == "all":

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f5ef75ee/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 9569f08..4312462 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
@@ -105,6 +105,8 @@ class CsRedundant(object):
         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())
+        if self.cl.get_state() == 'MASTER':
+            file.search(" priority ", "    priority %s" % 120)
         file.commit()
 
         # conntrackd configuration
@@ -209,7 +211,6 @@ class CsRedundant(object):
         CsHelper.service("cloud-passwd-srvr", "restart")
         CsHelper.service("dnsmasq", "restart")
         self.cl.dbag['config']['redundant_master'] = "true"
-        self._set_priority(self.CS_PRIO_UP)
         self.cl.save()
         #CsHelper.service("keepalived", "restart")
         logging.info("Router switched to master mode")


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

Posted by bh...@apache.org.
dnsmasq should restart if config changes and hup if hosts change


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

Branch: refs/heads/master
Commit: 7700e940fff587d8dd7f0994171ae7b7e23d149c
Parents: 962a62e
Author: Ian Southam <is...@schubergphilis.com>
Authored: Tue Feb 17 14:13:43 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:40:07 2015 +0100

----------------------------------------------------------------------
 .../patches/debian/config/opt/cloud/bin/cs/CsDatabag.py     | 2 +-
 systemvm/patches/debian/config/opt/cloud/bin/cs/CsDhcp.py   | 9 ++++-----
 .../patches/debian/config/opt/cloud/bin/cs/CsRedundant.py   | 2 +-
 3 files changed, 6 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7700e940/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 b2e559d..a3818e5 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDatabag.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDatabag.py
@@ -132,7 +132,7 @@ class CsCmdLine(CsDataBag):
     def get_router_password(self):
         if "router_password" in self.idata():
             return self.idata()['router_password']
-        
+
         '''
         Generate a password based on the router id just to avoid hard-coded passwd.
         Remark: if for some reason 1 router gets configured, the other one will have a different password.

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7700e940/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDhcp.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDhcp.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDhcp.py
index 0a1c8e2..1b76b86 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDhcp.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDhcp.py
@@ -47,11 +47,10 @@ class CsDhcp(CsDataBag):
         self.configure_server()
         self.conf.commit()
         self.cloud.commit()
-        if self.cloud.is_changed():
-            if length < 2:
-                CsHelper.service("dnsmasq", "restart")
-            else:
-                CsHelper.hup_dnsmasq("dnsmasq", "dnsmasq")
+        if self.conf.is_changed():
+            CsHelper.service("dnsmasq", "restart")
+        elif self.cloud.is_changed():
+            CsHelper.hup_dnsmasq("dnsmasq", "dnsmasq")
 
     def configure_server(self):
         # self.conf.addeq("dhcp-hostsfile=%s" % DHCP_HOSTS)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7700e940/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 a947fd1..7ada710 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
@@ -122,7 +122,7 @@ class CsRedundant(object):
         file.search(" state ", "    state %s" % "EQUAL")
         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("authentication {", "}", [ "        auth_type AH \n", "        auth_pass %s\n" % self.cl.get_router_password()] )
+        file.section("authentication {", "}", ["        auth_type AH \n", "        auth_pass %s\n" % self.cl.get_router_password()])
         file.section("virtual_ipaddress {", "}", self._collect_ips())
         file.commit()
 


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

Posted by bh...@apache.org.
If master gets called and then within a few seconds backup (this can happen during provisioning), the master process will complete after the backup one.  Not what we want.  These commands must be serial

Used a wee Unix socket to create a lock

We still need to find out why the flip flop occasionally happens. nopreempt should stop this ...


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

Branch: refs/heads/master
Commit: 23c100d949f8d57e27e199a4401fb8087ec44e3e
Parents: 7bfccd6
Author: Ian Southam <is...@schubergphilis.com>
Authored: Mon Mar 9 16:40:18 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:40:12 2015 +0100

----------------------------------------------------------------------
 .../config/opt/cloud/bin/cs/CsRedundant.py      | 29 ++++++++++++++++++--
 1 file changed, 26 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/23c100d9/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 a2a1793..3e78f4c 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
@@ -40,6 +40,8 @@ from CsFile import CsFile
 from CsConfig import CsConfig
 from CsProcess import CsProcess
 from CsApp import CsPasswdSvc
+import socket
+from time import sleep
 
 
 class CsRedundant(object):
@@ -157,11 +159,31 @@ class CsRedundant(object):
         if not proc.find():
             CsHelper.service("keepalived", "restart")
 
+    def set_lock(self):
+        """
+        Make sure that master state changes happen sequentially
+        """
+        iterations = 10
+        time_between = 1
+
+        for iter in range(0, iterations):
+            try:
+                s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
+                s.bind( '\0master_lock')
+                return s
+            except socket.error, e:
+                error_code = e.args[0]
+                error_string = e.args[1]
+                print "Process already running (%d:%s ). Exiting" % ( error_code, error_string)
+                logging.info("Master is already running, waiting")
+                sleep(1)
+
     def set_fault(self):
         """ Set fault mode on this router """
         if not self.cl.is_redundant():
             logging.error("Set fault called on non-redundant router")
             return
+        s = self.set_lock()
         logging.info("Router switched to fault mode")
         ads = [o for o in self.address.get_ips() if o.is_public()]
         for o in ads:
@@ -188,7 +210,8 @@ class CsRedundant(object):
             logging.error("Set backup called on node that is already backup")
             return
         """
-        logging.info("Router switched to backup mode")
+        s = self.set_lock()
+        logging.debug("Setting router to backup")
         ads = [o for o in self.address.get_ips() if o.is_public()]
         for o in ads:
             CsHelper.execute("ifconfig %s down" % o.get_device())
@@ -202,7 +225,6 @@ class CsRedundant(object):
         CsHelper.service("dnsmasq", "stop")
         # self._set_priority(self.CS_PRIO_DOWN)
         self.cl.set_master_state(False)
-        # CsHelper.service("keepalived", "restart")
         self.cl.save()
         logging.info("Router switched to backup mode")
 
@@ -216,6 +238,8 @@ class CsRedundant(object):
             logging.error("Set master called on master node")
             return
         """
+        s = self.set_lock()
+        logging.debug("Setting router to master")
         ads = [o for o in self.address.get_ips() if o.is_public()]
         for o in ads:
             # cmd2 = "ip link set %s up" % self.getDevice()
@@ -237,7 +261,6 @@ class CsRedundant(object):
         CsHelper.service("dnsmasq", "restart")
         self.cl.set_master_state(True)
         self.cl.save()
-        # CsHelper.service("keepalived", "restart")
         logging.info("Router switched to master mode")
 
     def _collect_ignore_ips(self):


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

Posted by bh...@apache.org.
Fixed password server respawning issue
Some changes to isolated network acl generation


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

Branch: refs/heads/master
Commit: 6fc680be71adeec9bc33b8f6e571193ca42b5f14
Parents: 5ddf87b
Author: Ian Southam <is...@schubergphilis.com>
Authored: Thu Mar 5 11:48:27 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:40:11 2015 +0100

----------------------------------------------------------------------
 systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py | 4 ++--
 systemvm/patches/debian/config/opt/cloud/bin/cs/CsApp.py     | 2 +-
 .../patches/debian/config/opt/cloud/bin/cs_firewallrules.py  | 8 ++++----
 3 files changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6fc680be/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
index 8f4d511..f675a655 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
@@ -307,10 +307,10 @@ class CsIP:
         if self.get_type() in ["public"]:
             self.fw.append(["mangle", "front",
                             "-A PREROUTING " +
-                            "-d %s -j VPN_%s" % (self.address['network'], self.address['public_ip'])])
+                            "-d %s/32 -j VPN_%s" % (self.address['public_ip'], self.address['public_ip'])])
             self.fw.append(["mangle", "front",
                             "-A PREROUTING " +
-                            "-d %s -j FIREWALL_%s" % (self.address['network'], self.address['public_ip'])])
+                            "-d %s/32 -j FIREWALL_%s" % (self.address['public_ip'], self.address['public_ip'])])
             self.fw.append(["mangle", "front",
                             "-A FIREWALL_%s " % self.address['public_ip'] +
                             "-m state --state RELATED,ESTABLISHED -j ACCEPT"])

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6fc680be/systemvm/patches/debian/config/opt/cloud/bin/cs/CsApp.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsApp.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsApp.py
index cceb464..de53fe0 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsApp.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsApp.py
@@ -69,7 +69,7 @@ class CsPasswdSvc():
 
     def start(self):
         proc = CsProcess(["dummy"])
-        if proc.grep("passwd_service %s" % self.ip) == -1:
+        if proc.grep("passwd_server_ip %s" % self.ip) == -1:
             proc.start("/opt/cloud/bin/passwd_server_ip %s >> /var/log/cloud.log 2>&1" % self.ip, "&")
 
     def stop(self):

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6fc680be/systemvm/patches/debian/config/opt/cloud/bin/cs_firewallrules.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs_firewallrules.py b/systemvm/patches/debian/config/opt/cloud/bin/cs_firewallrules.py
index 0cef723..d617a09 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs_firewallrules.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs_firewallrules.py
@@ -18,15 +18,15 @@
 from pprint import pprint
 import copy
 
-
 def merge(dbag, data):
     dbagc = copy.deepcopy(dbag)
     if "rules" not in data:
-                return dbagc
+        return dbagc
     for rule in data['rules']:
         id = str(rule['id'])
         if rule['revoked']:
-            del(dbagc[id])
-        if id not in dbagc.keys():
+            if id in dbagc.keys():
+                del(dbagc[id])
+        elif id not in dbagc.keys():
             dbagc[id] = rule
     return dbagc


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

Posted by bh...@apache.org.
Adding the router priority when the control interface is created
Adding some logging to the check heartbeat script


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

Branch: refs/heads/master
Commit: b7a142800d41668a3a8b78e49c458a5901f0fa92
Parents: e95a649
Author: wilderrodrigues <wr...@schubergphilis.com>
Authored: Tue Jan 27 19:25:54 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:39:52 2015 +0100

----------------------------------------------------------------------
 .../cloud/network/router/VirtualNetworkApplianceManagerImpl.java  | 3 ++-
 .../debian/config/opt/cloud/templates/check_heartbeat.sh.templ    | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b7a14280/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 1c32c7e..eb6496c 100644
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -1542,7 +1542,6 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
             final String brd = NetUtils.long2Ip(NetUtils.ip2Long(guestNic.getIp4Address()) | ~NetUtils.ip2Long(guestNic.getNetmask()));
             buf.append(" guestbrd=").append(brd);
             buf.append(" guestcidrsize=").append(NetUtils.getCidrSize(guestNic.getNetmask()));
-            buf.append(" router_pr=").append(router.getPriority());
 
             final int advertInt = NumbersUtil.parseInt(_configDao.getValue(Config.RedundantRouterVrrpInterval.key()), 1);
             buf.append(" advert_int=").append(advertInt);
@@ -1621,6 +1620,8 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
                 final int priority = getUpdatedPriority(network, routers, router);
                 router.setPriority(priority);
                 router = _routerDao.persist(router);
+
+                buf.append(" router_pr=").append(router.getPriority());
             } catch (final InsufficientVirtualNetworkCapacityException e) {
                 s_logger.error("Failed to get update priority!", e);
                 throw new CloudRuntimeException("Failed to get update priority!");

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b7a14280/systemvm/patches/debian/config/opt/cloud/templates/check_heartbeat.sh.templ
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/templates/check_heartbeat.sh.templ b/systemvm/patches/debian/config/opt/cloud/templates/check_heartbeat.sh.templ
index 2bfb7cd..4131159 100755
--- a/systemvm/patches/debian/config/opt/cloud/templates/check_heartbeat.sh.templ
+++ b/systemvm/patches/debian/config/opt/cloud/templates/check_heartbeat.sh.templ
@@ -38,6 +38,7 @@ then
         if [ -e $STRIKE_FILE ]
         then
             rm $STRIKE_FILE
+            echo keepalived.strikes file was removed! >> $ROUTER_LOG
         else
             echo keepalived.strikes file does not exist! >> $ROUTER_LOG
         fi


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

Posted by bh...@apache.org.
No hardcoded passwords.
  - If for some reason the cmdLine json doesn't contain the password key, which is almost impossible to happen,
    we generate a password based on other unique data per VPC


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

Branch: refs/heads/master
Commit: e7969b640b6e7e1d4be5df37e86f65dbb49bae64
Parents: 4b66043
Author: wilderrodrigues <wr...@schubergphilis.com>
Authored: Tue Feb 10 19:30:45 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:40:06 2015 +0100

----------------------------------------------------------------------
 .../debian/config/opt/cloud/bin/cs/CsDatabag.py        | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e7969b64/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 d58a642..b2e559d 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDatabag.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDatabag.py
@@ -15,6 +15,7 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
+import hashlib
 from merge import DataBag
 
 
@@ -131,4 +132,14 @@ class CsCmdLine(CsDataBag):
     def get_router_password(self):
         if "router_password" in self.idata():
             return self.idata()['router_password']
-        return "k3ep@liv3D"
+        
+        '''
+        Generate a password based on the router id just to avoid hard-coded passwd.
+        Remark: if for some reason 1 router gets configured, the other one will have a different password.
+        This is slightly difficult to happen, but if it does, destroy the router with the password generated with the
+        code below and restart the VPC with out the clean up option.
+        '''
+        passwd = "%s-%s" % (self.get_vpccidr, self.get_router_id())
+        md5 = hashlib.md5()
+        md5.update(passwd)
+        return md5.hexdigest()


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

Posted by bh...@apache.org.
Turn a single VPC into a redundant VPC
  - when restarting a VPC, the user can check the option Make Redundant in order to change
    the VPC offering and make it redundant


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

Branch: refs/heads/master
Commit: e350f1e76fdf6a848d21679f327cb1023503bbd2
Parents: 87d4171
Author: wilderrodrigues <wr...@schubergphilis.com>
Authored: Tue Feb 3 16:27:54 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:39:57 2015 +0100

----------------------------------------------------------------------
 api/src/com/cloud/network/vpc/VpcService.java   |  4 +-
 .../org/apache/cloudstack/api/ApiConstants.java |  3 +-
 .../api/command/user/vpc/RestartVPCCmd.java     | 12 +++++-
 .../classes/resources/messages.properties       |  1 +
 .../classes/resources/messages_ar.properties    |  1 +
 .../classes/resources/messages_es.properties    |  1 +
 .../classes/resources/messages_fr_FR.properties |  1 +
 .../classes/resources/messages_ja_JP.properties |  1 +
 .../classes/resources/messages_ko_KR.properties |  1 +
 .../classes/resources/messages_nb_NO.properties |  1 +
 .../classes/resources/messages_nl_NL.properties |  1 +
 .../classes/resources/messages_pl.properties    |  1 +
 .../classes/resources/messages_pt_BR.properties |  1 +
 .../classes/resources/messages_ru_RU.properties |  1 +
 .../classes/resources/messages_zh_CN.properties |  1 +
 .../schema/src/com/cloud/network/vpc/VpcVO.java | 41 ++++++++++++--------
 .../com/cloud/network/vpc/VpcManagerImpl.java   | 22 ++++++++++-
 ui/dictionary.jsp                               |  1 +
 ui/scripts/network.js                           |  9 ++++-
 19 files changed, 82 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e350f1e7/api/src/com/cloud/network/vpc/VpcService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/vpc/VpcService.java b/api/src/com/cloud/network/vpc/VpcService.java
index a2a6fe7..241e27b 100644
--- a/api/src/com/cloud/network/vpc/VpcService.java
+++ b/api/src/com/cloud/network/vpc/VpcService.java
@@ -127,10 +127,12 @@ public interface VpcService {
      * Restarts the VPC. VPC gets shutdown and started as a part of it
      *
      * @param id
+     * @param cleanUp
+     * @param makeredundant
      * @return
      * @throws InsufficientCapacityException
      */
-    boolean restartVpc(long id, boolean cleanUp) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
+    boolean restartVpc(long id, boolean cleanUp, boolean makeredundant) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
 
     /**
      * Returns a Private gateway found in the VPC by id

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e350f1e7/api/src/org/apache/cloudstack/api/ApiConstants.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/ApiConstants.java b/api/src/org/apache/cloudstack/api/ApiConstants.java
index 0cae1d3..4ab10fa 100644
--- a/api/src/org/apache/cloudstack/api/ApiConstants.java
+++ b/api/src/org/apache/cloudstack/api/ApiConstants.java
@@ -48,6 +48,7 @@ public class ApiConstants {
     public static final String IP6_CIDR = "ip6cidr";
     public static final String CIDR_LIST = "cidrlist";
     public static final String CLEANUP = "cleanup";
+    public static final String MAKEREDUNDANTE = "makeredundant";
     public static final String CLUSTER_ID = "clusterid";
     public static final String CLUSTER_NAME = "clustername";
     public static final String CLUSTER_TYPE = "clustertype";
@@ -450,7 +451,7 @@ public class ApiConstants {
     public static final String EXTERNAL_SWITCH_MGMT_DEVICE_NAME = "vsmdevicename";
     public static final String EXTERNAL_SWITCH_MGMT_DEVICE_STATE = "vsmdevicestate";
     // Would we need to have a capacity field for Cisco N1KV VSM? Max hosts managed by it perhaps? May remove this
-// later.
+    // later.
     public static final String EXTERNAL_SWITCH_MGMT_DEVICE_CAPACITY = "vsmdevicecapacity";
     public static final String CISCO_NEXUS_VSM_NAME = "vsmname";
     public static final String VSM_USERNAME = "vsmusername";

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e350f1e7/api/src/org/apache/cloudstack/api/command/user/vpc/RestartVPCCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/RestartVPCCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/RestartVPCCmd.java
index 20df9ea..ea34c6a 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpc/RestartVPCCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpc/RestartVPCCmd.java
@@ -51,6 +51,9 @@ public class RestartVPCCmd extends BaseAsyncCmd {
     @Parameter(name = ApiConstants.CLEANUP, type = CommandType.BOOLEAN, required = false, description = "If cleanup old network elements")
     private Boolean cleanup;
 
+    @Parameter(name = ApiConstants.MAKEREDUNDANTE, type = CommandType.BOOLEAN, required = false, description = "Turn a single VPC into a redundant one.")
+    private Boolean makeredundant;
+
     /////////////////////////////////////////////////////
     /////////////////// Accessors ///////////////////////
     /////////////////////////////////////////////////////
@@ -66,6 +69,13 @@ public class RestartVPCCmd extends BaseAsyncCmd {
         return true;
     }
 
+    public Boolean getMakeredundant() {
+        if (makeredundant != null) {
+            return makeredundant;
+        }
+        return true;
+    }
+
     /////////////////////////////////////////////////////
     /////////////// API Implementation///////////////////
     /////////////////////////////////////////////////////
@@ -87,7 +97,7 @@ public class RestartVPCCmd extends BaseAsyncCmd {
     @Override
     public void execute() {
         try {
-            final boolean result = _vpcService.restartVpc(getId(), getCleanup());
+            final boolean result = _vpcService.restartVpc(getId(), getCleanup(), getMakeredundant());
             if (result) {
                 final SuccessResponse response = new SuccessResponse(getCommandName());
                 setResponseObject(response);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e350f1e7/client/WEB-INF/classes/resources/messages.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages.properties b/client/WEB-INF/classes/resources/messages.properties
index 76cbdf7..6709603 100644
--- a/client/WEB-INF/classes/resources/messages.properties
+++ b/client/WEB-INF/classes/resources/messages.properties
@@ -450,6 +450,7 @@ label.cidr.list=Source CIDR
 label.CIDR.of.destination.network=CIDR of destination network
 label.cidr=CIDR
 label.clean.up=Clean up
+label.make.redundant=Make redundant
 label.clear.list=Clear list
 label.close=Close
 label.cloud.console=Cloud Management Console

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e350f1e7/client/WEB-INF/classes/resources/messages_ar.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_ar.properties b/client/WEB-INF/classes/resources/messages_ar.properties
index de90c43..a36399f 100644
--- a/client/WEB-INF/classes/resources/messages_ar.properties
+++ b/client/WEB-INF/classes/resources/messages_ar.properties
@@ -47,6 +47,7 @@ label.change.value=\u062a\u063a\u064a\u0631 \u0627\u0644\u0642\u064a\u0645\u0629
 label.CIDR.list=\u0642\u0627\u0626\u0645\u0629 CIDR
 label.CIDR.of.destination.network=CIDR \u0627\u0644\u062e\u0627\u0635 \u0628\u0627\u0644\u0634\u0628\u0643\u0629 \u0627\u0644\u0645\u0648\u062c\u0647\u0629.
 label.clean.up=\u062a\u0646\u0638\u064a\u0641
+label.make.redundant=\u062c\u0639\u0644 \u0632\u0627\u0626\u062f\u0629 \u0639\u0646 \u0627\u0644\u062d\u0627\u062c\u0629
 label.clear.list=\u0645\u0633\u062d \u0627\u0644\u0642\u0627\u0626\u0645\u0629
 label.configuration=\u0627\u0644\u062a\u0643\u0648\u064a\u0646
 label.configure.network.ACLs=\u0636\u0628\u0637 \u0634\u0628\u0643\u0629 ACLs

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e350f1e7/client/WEB-INF/classes/resources/messages_es.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_es.properties b/client/WEB-INF/classes/resources/messages_es.properties
index 6b51c38..91faf77 100644
--- a/client/WEB-INF/classes/resources/messages_es.properties
+++ b/client/WEB-INF/classes/resources/messages_es.properties
@@ -332,6 +332,7 @@ label.cidr=CIDR
 label.cidr.list=fuente CIDR
 label.CIDR.list=Lista CIDR
 label.clean.up=Limpiar
+label.make.redundant=\u0068\u0061\u0063\u0065\u0072 \u0072\u0065\u0064\u0075\u006e\u0064\u0061\u006e\u0074\u0065
 label.clear.list=Limpiar lista
 label.close=Cerrar
 label.cloud.console=Cloud Management Console

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e350f1e7/client/WEB-INF/classes/resources/messages_fr_FR.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_fr_FR.properties b/client/WEB-INF/classes/resources/messages_fr_FR.properties
index f6a7a95..1180465 100644
--- a/client/WEB-INF/classes/resources/messages_fr_FR.properties
+++ b/client/WEB-INF/classes/resources/messages_fr_FR.properties
@@ -455,6 +455,7 @@ label.cisco.nexus1000v.password=Mot de passe Nexus 1000v
 label.cisco.nexus1000v.username=Identifiant Nexus 1000v
 label.ciscovnmc.resource.details=D\u00e9tails ressource CiscoVNMC
 label.clean.up=Nettoyage
+label.make.redundant=\u006c\u0069\u0063\u0065\u006e\u0063\u0069\u0065\u0072
 label.clear.list=Purger la liste
 label.close=Fermer
 label.cloud.console=Console d\\'Administration du Cloud

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e350f1e7/client/WEB-INF/classes/resources/messages_ja_JP.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_ja_JP.properties b/client/WEB-INF/classes/resources/messages_ja_JP.properties
index 0510f43..550d12a 100644
--- a/client/WEB-INF/classes/resources/messages_ja_JP.properties
+++ b/client/WEB-INF/classes/resources/messages_ja_JP.properties
@@ -445,6 +445,7 @@ label.cidr.list=\u9001\u4fe1\u5143 CIDR
 label.CIDR.of.destination.network=\u5b9b\u5148\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306e CIDR
 label.cidr=CIDR
 label.clean.up=\u30af\u30ea\u30fc\u30f3 \u30a2\u30c3\u30d7\u3059\u308b
+label.make.redundant=\u5197\u9577\u5316
 label.clear.list=\u4e00\u89a7\u306e\u6d88\u53bb
 label.close=\u9589\u3058\u308b
 label.cloud.console=\u30af\u30e9\u30a6\u30c9\u7ba1\u7406\u30b3\u30f3\u30bd\u30fc\u30eb

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e350f1e7/client/WEB-INF/classes/resources/messages_ko_KR.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_ko_KR.properties b/client/WEB-INF/classes/resources/messages_ko_KR.properties
index badb7f3..4b7e090 100644
--- a/client/WEB-INF/classes/resources/messages_ko_KR.properties
+++ b/client/WEB-INF/classes/resources/messages_ko_KR.properties
@@ -375,6 +375,7 @@ label.CIDR.list=CIDR \ubaa9\ub85d
 label.cidr.list=\uc804\uc1a1\uc6d0 CIDR
 label.CIDR.of.destination.network=\ub300\uc0c1 \ub124\ud2b8\uc6cc\ud06c CIDR
 label.clean.up=\uc0ad\uc81c\ud558\uae30
+label.make.redundant=\uc911\ubcf5 \ud655\uc778
 label.clear.list=\ubaa9\ub85d \uc0ad\uc81c
 label.close=\ub2eb\uae30
 label.cloud.console=\ud074\ub77c\uc6b0\ub4dc \uad00\ub9ac \ucf58\uc194

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e350f1e7/client/WEB-INF/classes/resources/messages_nb_NO.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_nb_NO.properties b/client/WEB-INF/classes/resources/messages_nb_NO.properties
index bf88907..b9ade48 100644
--- a/client/WEB-INF/classes/resources/messages_nb_NO.properties
+++ b/client/WEB-INF/classes/resources/messages_nb_NO.properties
@@ -314,6 +314,7 @@ label.cidr=CIDR
 label.CIDR.list=CIDR liste
 label.cidr.list=Kilde-CIDR
 label.clean.up=Rydd opp
+label.make.redundant=\u0067\u006a\u00f8\u0072\u0065 \u006f\u0076\u0065\u0072\u0066\u006c\u00f8\u0064\u0069\u0067
 label.clear.list=T\u00f8m liste
 label.close=Lukk
 label.cloud.console=Cloud

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e350f1e7/client/WEB-INF/classes/resources/messages_nl_NL.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_nl_NL.properties b/client/WEB-INF/classes/resources/messages_nl_NL.properties
index 35cd86c..a296088 100644
--- a/client/WEB-INF/classes/resources/messages_nl_NL.properties
+++ b/client/WEB-INF/classes/resources/messages_nl_NL.properties
@@ -432,6 +432,7 @@ label.cisco.nexus1000v.password=Nexus 1000v Wachtwoord
 label.cisco.nexus1000v.username=Nexus 1000v Gebruikersnaam
 label.ciscovnmc.resource.details=CiscoVNMC resource details
 label.clean.up=Opschonen
+label.make.redundant=\u0072\u0065\u0064\u0075\u006e\u0064\u0061\u006e\u0074\u0065 \u006d\u0061\u006b\u0065\u006e
 label.clear.list=Schoon lijst op
 label.close=Sluiten
 label.cloud.console=Cloud Beheers Console

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e350f1e7/client/WEB-INF/classes/resources/messages_pl.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_pl.properties b/client/WEB-INF/classes/resources/messages_pl.properties
index 0388b3f..e9c9ae9 100644
--- a/client/WEB-INF/classes/resources/messages_pl.properties
+++ b/client/WEB-INF/classes/resources/messages_pl.properties
@@ -187,6 +187,7 @@ label.certificate=Certyfikat
 label.cidr=CIDR
 label.CIDR.list=Lista CIDR
 label.clean.up=Wyczy\u015b\u0107
+label.make.redundant=\u0073\u0069\u0119 \u007a\u0062\u0119\u0064\u006e\u0065
 label.clear.list=Wyczy\u015b\u0107 list\u0119
 label.close=Zamknij
 label.clvm=CLVM

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e350f1e7/client/WEB-INF/classes/resources/messages_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_pt_BR.properties b/client/WEB-INF/classes/resources/messages_pt_BR.properties
index c925e6d..4eb6997 100644
--- a/client/WEB-INF/classes/resources/messages_pt_BR.properties
+++ b/client/WEB-INF/classes/resources/messages_pt_BR.properties
@@ -398,6 +398,7 @@ label.cidr.list=CIDR de Origem
 label.CIDR.list=Lista CIDR
 label.CIDR.of.destination.network=CIDR da rede de destino
 label.clean.up=Limpar
+label.make.redundant=\u0074\u006f\u0072\u006e\u0061\u0072 \u0072\u0065\u0064\u0075\u006e\u0064\u0061\u006e\u0074\u0065
 label.clear.list=Limpar lista
 label.close=Fechar
 label.cloud.console=Console de Gerenciamento da Nuvem

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e350f1e7/client/WEB-INF/classes/resources/messages_ru_RU.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_ru_RU.properties b/client/WEB-INF/classes/resources/messages_ru_RU.properties
index 16427a1..e825605 100644
--- a/client/WEB-INF/classes/resources/messages_ru_RU.properties
+++ b/client/WEB-INF/classes/resources/messages_ru_RU.properties
@@ -386,6 +386,7 @@ label.cidr.list=CIDR \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430
 label.CIDR.list=\u0421\u043f\u0438\u0441\u043e\u043a CIDR
 label.CIDR.of.destination.network=CIDR \u0441\u0435\u0442\u0438 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f
 label.clean.up=\u041e\u0447\u0438\u0441\u0442\u0438\u0442\u044c
+label.make.redundant=\u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438\u0437\u043b\u0438\u0448\u043d\u0438\u043c
 label.clear.list=\u041e\u0447\u0438\u0441\u0442\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a
 label.close=\u0417\u0430\u043a\u0440\u044b\u0442\u044c
 label.cloud.console=\u041a\u043e\u043d\u0441\u043e\u043b\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043e\u0431\u043b\u0430\u043a\u043e\u043c

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e350f1e7/client/WEB-INF/classes/resources/messages_zh_CN.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_zh_CN.properties b/client/WEB-INF/classes/resources/messages_zh_CN.properties
index a527fcb..427b060 100644
--- a/client/WEB-INF/classes/resources/messages_zh_CN.properties
+++ b/client/WEB-INF/classes/resources/messages_zh_CN.properties
@@ -445,6 +445,7 @@ label.cidr.list=\u6e90 CIDR
 label.CIDR.of.destination.network=\u76ee\u7684\u5730\u7f51\u7edc\u7684 CIDR
 label.cidr=CIDR
 label.clean.up=\u6e05\u7406
+label.make.redundant=\u4f7f\u591a\u9918
 label.clear.list=\u6e05\u9664\u5217\u8868
 label.close=\u5173\u95ed
 label.cloud.console=\u4e91\u7ba1\u7406\u63a7\u5236\u53f0

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e350f1e7/engine/schema/src/com/cloud/network/vpc/VpcVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/vpc/VpcVO.java b/engine/schema/src/com/cloud/network/vpc/VpcVO.java
index b400d95..b78f22f 100644
--- a/engine/schema/src/com/cloud/network/vpc/VpcVO.java
+++ b/engine/schema/src/com/cloud/network/vpc/VpcVO.java
@@ -16,7 +16,8 @@
 // under the License.
 package com.cloud.network.vpc;
 
-import com.cloud.utils.db.GenericDao;
+import java.util.Date;
+import java.util.UUID;
 
 import javax.persistence.Column;
 import javax.persistence.Entity;
@@ -24,8 +25,8 @@ import javax.persistence.EnumType;
 import javax.persistence.Enumerated;
 import javax.persistence.Id;
 import javax.persistence.Table;
-import java.util.Date;
-import java.util.UUID;
+
+import com.cloud.utils.db.GenericDao;
 
 @Entity
 @Table(name = "vpc")
@@ -61,7 +62,7 @@ public class VpcVO implements Vpc {
     State state;
 
     @Column(name = "redundant")
-    boolean isRedundant;
+    boolean redundant;
 
     @Column(name = "vpc_offering_id")
     long vpcOfferingId;
@@ -92,8 +93,8 @@ public class VpcVO implements Vpc {
     }
 
     public VpcVO(final long zoneId, final String name, final String displayText, final long accountId, final long domainId,
-                 final long vpcOffId, String cidr, final String networkDomain, final boolean useDistributedRouter,
-                 final boolean regionLevelVpc, final boolean isRedundant) {
+            final long vpcOffId, final String cidr, final String networkDomain, final boolean useDistributedRouter,
+            final boolean regionLevelVpc, final boolean isRedundant) {
         this.zoneId = zoneId;
         this.name = name;
         this.displayText = displayText;
@@ -104,9 +105,9 @@ public class VpcVO implements Vpc {
         state = State.Enabled;
         this.networkDomain = networkDomain;
         vpcOfferingId = vpcOffId;
-        this.usesDistributedRouter = useDistributedRouter;
+        usesDistributedRouter = useDistributedRouter;
         this.regionLevelVpc = regionLevelVpc;
-        this.isRedundant = isRedundant;
+        redundant = isRedundant;
     }
 
     @Override
@@ -149,7 +150,7 @@ public class VpcVO implements Vpc {
         return state;
     }
 
-    public void setState(State state) {
+    public void setState(final State state) {
         this.state = state;
     }
 
@@ -158,6 +159,10 @@ public class VpcVO implements Vpc {
         return vpcOfferingId;
     }
 
+    public void setVpcOfferingId(final long vpcOfferingId) {
+        this.vpcOfferingId = vpcOfferingId;
+    }
+
     public Date getRemoved() {
         return removed;
     }
@@ -167,17 +172,17 @@ public class VpcVO implements Vpc {
         return displayText;
     }
 
-    public void setName(String name) {
+    public void setName(final String name) {
         this.name = name;
     }
 
-    public void setDisplayText(String displayText) {
+    public void setDisplayText(final String displayText) {
         this.displayText = displayText;
     }
 
     @Override
     public String toString() {
-        StringBuilder buf = new StringBuilder("[VPC [");
+        final StringBuilder buf = new StringBuilder("[VPC [");
         return buf.append(id).append("-").append(name).append("]").toString();
     }
 
@@ -186,7 +191,7 @@ public class VpcVO implements Vpc {
         return networkDomain;
     }
 
-    public void setRestartRequired(boolean restartRequired) {
+    public void setRestartRequired(final boolean restartRequired) {
         this.restartRequired = restartRequired;
     }
 
@@ -195,7 +200,7 @@ public class VpcVO implements Vpc {
         return restartRequired;
     }
 
-    public void setUuid(String uuid) {
+    public void setUuid(final String uuid) {
         this.uuid = uuid;
     }
 
@@ -205,7 +210,7 @@ public class VpcVO implements Vpc {
     }
 
 
-    public void setDisplay(boolean display) {
+    public void setDisplay(final boolean display) {
         this.display = display;
     }
 
@@ -216,7 +221,11 @@ public class VpcVO implements Vpc {
 
     @Override
     public boolean isRedundant() {
-       return this.isRedundant;
+        return redundant;
+    }
+
+    public void setRedundant(final boolean isRedundant) {
+        redundant = isRedundant;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e350f1e7/server/src/com/cloud/network/vpc/VpcManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/vpc/VpcManagerImpl.java b/server/src/com/cloud/network/vpc/VpcManagerImpl.java
index c71da96..07e5b67 100644
--- a/server/src/com/cloud/network/vpc/VpcManagerImpl.java
+++ b/server/src/com/cloud/network/vpc/VpcManagerImpl.java
@@ -1488,7 +1488,9 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
 
     @Override
     @ActionEvent(eventType = EventTypes.EVENT_VPC_RESTART, eventDescription = "restarting vpc")
-    public boolean restartVpc(final long vpcId, final boolean cleanUp) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
+    public boolean restartVpc(final long vpcId, final boolean cleanUp, final boolean makeRedundant) throws ConcurrentOperationException,
+    ResourceUnavailableException, InsufficientCapacityException {
+
         final Account caller = CallContext.current().getCallingAccount();
 
         // Verify input parameters
@@ -1504,7 +1506,23 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
         s_logger.debug("Restarting VPC " + vpc);
         boolean restartRequired = false;
         try {
-            if (cleanUp) {
+
+            boolean forceCleanup = cleanUp;
+            if (!vpc.isRedundant() && makeRedundant) {
+                final VpcOfferingVO redundantOffering = _vpcOffDao.findByUniqueName(VpcOffering.redundantVPCOfferingName);
+
+                final VpcVO entity = _vpcDao.findById(vpcId);
+                entity.setRedundant(makeRedundant);
+                entity.setVpcOfferingId(redundantOffering.getId());
+
+                // Change the VPC in order to get it updated after the end of the restart procedure.
+                _vpcDao.update(vpc.getId(), entity);
+
+                //If the offering and redundant column are changing, force the clean up.
+                forceCleanup = true;
+            }
+
+            if (forceCleanup) {
                 s_logger.debug("Shutting down VPC " + vpc + " as a part of VPC restart process");
                 if (!shutdownVpc(vpcId)) {
                     s_logger.warn("Failed to shutdown vpc as a part of VPC " + vpc + " restart process");

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e350f1e7/ui/dictionary.jsp
----------------------------------------------------------------------
diff --git a/ui/dictionary.jsp b/ui/dictionary.jsp
index e283d49..895f426 100644
--- a/ui/dictionary.jsp
+++ b/ui/dictionary.jsp
@@ -467,6 +467,7 @@ dictionary = {
 'label.CIDR.list': '<fmt:message key="label.CIDR.list" />',
 'label.CIDR.of.destination.network': '<fmt:message key="label.CIDR.of.destination.network" />',
 'label.clean.up': '<fmt:message key="label.clean.up" />',
+'label.make.redundant': '<fmt:message key="label.make.redundant" />',
 'label.clear.list': '<fmt:message key="label.clear.list" />',
 'label.close': '<fmt:message key="label.close" />',
 'label.cloud.console': '<fmt:message key="label.cloud.console" />',

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e350f1e7/ui/scripts/network.js
----------------------------------------------------------------------
diff --git a/ui/scripts/network.js b/ui/scripts/network.js
index d1bd7eb..b1e4d22 100755
--- a/ui/scripts/network.js
+++ b/ui/scripts/network.js
@@ -5523,11 +5523,17 @@
 		                               });
 		                               args.$form.find('.form-item[rel=cleanup]').find('input').attr('checked', 'checked'); //checked
 		                               args.$form.find('.form-item[rel=cleanup]').css('display', 'inline-block'); //shown
+	                                   args.$form.find('.form-item[rel=makeredundant]').find('input').attr('checked', 'checked'); //checked
+	                                   args.$form.find('.form-item[rel=makeredundant]').css('display', 'inline-block'); //shown
 		                           },
 		                           fields: {
 		                               cleanup: {
 		                                   label: 'label.clean.up',
 		                                   isBoolean: true
+		                               },
+		                               makeredundant: {
+		                                   label: 'label.make.redundant',
+		                                   isBoolean: true
 		                               }
 		                           }
 		                        },
@@ -5545,7 +5551,8 @@
                                         url: createURL("restartVPC"),
                                         data: {
                                             id: args.context.vpc[0].id,
-                                            cleanup: (args.data.cleanup == "on")
+                                            cleanup: (args.data.cleanup == "on"),
+                                            makeredundant: (args.data.makeredundant == "on")
                                         },
                                         success: function(json) {
                                             var jid = json.restartvpcresponse.jobid;


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

Posted by bh...@apache.org.
One of the routers is not running, so we don't have to continue here since the host will be null any way. Also, there is no need
To check either for sanity of duplicate master. Thus, just update the state and get lost.


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

Branch: refs/heads/master
Commit: 20d97158169fda8469cf166b7eadf2a2f8ef3680
Parents: e7969b6
Author: wilderrodrigues <wr...@schubergphilis.com>
Authored: Wed Feb 11 20:12:49 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:40:07 2015 +0100

----------------------------------------------------------------------
 .../network/router/VirtualNetworkApplianceManagerImpl.java  | 9 +++++++++
 1 file changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/20d97158/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 5a97eb3..42537c1 100644
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -1174,6 +1174,15 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
                      */
                     final DomainRouterVO router0 = routers.get(0);
                     final DomainRouterVO router1 = routers.get(1);
+
+                    if (router0.getState() != State.Running || router1.getState() != State.Running) {
+                        updateRoutersRedundantState(routers);
+                        // Wilder Rodrigues (wrodrigues@schubergphilis.com) - One of the routers is not running,
+                        // so we don't have to continue here since the host will be null any way. Also, there is no need
+                        // To check either for sanity of duplicate master. Thus, just update the state and get lost.
+                        continue;
+                    }
+
                     DomainRouterVO router = router0;
                     if (router0.getId() < router1.getId()) {
                         router = router0;


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

Posted by bh...@apache.org.
Fixed up get_dns for normal isolated vrs


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

Branch: refs/heads/master
Commit: 2b0c4c85a90e3ae929e0d2c47ca95331c99172a6
Parents: bf6e3fa
Author: Ian Southam <is...@schubergphilis.com>
Authored: Wed Jan 28 16:41:12 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:39:53 2015 +0100

----------------------------------------------------------------------
 systemvm/patches/debian/config/opt/cloud/bin/cs/CsConfig.py | 9 ++++++++-
 .../patches/debian/config/opt/cloud/bin/cs/CsDatabag.py     | 8 --------
 2 files changed, 8 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2b0c4c85/systemvm/patches/debian/config/opt/cloud/bin/cs/CsConfig.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsConfig.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsConfig.py
index 2e8db01..a08f1cc 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsConfig.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsConfig.py
@@ -67,7 +67,14 @@ class CsConfig(object):
         return self.cl.get_domain()
 
     def get_dns(self):
-        return self.cmdline().get_dns()
+        dns = []
+        # Check what happens with use_ext_dns
+        dns.append(self.address().get_guest_ip())
+        names = ["dns1", "dns2"]
+        for name in names:
+            if name in self.cmdline().idata():
+                dns.append(self.cmdline().idata()[name])
+        return dns
 
     def get_format(self):
         return self.__LOG_FORMAT

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2b0c4c85/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 936f993..e6ad6e5 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDatabag.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDatabag.py
@@ -93,14 +93,6 @@ class CsCmdLine(CsDataBag):
         else:
             return "unloved-router"
 
-    def get_dns(self):
-        dns = []
-        names = "dns1 dns2"
-        for name in names:
-            if name in self.idata():
-                dns.append(self.idata()[name])
-        return dns
-
     def get_type(self):
         if "type" in self.idata():
             return self.idata()['type']


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

Posted by bh...@apache.org.
Implement the new VPC restart
  - behaves just like network restart: if clean up is checked, all routers destroyed; if 1 router is gone and no
    clean up, only 1 new router created.


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

Branch: refs/heads/master
Commit: 88129adac11fe898940bda4f89d32fb67c91e13f
Parents: 9bec4b6
Author: wilderrodrigues <wr...@schubergphilis.com>
Authored: Wed Jan 28 14:15:12 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:39:52 2015 +0100

----------------------------------------------------------------------
 api/src/com/cloud/network/vpc/VpcService.java   | 12 ++---
 .../api/command/user/vpc/RestartVPCCmd.java     | 27 ++++++----
 .../cloudstack/api/response/VpcResponse.java    | 52 ++++++++++----------
 .../com/cloud/network/vpc/VpcManagerImpl.java   | 16 +++---
 .../deployment/RouterDeploymentDefinition.java  |  5 +-
 .../VpcRouterDeploymentDefinition.java          | 18 +------
 ui/scripts/network.js                           | 27 +++++++++-
 7 files changed, 92 insertions(+), 65 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/88129ada/api/src/com/cloud/network/vpc/VpcService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/vpc/VpcService.java b/api/src/com/cloud/network/vpc/VpcService.java
index 713844d..a2a6fe7 100644
--- a/api/src/com/cloud/network/vpc/VpcService.java
+++ b/api/src/com/cloud/network/vpc/VpcService.java
@@ -48,7 +48,7 @@ public interface VpcService {
      * @throws ResourceAllocationException TODO
      */
     public Vpc createVpc(long zoneId, long vpcOffId, long vpcOwnerId, String vpcName, String displayText, String cidr, String networkDomain, Boolean displayVpc)
-        throws ResourceAllocationException;
+            throws ResourceAllocationException;
 
     /**
      * Deletes a VPC
@@ -98,8 +98,8 @@ public interface VpcService {
      * @return
      */
     public Pair<List<? extends Vpc>, Integer> listVpcs(Long id, String vpcName, String displayText, List<String> supportedServicesStr, String cidr, Long vpcOffId, String state,
-        String accountName, Long domainId, String keyword, Long startIndex, Long pageSizeVal, Long zoneId, Boolean isRecursive, Boolean listAll, Boolean restartRequired,
-        Map<String, String> tags, Long projectId, Boolean display);
+            String accountName, Long domainId, String keyword, Long startIndex, Long pageSizeVal, Long zoneId, Boolean isRecursive, Boolean listAll, Boolean restartRequired,
+            Map<String, String> tags, Long projectId, Boolean display);
 
     /**
      * Starts VPC which includes starting VPC provider and applying all the neworking rules on the backend
@@ -130,7 +130,7 @@ public interface VpcService {
      * @return
      * @throws InsufficientCapacityException
      */
-    boolean restartVpc(long id) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
+    boolean restartVpc(long id, boolean cleanUp) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
 
     /**
      * Returns a Private gateway found in the VPC by id
@@ -160,7 +160,7 @@ public interface VpcService {
      * @throws ResourceAllocationException
      */
     public PrivateGateway createVpcPrivateGateway(long vpcId, Long physicalNetworkId, String vlan, String ipAddress, String gateway, String netmask, long gatewayOwnerId,
-        Long networkOfferingId, Boolean isSoruceNat, Long aclId) throws ResourceAllocationException, ConcurrentOperationException, InsufficientCapacityException;
+            Long networkOfferingId, Boolean isSoruceNat, Long aclId) throws ResourceAllocationException, ConcurrentOperationException, InsufficientCapacityException;
 
     /**
      * Applies VPC private gateway on the backend, so it becomes functional
@@ -246,7 +246,7 @@ public interface VpcService {
      * @throws ConcurrentOperationException
      */
     IpAddress associateIPToVpc(long ipId, long vpcId) throws ResourceAllocationException, ResourceUnavailableException, InsufficientAddressCapacityException,
-        ConcurrentOperationException;
+    ConcurrentOperationException;
 
     /**
      * @param routeId

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/88129ada/api/src/org/apache/cloudstack/api/command/user/vpc/RestartVPCCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/RestartVPCCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/RestartVPCCmd.java
index 84e790c..20df9ea 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpc/RestartVPCCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpc/RestartVPCCmd.java
@@ -16,8 +16,6 @@
 // under the License.
 package org.apache.cloudstack.api.command.user.vpc;
 
-import org.apache.log4j.Logger;
-
 import org.apache.cloudstack.acl.SecurityChecker.AccessType;
 import org.apache.cloudstack.api.ACL;
 import org.apache.cloudstack.api.APICommand;
@@ -28,6 +26,7 @@ import org.apache.cloudstack.api.Parameter;
 import org.apache.cloudstack.api.ServerApiException;
 import org.apache.cloudstack.api.response.SuccessResponse;
 import org.apache.cloudstack.api.response.VpcResponse;
+import org.apache.log4j.Logger;
 
 import com.cloud.event.EventTypes;
 import com.cloud.exception.ConcurrentOperationException;
@@ -37,7 +36,7 @@ import com.cloud.network.vpc.Vpc;
 import com.cloud.user.Account;
 
 @APICommand(name = "restartVPC", description = "Restarts a VPC", responseObject = VpcResponse.class, entityType = {Vpc.class},
-        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
+requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
 public class RestartVPCCmd extends BaseAsyncCmd {
     public static final Logger s_logger = Logger.getLogger(RestartVPCCmd.class.getName());
     private static final String s_name = "restartvpcresponse";
@@ -49,6 +48,9 @@ public class RestartVPCCmd extends BaseAsyncCmd {
     @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = VpcResponse.class, required = true, description = "the id of the VPC")
     private Long id;
 
+    @Parameter(name = ApiConstants.CLEANUP, type = CommandType.BOOLEAN, required = false, description = "If cleanup old network elements")
+    private Boolean cleanup;
+
     /////////////////////////////////////////////////////
     /////////////////// Accessors ///////////////////////
     /////////////////////////////////////////////////////
@@ -57,6 +59,13 @@ public class RestartVPCCmd extends BaseAsyncCmd {
         return id;
     }
 
+    public Boolean getCleanup() {
+        if (cleanup != null) {
+            return cleanup;
+        }
+        return true;
+    }
+
     /////////////////////////////////////////////////////
     /////////////// API Implementation///////////////////
     /////////////////////////////////////////////////////
@@ -67,7 +76,7 @@ public class RestartVPCCmd extends BaseAsyncCmd {
 
     @Override
     public long getEntityOwnerId() {
-        Vpc vpc = _entityMgr.findById(Vpc.class, getId());
+        final Vpc vpc = _entityMgr.findById(Vpc.class, getId());
         if (vpc != null) {
             return vpc.getAccountId();
         }
@@ -78,20 +87,20 @@ public class RestartVPCCmd extends BaseAsyncCmd {
     @Override
     public void execute() {
         try {
-            boolean result = _vpcService.restartVpc(getId());
+            final boolean result = _vpcService.restartVpc(getId(), getCleanup());
             if (result) {
-                SuccessResponse response = new SuccessResponse(getCommandName());
+                final SuccessResponse response = new SuccessResponse(getCommandName());
                 setResponseObject(response);
             } else {
                 throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to restart VPC");
             }
-        } catch (ResourceUnavailableException ex) {
+        } catch (final ResourceUnavailableException ex) {
             s_logger.warn("Exception: ", ex);
             throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
-        } catch (ConcurrentOperationException ex) {
+        } catch (final ConcurrentOperationException ex) {
             s_logger.warn("Exception: ", ex);
             throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
-        } catch (InsufficientCapacityException ex) {
+        } catch (final InsufficientCapacityException ex) {
             s_logger.info(ex);
             s_logger.trace(ex);
             throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/88129ada/api/src/org/apache/cloudstack/api/response/VpcResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/VpcResponse.java b/api/src/org/apache/cloudstack/api/response/VpcResponse.java
index 7f9565a..61ed88b 100644
--- a/api/src/org/apache/cloudstack/api/response/VpcResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/VpcResponse.java
@@ -115,72 +115,72 @@ public class VpcResponse extends BaseResponse implements ControlledEntityRespons
     @Param(description = "is VPC uses distributed router for one hop forwarding and host based network ACL's", since = "4.4")
     private boolean usesDistributedRouter;
 
-    @SerializedName((ApiConstants.REGION_LEVEL_VPC))
+    @SerializedName(ApiConstants.REGION_LEVEL_VPC)
     @Param(description = "true if VPC is region level", since = "4.4")
     private Boolean regionLevelVpc;
 
     @SerializedName(ApiConstants.REDUNDANT_VPC_ROUTER)
-    @Param(description = "if this VPC has redundant router", since = "4.4")
+    @Param(description = "if this VPC has redundant router", since = "4.6")
     private boolean redundantRouter;
 
-    public void setId(String id) {
+    public void setId(final String id) {
         this.id = id;
     }
 
-    public void setName(String name) {
+    public void setName(final String name) {
         this.name = name;
     }
 
-    public void setDisplayText(String displayText) {
+    public void setDisplayText(final String displayText) {
         this.displayText = displayText;
     }
 
-    public void setCreated(Date created) {
+    public void setCreated(final Date created) {
         this.created = created;
     }
 
-    public void setServices(List<ServiceResponse> services) {
+    public void setServices(final List<ServiceResponse> services) {
         this.services = services;
     }
 
-    public void setState(String state) {
+    public void setState(final String state) {
         this.state = state;
     }
 
     @Override
-    public void setAccountName(String accountName) {
+    public void setAccountName(final String accountName) {
         this.accountName = accountName;
     }
 
     @Override
-    public void setProjectId(String projectId) {
+    public void setProjectId(final String projectId) {
         this.projectId = projectId;
     }
 
     @Override
-    public void setProjectName(String projectName) {
+    public void setProjectName(final String projectName) {
         this.projectName = projectName;
     }
 
     @Override
-    public void setDomainId(String domainId) {
+    public void setDomainId(final String domainId) {
         this.domainId = domainId;
     }
 
     @Override
-    public void setDomainName(String domainName) {
-        this.domain = domainName;
+    public void setDomainName(final String domainName) {
+        domain = domainName;
     }
 
-    public void setZoneId(String zoneId) {
+    public void setZoneId(final String zoneId) {
         this.zoneId = zoneId;
     }
 
-    public void setCidr(String cidr) {
+    public void setCidr(final String cidr) {
         this.cidr = cidr;
     }
 
-    public void setVpcOfferingId(String vpcOfferingId) {
+    public void setVpcOfferingId(final String vpcOfferingId) {
         this.vpcOfferingId = vpcOfferingId;
     }
 
@@ -188,39 +188,39 @@ public class VpcResponse extends BaseResponse implements ControlledEntityRespons
         return networks;
     }
 
-    public void setNetworks(List<NetworkResponse> networks) {
+    public void setNetworks(final List<NetworkResponse> networks) {
         this.networks = networks;
     }
 
-    public void setRestartRequired(Boolean restartRequired) {
+    public void setRestartRequired(final Boolean restartRequired) {
         this.restartRequired = restartRequired;
     }
 
-    public void setNetworkDomain(String networkDomain) {
+    public void setNetworkDomain(final String networkDomain) {
         this.networkDomain = networkDomain;
     }
 
-    public void setZoneName(String zoneName) {
+    public void setZoneName(final String zoneName) {
         this.zoneName = zoneName;
     }
 
-    public void setTags(List<ResourceTagResponse> tags) {
+    public void setTags(final List<ResourceTagResponse> tags) {
         this.tags = tags;
     }
 
-    public void setForDisplay(Boolean forDisplay) {
+    public void setForDisplay(final Boolean forDisplay) {
         this.forDisplay = forDisplay;
     }
 
-    public void setRegionLevelVpc(Boolean regionLevelVpc) {
+    public void setRegionLevelVpc(final Boolean regionLevelVpc) {
         this.regionLevelVpc = regionLevelVpc;
     }
 
-    public void setUsesDistributedRouter(Boolean usesDistributedRouter) {
+    public void setUsesDistributedRouter(final Boolean usesDistributedRouter) {
         this.usesDistributedRouter = usesDistributedRouter;
     }
 
-    public void setRedundantRouter(Boolean redundantRouter) {
+    public void setRedundantRouter(final Boolean redundantRouter) {
         this.redundantRouter = redundantRouter;
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/88129ada/server/src/com/cloud/network/vpc/VpcManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/vpc/VpcManagerImpl.java b/server/src/com/cloud/network/vpc/VpcManagerImpl.java
index a85b112..c71da96 100644
--- a/server/src/com/cloud/network/vpc/VpcManagerImpl.java
+++ b/server/src/com/cloud/network/vpc/VpcManagerImpl.java
@@ -1488,7 +1488,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
 
     @Override
     @ActionEvent(eventType = EventTypes.EVENT_VPC_RESTART, eventDescription = "restarting vpc")
-    public boolean restartVpc(final long vpcId) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
+    public boolean restartVpc(final long vpcId, final boolean cleanUp) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
         final Account caller = CallContext.current().getCallingAccount();
 
         // Verify input parameters
@@ -1504,11 +1504,15 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
         s_logger.debug("Restarting VPC " + vpc);
         boolean restartRequired = false;
         try {
-            s_logger.debug("Shutting down VPC " + vpc + " as a part of VPC restart process");
-            if (!shutdownVpc(vpcId)) {
-                s_logger.warn("Failed to shutdown vpc as a part of VPC " + vpc + " restart process");
-                restartRequired = true;
-                return false;
+            if (cleanUp) {
+                s_logger.debug("Shutting down VPC " + vpc + " as a part of VPC restart process");
+                if (!shutdownVpc(vpcId)) {
+                    s_logger.warn("Failed to shutdown vpc as a part of VPC " + vpc + " restart process");
+                    restartRequired = true;
+                    return false;
+                }
+            } else {
+                s_logger.info("Will not shutdown vpc as a part of VPC " + vpc + " restart process.");
             }
 
             s_logger.debug("Starting VPC " + vpc + " as a part of VPC restart process");

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/88129ada/server/src/org/cloud/network/router/deployment/RouterDeploymentDefinition.java
----------------------------------------------------------------------
diff --git a/server/src/org/cloud/network/router/deployment/RouterDeploymentDefinition.java b/server/src/org/cloud/network/router/deployment/RouterDeploymentDefinition.java
index 3d985cd..42c756a 100644
--- a/server/src/org/cloud/network/router/deployment/RouterDeploymentDefinition.java
+++ b/server/src/org/cloud/network/router/deployment/RouterDeploymentDefinition.java
@@ -71,6 +71,9 @@ import com.cloud.vm.dao.VMInstanceDao;
 public class RouterDeploymentDefinition {
     private static final Logger logger = Logger.getLogger(RouterDeploymentDefinition.class);
 
+    protected static final int LIMIT_NUMBER_OF_ROUTERS = 5;
+    protected static final int MAX_NUMBER_OF_ROUTERS = 2;
+
     protected NetworkDao networkDao;
     protected DomainRouterDao routerDao;
     protected PhysicalNetworkServiceProviderDao physicalProviderDao;
@@ -280,7 +283,7 @@ public class RouterDeploymentDefinition {
 
     protected int getNumberOfRoutersToDeploy() {
         // TODO Are we sure this makes sense? Somebody said 5 was too many?
-        if (routers.size() >= 5) {
+        if (routers.size() >= LIMIT_NUMBER_OF_ROUTERS) {
             logger.error("Too many redundant routers!");
         }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/88129ada/server/src/org/cloud/network/router/deployment/VpcRouterDeploymentDefinition.java
----------------------------------------------------------------------
diff --git a/server/src/org/cloud/network/router/deployment/VpcRouterDeploymentDefinition.java b/server/src/org/cloud/network/router/deployment/VpcRouterDeploymentDefinition.java
index 514c37c..5124195 100644
--- a/server/src/org/cloud/network/router/deployment/VpcRouterDeploymentDefinition.java
+++ b/server/src/org/cloud/network/router/deployment/VpcRouterDeploymentDefinition.java
@@ -108,13 +108,6 @@ public class VpcRouterDeploymentDefinition extends RouterDeploymentDefinition {
         return destinations;
     }
 
-    @Override
-    protected int getNumberOfRoutersToDeploy() {
-        // Enable redundant Vpc, with the same behavior a Non Vpc Router
-        // TODO Remove this method unless we need to actually add some behavior
-        return super.getNumberOfRoutersToDeploy();
-    }
-
     /**
      * @see RouterDeploymentDefinition#prepareDeployment()
      *
@@ -126,13 +119,6 @@ public class VpcRouterDeploymentDefinition extends RouterDeploymentDefinition {
     }
 
     @Override
-    protected void setupPriorityOfRedundantRouter() {
-        // Implement Redundant Vpc
-        // TODO Remove this method unless we need to actually add some behavior
-        super.setupPriorityOfRedundantRouter();
-    }
-
-    @Override
     protected void findSourceNatIP() throws InsufficientAddressCapacityException, ConcurrentOperationException {
         sourceNatIp = vpcMgr.assignSourceNatIpAddressToVpc(owner, vpc);
     }
@@ -144,8 +130,8 @@ public class VpcRouterDeploymentDefinition extends RouterDeploymentDefinition {
             // This call will associate any existing router to the "routers" attribute.
             // It's needed in order to continue with the VMs deployment.
             planDeploymentRouters();
-            if (!routers.isEmpty()) {
-                // If routers are found, just return: nothing need to be done here.
+            if (routers.size() == MAX_NUMBER_OF_ROUTERS) {
+                // If we have 2 routers already deployed, do nothing and return.
                 return;
             }
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/88129ada/ui/scripts/network.js
----------------------------------------------------------------------
diff --git a/ui/scripts/network.js b/ui/scripts/network.js
index 50d0d59..d1bd7eb 100755
--- a/ui/scripts/network.js
+++ b/ui/scripts/network.js
@@ -5508,6 +5508,29 @@
 
                             restart: {
                                 label: 'label.restart.vpc',
+                                createForm: {
+		                            title: 'label.restart.vpc',
+		                            desc: 'message.restart.vpc',
+		                            preFilter: function(args) {
+		                               var zoneObj;
+		                               $.ajax({
+		                                   url: createURL("listZones&id=" + args.context.vpc[0].zoneid),
+		                                   dataType: "json",
+		                                   async: false,
+		                                   success: function(json) {
+		                                       zoneObj = json.listzonesresponse.zone[0];
+		                                   }
+		                               });
+		                               args.$form.find('.form-item[rel=cleanup]').find('input').attr('checked', 'checked'); //checked
+		                               args.$form.find('.form-item[rel=cleanup]').css('display', 'inline-block'); //shown
+		                           },
+		                           fields: {
+		                               cleanup: {
+		                                   label: 'label.clean.up',
+		                                   isBoolean: true
+		                               }
+		                           }
+		                        },
                                 messages: {
                                     confirm: function(args) {
                                         return 'message.restart.vpc';
@@ -5516,11 +5539,13 @@
                                         return 'label.restart.vpc';
                                     }
                                 },
+
                                 action: function(args) {
                                     $.ajax({
                                         url: createURL("restartVPC"),
                                         data: {
-                                            id: args.context.vpc[0].id
+                                            id: args.context.vpc[0].id,
+                                            cleanup: (args.data.cleanup == "on")
                                         },
                                         success: function(json) {
                                             var jid = json.restartvpcresponse.jobid;


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

Posted by bh...@apache.org.
Make virtual router id unique per redundant group
Customise the messages showed during VPC restart based on redundancy
Do not show "Make Redundant" option if VPC is already redundant
Show on VPC details if a VPC is redundant


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

Branch: refs/heads/master
Commit: 4c9f4fcdd3784eda560e9df97cc59e7aef65c504
Parents: 7a9a356
Author: wilderrodrigues <wr...@schubergphilis.com>
Authored: Wed Feb 4 17:07:17 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:39:58 2015 +0100

----------------------------------------------------------------------
 .../classes/resources/messages.properties       |  2 +
 .../classes/resources/messages_ar.properties    |  1 +
 .../classes/resources/messages_de_DE.properties |  1 +
 .../classes/resources/messages_es.properties    |  2 +
 .../classes/resources/messages_fr_FR.properties |  2 +
 .../classes/resources/messages_it_IT.properties |  3 ++
 .../classes/resources/messages_ja_JP.properties |  2 +
 .../classes/resources/messages_ko_KR.properties |  2 +
 .../classes/resources/messages_nb_NO.properties |  2 +
 .../classes/resources/messages_nl_NL.properties |  4 +-
 .../classes/resources/messages_pt_BR.properties |  6 ++-
 .../classes/resources/messages_ru_RU.properties |  2 +
 .../classes/resources/messages_zh_CN.properties |  2 +
 .../VirtualNetworkApplianceManagerImpl.java     |  6 ++-
 .../config/opt/cloud/bin/cs/CsRedundant.py      |  2 +-
 ui/dictionary.jsp                               |  2 +
 ui/scripts/network.js                           | 40 +++++++++++++++++---
 17 files changed, 71 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4c9f4fcd/client/WEB-INF/classes/resources/messages.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages.properties b/client/WEB-INF/classes/resources/messages.properties
index 6709603..6beab8a 100644
--- a/client/WEB-INF/classes/resources/messages.properties
+++ b/client/WEB-INF/classes/resources/messages.properties
@@ -998,6 +998,7 @@ label.reboot=Reboot
 label.recent.errors=Recent Errors
 label.redundant.router.capability=Redundant router capability
 label.redundant.router=Redundant Router
+label.redundant.vpc=Redundant VPC
 label.redundant.state=Redundant state
 label.refresh=Refresh
 label.region=Region
@@ -1034,6 +1035,7 @@ label.resources=Resources
 label.restart.network=Restart network
 label.restart.required=Restart required
 label.restart.vpc=Restart VPC
+message.restart.vpc.remark=Remark: making a single VPC redundant will force a clean up. The network will not be available for a couple of minutes.
 label.restore=Restore
 label.retry.interval=Retry Interval
 label.review=Review

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4c9f4fcd/client/WEB-INF/classes/resources/messages_ar.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_ar.properties b/client/WEB-INF/classes/resources/messages_ar.properties
index a36399f..728b2d4 100644
--- a/client/WEB-INF/classes/resources/messages_ar.properties
+++ b/client/WEB-INF/classes/resources/messages_ar.properties
@@ -160,6 +160,7 @@ label.reset.VPN.connection=\u0625\u0639\u0627\u062f\u0629 \u062a\u0639\u064a\u06
 label.restart.network=\u0625\u0639\u0627\u062f\u0629 \u062a\u0634\u063a\u064a\u0644 \u0627\u0644\u0634\u0628\u0643\u0629
 label.restart.required=\u0645\u0637\u0644\u0648\u0628 \u0625\u0639\u0627\u062f\u0629 \u0627\u0644\u062a\u0634\u063a\u064a\u0644
 label.restart.vpc=\u0625\u0639\u062f\u0627\u0629 \u062a\u0634\u063a\u064a\u0644 VPC
+message.restart.vpc.remark=\u0645\u0644\u0627\u062d\u0638\u0629\u003a \u062c\u0639\u0644 \u0632\u0627\u0626\u062f\u0629 \u0639\u0646 \u0627\u0644\u062d\u0627\u062c\u0629 \u0056\u0050\u0043 \u0633\u064a\u062c\u0628\u0631 \u0639\u0644\u0649 \u062a\u0646\u0638\u064a\u0641\u002e \u0644\u0646 \u062a\u0643\u0648\u0646 \u0627\u0644\u0634\u0628\u0643\u0629 \u0645\u062a\u0627\u062d\u0629 \u0644\u0628\u0636\u0639 \u062f\u0642\u0627\u0626\u0642\u002e
 label.restore=\u0625\u0633\u062a\u0639\u0627\u062f\u0629
 label.review=\u0645\u0631\u0627\u062c\u0639\u0629
 label.revoke.project.invite=\u0625\u0644\u063a\u0627\u0621 \u0627\u0644\u062f\u0639\u0648\u0629

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4c9f4fcd/client/WEB-INF/classes/resources/messages_de_DE.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_de_DE.properties b/client/WEB-INF/classes/resources/messages_de_DE.properties
index bd36088..f0754d6 100644
--- a/client/WEB-INF/classes/resources/messages_de_DE.properties
+++ b/client/WEB-INF/classes/resources/messages_de_DE.properties
@@ -752,6 +752,7 @@ label.rbd=RBD
 label.reboot=Neustart
 label.recent.errors=Aktuelle Fehler
 label.redundant.router=Redundanter Router
+label.redundant.vpc=Redundanter VPC
 label.refresh=Aktualisieren
 label.region=Region
 label.reinstall.vm=VM neu installieren

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4c9f4fcd/client/WEB-INF/classes/resources/messages_es.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_es.properties b/client/WEB-INF/classes/resources/messages_es.properties
index 91faf77..c0c1b9b 100644
--- a/client/WEB-INF/classes/resources/messages_es.properties
+++ b/client/WEB-INF/classes/resources/messages_es.properties
@@ -735,6 +735,7 @@ label.quickview=Vista R\u00e1pida
 label.reboot=Reiniciar
 label.recent.errors=recientes errores
 label.redundant.router=enrutador redundante
+label.redundant.vpc=VPC redundante
 label.refresh=Actualizar
 label.related=relacionados
 label.remind.later=Recordar mas tarde
@@ -758,6 +759,7 @@ label.resource.state=Estado del recurso
 label.restart.network=Reiniciar red
 label.restart.required=Reiniciado requerido
 label.restart.vpc=Reiniciar VPC
+message.restart.vpc.remark=\u004f\u0062\u0073\u0065\u0072\u0076\u0061\u0063\u0069\u00f3\u006e\u003a \u0068\u0061\u0063\u0065\u0072 \u0075\u006e\u0061 \u0072\u0065\u0064\u0075\u006e\u0064\u0061\u006e\u0074\u0065 \u0056\u0050\u0043 \u006f\u0062\u006c\u0069\u0067\u0061\u0072\u00e1 \u0061 \u0075\u006e\u0061 \u006c\u0069\u006d\u0070\u0069\u0065\u007a\u0061\u002e \u004c\u0061 \u0072\u0065\u0064 \u006e\u006f \u0065\u0073\u0074\u0061\u0072\u00e1 \u0064\u0069\u0073\u0070\u006f\u006e\u0069\u0062\u006c\u0065 \u0064\u0075\u0072\u0061\u006e\u0074\u0065 \u0075\u006e \u0070\u0061\u0072 \u0064\u0065 \u006d\u0069\u006e\u0075\u0074\u006f\u0073\u002e
 label.restore=Restaurar
 label.role=Papel
 label.root.disk.offering=Root Disco Offering

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4c9f4fcd/client/WEB-INF/classes/resources/messages_fr_FR.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_fr_FR.properties b/client/WEB-INF/classes/resources/messages_fr_FR.properties
index 1180465..30dbe2e 100644
--- a/client/WEB-INF/classes/resources/messages_fr_FR.properties
+++ b/client/WEB-INF/classes/resources/messages_fr_FR.properties
@@ -1163,6 +1163,7 @@ label.recent.errors=Erreurs r\u00e9centes
 label.recover.vm=Restaurer VM
 label.redundant.router.capability=Router redondant
 label.redundant.router=Routeur redondant
+label.redundant.vpc=VPC redondant
 label.redundant.state=\u00c9tat de la redondance
 label.refresh=Actualiser
 label.refresh.blades=Rafra\u00eechir Lames
@@ -1223,6 +1224,7 @@ label.response.timeout.in.sec=D\u00e9lai d\\'attente de r\u00e9ponse (sec)
 label.restart.network=Red\u00e9marrage du r\u00e9seau
 label.restart.required=Red\u00e9marrage n\u00e9cessaire
 label.restart.vpc=Red\u00e9marrer le VPC
+message.restart.vpc.remark=\u0052\u0065\u006d\u0061\u0072\u0071\u0075\u0065\u003a \u0066\u0061\u0069\u0072\u0065 \u0075\u006e\u0065 \u0072\u0065\u0064\u006f\u006e\u0064\u0061\u006e\u0074\u0065 \u0056\u0050\u0043 \u0076\u0061 \u0066\u006f\u0072\u0063\u0065\u0072 \u0075\u006e \u006e\u0065\u0074\u0074\u006f\u0079\u0061\u0067\u0065\u002e \u0052\u00e9\u0073\u0065\u0061\u0075 \u006e\u0065 \u0073\u0065\u0072\u0061 \u0070\u0061\u0073 \u0064\u0069\u0073\u0070\u006f\u006e\u0069\u0062\u006c\u0065 \u0070\u006f\u0075\u0072 \u0075\u006e \u0063\u006f\u0075\u0070\u006c\u0065 \u0064\u0065 \u006d\u0069\u006e\u0075\u0074\u0065\u0073\u002e
 label.restore=Restaurer
 label.retry.interval=Interval du nouvel essai
 label.review=Revoir

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4c9f4fcd/client/WEB-INF/classes/resources/messages_it_IT.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_it_IT.properties b/client/WEB-INF/classes/resources/messages_it_IT.properties
index 053d6ab..a18126b 100644
--- a/client/WEB-INF/classes/resources/messages_it_IT.properties
+++ b/client/WEB-INF/classes/resources/messages_it_IT.properties
@@ -276,6 +276,8 @@ label.CIDR.list=Lista CIDR
 label.CIDR.of.destination.network=Valore CIDR della rete di destinazione
 label.clear.list=Pulizia dell\\'elenco
 label.cloud.console=Console di Gestione Cloud
+label.clean.up=Ripulire
+label.make.redundant=\u004e\u006f\u0074\u0061\u003a \u0066\u0061\u0063\u0065\u006e\u0064\u006f \u0075\u006e \u0072\u0069\u0064\u006f\u006e\u0064\u0061\u006e\u0074\u0065 \u0056\u0050\u0043 \u0066\u006f\u0072\u007a\u0065\u0072\u00e0 \u0075\u006e\u0061 \u0070\u0075\u006c\u0069\u007a\u0069\u0061\u002e \u004e\u0065\u0074\u0077\u006f\u0072\u006b \u006e\u006f\u006e \u0073\u0061\u0072\u00e0 \u0064\u0069\u0073\u0070\u006f\u006e\u0069\u0062\u0069\u006c\u0065 \u0070\u0065\u0072 \u0075\u006e \u0070\u0061\u0069\u006f \u0064\u0069 \u006d\u0069\u006e\u0075\u0074\u0069\u002e
 label.cluster=Cluster
 label.cluster.name=Nome del Cluster
 label.clusters=Cluster
@@ -517,6 +519,7 @@ label.resource.state=Stato della risorsa
 label.restart.network=Riavviare il servizio di rete
 label.restart.required=E\\' necessario un riavvio
 label.restart.vpc=Riavviare VPC
+message.restart.vpc.remark=
 label.restore=Restore
 label.review=Riesaminare
 label.revoke.project.invite=Revocare un invit

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4c9f4fcd/client/WEB-INF/classes/resources/messages_ja_JP.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_ja_JP.properties b/client/WEB-INF/classes/resources/messages_ja_JP.properties
index 550d12a..46cc35d 100644
--- a/client/WEB-INF/classes/resources/messages_ja_JP.properties
+++ b/client/WEB-INF/classes/resources/messages_ja_JP.properties
@@ -988,6 +988,7 @@ label.reboot=\u518d\u8d77\u52d5
 label.recent.errors=\u6700\u8fd1\u306e\u30a8\u30e9\u30fc
 label.redundant.router.capability=\u5197\u9577\u30eb\u30fc\u30bf\u30fc\u6a5f\u80fd
 label.redundant.router=\u5197\u9577\u30eb\u30fc\u30bf\u30fc
+label.redundant.vpc=\u5197\u9577 VPC
 label.redundant.state=\u5197\u9577\u72b6\u614b
 label.refresh=\u66f4\u65b0
 label.region=\u9818\u57df
@@ -1024,6 +1025,7 @@ label.resources=\u30ea\u30bd\u30fc\u30b9
 label.restart.network=\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306e\u518d\u8d77\u52d5
 label.restart.required=\u518d\u8d77\u52d5\u304c\u5fc5\u8981
 label.restart.vpc=VPC \u306e\u518d\u8d77\u52d5
+message.restart.vpc.remark=\u5099\u8003\uff1a\u30af\u30ea\u30fc\u30f3\u30a2\u30c3\u30d7\u3092\u5f37\u5236\u7684\u306b\u0056\u0050\u0043\u306e\u5197\u9577\u5316\u3092\u884c\u3046\u3002\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u304c\u6570\u5206\u9593\u4f7f\u7528\u3067\u304d\u306a\u304f\u306a\u308a\u307e\u3059\u3002
 label.restore=\u5fa9\u5143
 label.retry.interval=\u518d\u8a66\u884c\u9593\u9694
 label.review=\u78ba\u8a8d

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4c9f4fcd/client/WEB-INF/classes/resources/messages_ko_KR.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_ko_KR.properties b/client/WEB-INF/classes/resources/messages_ko_KR.properties
index 4b7e090..7f29399 100644
--- a/client/WEB-INF/classes/resources/messages_ko_KR.properties
+++ b/client/WEB-INF/classes/resources/messages_ko_KR.properties
@@ -861,6 +861,7 @@ label.reboot=\uc7ac\uc2dc\uc791
 label.recent.errors=\ucd5c\uadfc \uc624\ub958
 label.redundant.router.capability=\uc911\ubcf5 \ub77c\uc6b0\ud130 \uae30\ub2a5
 label.redundant.router=\uc911\ubcf5 \ub77c\uc6b0\ud130
+label.redundant.vpc=\uc911\ubcf5 VPC
 label.redundant.state=\uc911\ubcf5 \uc0c1\ud0dc
 label.refresh=\uc5c5\ub370\uc774\ud2b8
 label.reinstall.vm=VM \uc7ac\uc124\uce58
@@ -896,6 +897,7 @@ label.resource=\uc790\uc6d0
 label.restart.network=\ub124\ud2b8\uc6cc\ud06c \uc7ac\uc2dc\uc791
 label.restart.required=\uc7ac\uc2dc\uc791 \ud544\uc694
 label.restart.vpc=VPC \uc7ac\uc2dc\uc791
+message.restart.vpc.remark=\ube44\uace0 \u003a \uc815\ub9ac\ub97c \uac15\uc81c \u0056\u0050\u0043\uc758 \uc911\ubcf5\uc744\u002e \ub124\ud2b8\uc6cc\ud06c\ub294 \uba87 \ubd84\uc744 \uc0ac\uc6a9\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4\u002e
 label.review=\ud655\uc778
 label.revoke.project.invite=\ucd08\ub300 \ucde8\uc18c
 label.role=\uc5ed\ud560

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4c9f4fcd/client/WEB-INF/classes/resources/messages_nb_NO.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_nb_NO.properties b/client/WEB-INF/classes/resources/messages_nb_NO.properties
index b9ade48..9a2273a 100644
--- a/client/WEB-INF/classes/resources/messages_nb_NO.properties
+++ b/client/WEB-INF/classes/resources/messages_nb_NO.properties
@@ -717,6 +717,7 @@ label.rbd=RBD
 label.reboot=Restart
 label.redundant.router.capability=Redundant ruter
 label.redundant.router=Redundant ruter
+label.redundant.vpc=Redundant VPC
 label.redundant.state=Redundant tilstand
 label.refresh=Oppfrisk
 label.region=Region
@@ -742,6 +743,7 @@ label.resources=Ressurser
 label.restart.network=Nettverksomstart
 label.restart.required=Omstart p\u00e5krevd
 label.restart.vpc=Omstart VPC
+label.restart.vpc.remrak=\u0042\u0065\u006d\u0065\u0072\u006b\u006e\u0069\u006e\u0067\u003a \u00e5 \u006c\u0061\u0067\u0065 \u0065\u006e \u0056\u0050\u0043 \u006f\u0076\u0065\u0072\u0066\u006c\u00f8\u0064\u0069\u0067 \u0076\u0069\u006c \u0074\u0076\u0069\u006e\u0067\u0065 \u0065\u006e \u0072\u0065\u006e \u006f\u0070\u0070\u002e \u004e\u0065\u0074\u0074\u0076\u0065\u0072\u006b \u0076\u0069\u006c \u0069\u006b\u006b\u0065 \u0076\u00e6\u0072\u0065 \u0074\u0069\u006c\u0067\u006a\u0065\u006e\u0067\u0065\u006c\u0069\u0067 \u0066\u006f\u0072 \u0065\u0074 \u0070\u0061\u0072 \u006d\u0069\u006e\u0075\u0074\u0074\u0065\u0072\u002e
 label.restore=Gjenopprett
 label.review=Gjennomg\u00e5
 label.revoke.project.invite=Tilbakekall invitasjonen

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4c9f4fcd/client/WEB-INF/classes/resources/messages_nl_NL.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_nl_NL.properties b/client/WEB-INF/classes/resources/messages_nl_NL.properties
index a296088..64789c2 100644
--- a/client/WEB-INF/classes/resources/messages_nl_NL.properties
+++ b/client/WEB-INF/classes/resources/messages_nl_NL.properties
@@ -1101,6 +1101,7 @@ label.recent.errors=Recente Fouten
 label.recover.vm=Herstel VM
 label.redundant.router.capability=Redundante router mogelijkheden
 label.redundant.router=Redundante Router
+label.redundant.vpc=Redundante VPC
 label.redundant.state=Redundante staat
 label.refresh.blades=Ververs Blades
 label.refresh=Ververs
@@ -1155,7 +1156,8 @@ label.resources=Verbruiken
 label.resource=Verbruik
 label.restart.network=Herstart netwerk
 label.restart.required=Herstart benodigd
-label.restart.vpc=herstart VPC
+label.restart.vpc=Herstart VPC
+label.restart.vpc.remrak=\u004f\u0070\u006d\u0065\u0072\u006b\u0069\u006e\u0067\u003a \u0068\u0065\u0074 \u006d\u0061\u006b\u0065\u006e \u0076\u0061\u006e \u0065\u0065\u006e \u0056\u0050\u0043 \u006f\u0076\u0065\u0072\u0062\u006f\u0064\u0069\u0067 \u007a\u0061\u006c \u0065\u0065\u006e \u0073\u0063\u0068\u006f\u006f\u006e \u0064\u0077\u0069\u006e\u0067\u0065\u006e\u002e \u004e\u0065\u0074\u0077\u0065\u0072\u006b \u007a\u0061\u006c \u006e\u0069\u0065\u0074 \u0062\u0065\u0073\u0063\u0068\u0069\u006b\u0062\u0061\u0061\u0072 \u007a\u0069\u006a\u006e \u0076\u006f\u006f\u0072 \u0065\u0065\u006e \u0070\u0061\u0061\u0072 \u006d\u0069\u006e\u0075\u0074\u0065\u006e\u002e
 label.restore=Herstel
 label.review=Beoordeel
 label.revoke.project.invite=Trek uitnodiging in

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4c9f4fcd/client/WEB-INF/classes/resources/messages_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_pt_BR.properties b/client/WEB-INF/classes/resources/messages_pt_BR.properties
index 4eb6997..40b7b12 100644
--- a/client/WEB-INF/classes/resources/messages_pt_BR.properties
+++ b/client/WEB-INF/classes/resources/messages_pt_BR.properties
@@ -975,7 +975,8 @@ label.reboot=Reiniciar
 label.recent.errors=Erros Recentes
 label.recover.vm=Recuperar VM
 label.redundant.router.capability=Recurso de roteador redundante
-label.redundant.router=Roteador Redundantee
+label.redundant.router=Roteador Redundante
+label.redundant.vpc=VPC Redundante
 label.redundant.state=Estado redundante
 label.refresh=Atualizar
 label.region=Regi\u00e3o
@@ -1014,7 +1015,8 @@ label.resources=Recursos
 label.resource.state=Estado do Recurso
 label.restart.network=Reiniciar rede
 label.restart.required=Reiniciar obrigat\u00f3rio
-label.restart.vpc=reiniciar a VPC
+label.restart.vpc=Reiniciar a VPC
+label.restart.vpc.remrak=\u004f\u0062\u0073\u0065\u0072\u0076\u0061\u00e7\u00e3\u006f\u003a \u0074\u006f\u0072\u006e\u0061\u0072 \u0075\u006d\u0061 \u0056\u0050\u0043 \u0072\u0065\u0064\u0075\u006e\u0064\u0061\u006e\u0074\u0065 \u0066\u006f\u0072\u00e7\u0061\u0072\u00e1 \u0075\u006d\u0061 \u006c\u0069\u006d\u0070\u0065\u007a\u0061\u002e \u0041 \u0072\u0065\u0064\u0065 \u006e\u00e3\u006f \u0065\u0073\u0074\u0061\u0072\u00e1 \u0064\u0069\u0073\u0070\u006f\u006e\u00ed\u0076\u0065\u006c \u0070\u006f\u0072 \u0061\u006c\u0067\u0075\u006e\u0073 \u006d\u0069\u006e\u0075\u0074\u006f\u0073\u002e
 label.restore=Restaurar
 label.review=Revisar
 label.revoke.project.invite=Revogar convite

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4c9f4fcd/client/WEB-INF/classes/resources/messages_ru_RU.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_ru_RU.properties b/client/WEB-INF/classes/resources/messages_ru_RU.properties
index e825605..085af0f 100644
--- a/client/WEB-INF/classes/resources/messages_ru_RU.properties
+++ b/client/WEB-INF/classes/resources/messages_ru_RU.properties
@@ -917,6 +917,7 @@ label.reboot=\u041f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\
 label.recent.errors=\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438
 label.redundant.router.capability=\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u043e\u0433\u043e \u0440\u043e\u0443\u0442\u0435\u0440\u0430
 label.redundant.router=\u0420\u0435\u0437\u0435\u0440\u0432\u043d\u043e\u0439 \u0440\u043e\u0443\u0442\u0435\u0440
+label.redundant.vpc=\u0420\u0435\u0437\u0435\u0440\u0432\u043d\u044b\u0439 \u0056\u0050\u0043
 label.redundant.state=\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0440\u0435\u0437\u0435\u0440\u0432\u0430
 label.refresh=\u041e\u0431\u043d\u043e\u0432\u0438\u0442\u044c
 label.region=\u0420\u0435\u0433\u0438\u043e\u043d
@@ -953,6 +954,7 @@ label.resource=\u0420\u0435\u0441\u0443\u0440\u0441
 label.restart.network=\u041f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441\u0435\u0442\u044c
 label.restart.required=\u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a
 label.restart.vpc=\u041f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c VPC
+label.restart.vpc.remrak=\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435\u003a \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438\u0437\u043b\u0438\u0448\u043d\u0438\u043c \u0056\u0050\u0043 \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442 \u0443\u0431\u0438\u0440\u0430\u0442\u044c\u002e\u0421\u0435\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043c\u0438\u043d\u0443\u0442\u002e
 label.restore=\u0412\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c
 label.review=\u041e\u0431\u0437\u043e\u0440
 label.revoke.project.invite=\u041e\u0442\u043e\u0437\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4c9f4fcd/client/WEB-INF/classes/resources/messages_zh_CN.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages_zh_CN.properties b/client/WEB-INF/classes/resources/messages_zh_CN.properties
index 427b060..969391f 100644
--- a/client/WEB-INF/classes/resources/messages_zh_CN.properties
+++ b/client/WEB-INF/classes/resources/messages_zh_CN.properties
@@ -988,6 +988,7 @@ label.reboot=\u91cd\u65b0\u542f\u52a8
 label.recent.errors=\u6700\u8fd1\u51fa\u73b0\u7684\u9519\u8bef
 label.redundant.router.capability=\u5197\u4f59\u8def\u7531\u5668\u529f\u80fd
 label.redundant.router=\u5197\u4f59\u8def\u7531\u5668
+label.redundant.vpc=\u591a\u9918\u7684\u0056\u0050\u0043
 label.redundant.state=\u5197\u4f59\u72b6\u6001
 label.refresh=\u5237\u65b0
 label.region=\u5730\u7406\u533a\u57df
@@ -1024,6 +1025,7 @@ label.resources=\u8d44\u6e90
 label.restart.network=\u91cd\u65b0\u542f\u52a8\u7f51\u7edc
 label.restart.required=\u9700\u8981\u91cd\u65b0\u542f\u52a8
 label.restart.vpc=\u91cd\u65b0\u542f\u52a8 VPC
+message.restart.vpc.remark=\u5099\u8a3b\uff1a\u88fd\u4f5c\u0056\u0050\u0043\u5197\u9918\u5c07\u5f37\u5236\u6e05\u7406\u3002\u8a72\u7db2\u7d61\u5c07\u4e0d\u53ef\u7528\u4e86\u5e7e\u5206\u9418\u3002
 label.restore=\u8fd8\u539f
 label.retry.interval=\u91cd\u8bd5\u65f6\u95f4\u95f4\u9694
 label.review=\u6838\u5bf9

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4c9f4fcd/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 eb6496c..5bca748 100644
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -1590,7 +1590,6 @@ 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;
@@ -1605,9 +1604,14 @@ 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);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4c9f4fcd/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 8561e8d..7e4dcab 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py
@@ -116,7 +116,7 @@ class CsRedundant(object):
         #file.search(" weight ", "    weight %s" % 2)
         # file.search(" state ", "    state %s" % self.cl.get_state())
         file.search(" state ", "    state %s" % "EQUAL")
-        # file.search(" virtual_router_id ", "    virtual_router_id %s" % self.cl.get_router_id())
+        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()

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4c9f4fcd/ui/dictionary.jsp
----------------------------------------------------------------------
diff --git a/ui/dictionary.jsp b/ui/dictionary.jsp
index 895f426..3f5d73b 100644
--- a/ui/dictionary.jsp
+++ b/ui/dictionary.jsp
@@ -1028,6 +1028,8 @@ dictionary = {
 'label.restart.network': '<fmt:message key="label.restart.network" />',
 'label.restart.required': '<fmt:message key="label.restart.required" />',
 'label.restart.vpc': '<fmt:message key="label.restart.vpc" />',
+'label.redundant.vpc': '<fmt:message key="label.redundant.vpc" />',
+'message.restart.vpc.remark': '<fmt:message key="message.restart.vpc.remark" />',
 'label.restore': '<fmt:message key="label.restore" />',
 'label.retry.interval': '<fmt:message key="label.retry.interval" />',
 'label.review': '<fmt:message key="label.review" />',

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4c9f4fcd/ui/scripts/network.js
----------------------------------------------------------------------
diff --git a/ui/scripts/network.js b/ui/scripts/network.js
index b1e4d22..e7ab5fc 100755
--- a/ui/scripts/network.js
+++ b/ui/scripts/network.js
@@ -5510,7 +5510,14 @@
                                 label: 'label.restart.vpc',
                                 createForm: {
 		                            title: 'label.restart.vpc',
-		                            desc: 'message.restart.vpc',
+		                            desc: function(args) {
+		                                if (Boolean(args.context.vpc[0].redundantvpcrouter)) {
+		                                   return 'message.restart.vpc';
+		                               } else {
+		                                   return 'message.restart.vpc.remark';
+		                               }
+		                            },
+                                    
 		                            preFilter: function(args) {
 		                               var zoneObj;
 		                               $.ajax({
@@ -5521,10 +5528,18 @@
 		                                       zoneObj = json.listzonesresponse.zone[0];
 		                                   }
 		                               });
+		                               
+		                               
 		                               args.$form.find('.form-item[rel=cleanup]').find('input').attr('checked', 'checked'); //checked
 		                               args.$form.find('.form-item[rel=cleanup]').css('display', 'inline-block'); //shown
 	                                   args.$form.find('.form-item[rel=makeredundant]').find('input').attr('checked', 'checked'); //checked
 	                                   args.$form.find('.form-item[rel=makeredundant]').css('display', 'inline-block'); //shown
+	                                   
+		                               if (Boolean(args.context.vpc[0].redundantvpcrouter)) {
+		                                   args.$form.find('.form-item[rel=makeredundant]').hide();
+		                               } else {
+		                                   args.$form.find('.form-item[rel=makeredundant]').show();
+		                               }
 		                           },
 		                           fields: {
 		                               cleanup: {
@@ -5539,7 +5554,7 @@
 		                        },
                                 messages: {
                                     confirm: function(args) {
-                                        return 'message.restart.vpc';
+		                                return 'message.restart.vpc';
                                     },
                                     notification: function(args) {
                                         return 'label.restart.vpc';
@@ -5651,14 +5666,29 @@
                                     },
                                     ispersistent: {
                                         label: 'label.persistent',
-                                        converter: cloudStack.converters.toBooleanText
+                                        converter: function(booleanValue) {
+                                            if (booleanValue == true) {
+                                                return "Yes";
+                                            }
+
+                                            return "No";
+                                        }
+                                    },
+                                    redundantvpcrouter: {
+                                        label: 'label.redundant.vpc',
+                                        converter: function(booleanValue) {
+                                            if (booleanValue == true) {
+                                                return "Yes";
+                                            }
 
+                                            return "No";
+                                        }
                                     },
                                     restartrequired: {
                                         label: 'label.restart.required',
                                         converter: function(booleanValue) {
                                             if (booleanValue == true) {
-                                                return "<font color='red'>Yes</font>";
+                                                return "Yes";
                                             }
 
                                             return "No";
@@ -5729,7 +5759,7 @@
                                         label: 'label.redundant.router',
                                         converter: function(booleanValue) {
                                             if (booleanValue == true) {
-                                                return "<font color='red'>Yes</font>";
+                                                return "Yes";
                                             }
                                             return "No";
                                         }


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

Posted by bh...@apache.org.
Work arounds for how CS adds and removes hosts


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

Branch: refs/heads/master
Commit: 3cc0915a01c88ef533730b62115ad47021706d0a
Parents: 748e2e5
Author: Ian Southam <is...@schubergphilis.com>
Authored: Wed Feb 18 18:55:54 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:40:08 2015 +0100

----------------------------------------------------------------------
 .../patches/debian/config/opt/cloud/bin/cs/CsDhcp.py   | 13 +++++--------
 .../patches/debian/config/opt/cloud/bin/cs/CsFile.py   |  3 +++
 2 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3cc0915a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDhcp.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDhcp.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDhcp.py
index 1b76b86..821444f 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDhcp.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDhcp.py
@@ -128,8 +128,9 @@ class CsDhcp(CsDataBag):
 
     def write_hosts(self):
         file = CsFile("/etc/hosts")
+        file.repopulate()
         for ip in self.hosts:
-            file.search("^%s" % ip, "%s\t%s" % (ip, self.hosts[ip]))
+            file.add("%s\t%s" % (ip, self.hosts[ip]))
         file.commit()
         if file.is_changed():
             logging.info("Updated hosts file")
@@ -138,13 +139,9 @@ class CsDhcp(CsDataBag):
 
     def add(self, entry):
         self.add_host(entry['ipv4_adress'], entry['host_name'])
-        if self.cloud.search("%s," % entry['mac_address'],
-                             "%s,%s,%s,infinite" % (entry['mac_address'],
-                                                    entry['ipv4_adress'],
-                                                    entry['host_name'])):
-                        self.changed.append({'mac': entry['mac_address'],
-                                             'ip4': entry['ipv4_adress'],
-                                             'host': entry['host_name']})
+        self.cloud.add("%s,%s,%s,infinite" % (entry['mac_address'],
+                                              entry['ipv4_adress'],
+                                              entry['host_name']))
         i = IPAddress(entry['ipv4_adress'])
         # Calculate the device
         for v in self.devinfo:

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3cc0915a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsFile.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsFile.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsFile.py
index e3d11dd..6195f4e 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsFile.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsFile.py
@@ -53,6 +53,9 @@ class CsFile:
         self.config = []
         self.new_config = []
 
+    def repopulate(self):
+        self.new_config = []
+
     def commit(self):
         if not self.is_changed():
             return


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

Posted by bh...@apache.org.
During the merge I removed by mistake the @Inject tag


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

Branch: refs/heads/master
Commit: 962a62ed5fae8c72f34c23078f2c1de6543417f2
Parents: 20d9715
Author: wilderrodrigues <wr...@schubergphilis.com>
Authored: Mon Feb 16 17:06:56 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:40:07 2015 +0100

----------------------------------------------------------------------
 server/src/com/cloud/network/router/NetworkHelperImpl.java | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/962a62ed/server/src/com/cloud/network/router/NetworkHelperImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/NetworkHelperImpl.java b/server/src/com/cloud/network/router/NetworkHelperImpl.java
index dd8befd..347a5e1 100644
--- a/server/src/com/cloud/network/router/NetworkHelperImpl.java
+++ b/server/src/com/cloud/network/router/NetworkHelperImpl.java
@@ -144,6 +144,7 @@ public class NetworkHelperImpl implements NetworkHelper {
     protected NetworkOrchestrationService _networkMgr;
     @Inject
     private UserDao _userDao;
+    @Inject
     protected ServiceOfferingDao _serviceOfferingDao;
     @Inject
     protected VirtualMachineManager _itMgr;


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

Posted by bh...@apache.org.
Move the . to the right place.


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

Branch: refs/heads/master
Commit: 6194b2c93e7c37d4e4515f1d05ce142b11aadb48
Parents: dfa37b3
Author: wilderrodrigues <wr...@schubergphilis.com>
Authored: Thu Feb 5 11:51:40 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:40:00 2015 +0100

----------------------------------------------------------------------
 client/WEB-INF/classes/resources/messages.properties | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6194b2c9/client/WEB-INF/classes/resources/messages.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages.properties b/client/WEB-INF/classes/resources/messages.properties
index 6acffd0..ca67d68 100644
--- a/client/WEB-INF/classes/resources/messages.properties
+++ b/client/WEB-INF/classes/resources/messages.properties
@@ -1035,7 +1035,7 @@ label.resources=Resources
 label.restart.network=Restart network
 label.restart.required=Restart required
 label.restart.vpc=Restart VPC
-message.restart.vpc.remark=Please confirm that you want to restart the VPC <p><small><i>Remark: making a non-redundant VPC redundant will force a clean up. The networks will not be available for a couple of minutes</i></small></p>.
+message.restart.vpc.remark=Please confirm that you want to restart the VPC <p><small><i>Remark: making a non-redundant VPC redundant will force a clean up. The networks will not be available for a couple of minutes</i>.</small></p>
 label.restore=Restore
 label.retry.interval=Retry Interval
 label.review=Review


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

Posted by bh...@apache.org.
Fix checkSanity. We do not need to check the priority anymore.
   - It's taken care by VRRP.

wip: clean up where priority is still used.


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

Branch: refs/heads/master
Commit: 3af2ce3f50406e88780c7117806040fe9db624c2
Parents: 57d3ffa
Author: wilderrodrigues <wr...@schubergphilis.com>
Authored: Fri Feb 6 14:12:40 2015 +0100
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Mar 16 11:40:03 2015 +0100

----------------------------------------------------------------------
 .../VirtualNetworkApplianceManagerImpl.java     | 24 +++++++++++++-------
 1 file changed, 16 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3af2ce3f/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 1ad7a9f..588a354 100644
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -1077,10 +1077,19 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
                         continue;
                     }
                     checkedNetwork.add(routerGuestNtwkId);
-                    final List<DomainRouterVO> checkingRouters = _routerDao.listByNetworkAndRole(routerGuestNtwkId, Role.VIRTUAL_ROUTER);
+                    
+                    final List<DomainRouterVO> checkingRouters;
+                    Long vpcId = router.getVpcId();
+                    if (vpcId != null) {
+                        checkingRouters = _routerDao.listByVpcId(vpcId);
+                    } else {
+                        checkingRouters = _routerDao.listByNetworkAndRole(routerGuestNtwkId, Role.VIRTUAL_ROUTER);
+                    }
+                    
                     if (checkingRouters.size() != 2) {
                         continue;
                     }
+                    
                     DomainRouterVO masterRouter = null;
                     DomainRouterVO backupRouter = null;
                     for (final DomainRouterVO r : checkingRouters) {
@@ -1088,23 +1097,22 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
                             if (masterRouter == null) {
                                 masterRouter = r;
                             } else {
-                                // Duplicate master! We give up, until the admin
-                                // fix duplicate MASTER issue
+                                // Wilder Rodrigues (wrodrigues@schubergphilis.com
+                                // Force a restart in order to fix the conflict
+                                recoverRedundantNetwork(masterRouter, r);
                                 break;
                             }
                         } else if (r.getRedundantState() == RedundantState.BACKUP) {
                             if (backupRouter == null) {
                                 backupRouter = r;
                             } else {
+                                // Wilder Rodrigues (wrodrigues@schubergphilis.com
+                                // Do we have 2 routers in Backup state? Perhaps a restart of 1 router is needed.
+                                recoverRedundantNetwork(backupRouter, r);
                                 break;
                             }
                         }
                     }
-                    if (masterRouter != null && backupRouter != null) {
-                        if (_nwHelper.getRealPriority(masterRouter) - DEFAULT_DELTA + 1 != _nwHelper.getRealPriority(backupRouter) || backupRouter.getIsPriorityBumpUp()) {
-                            recoverRedundantNetwork(masterRouter, backupRouter);
-                        }
-                    }
                 }
             }
         }