cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject git commit: updated refs/heads/4.5 to b879916
Date Mon, 09 Mar 2015 10:59:34 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/4.5 b2b9de7fa -> b879916f5


CLOUDSTACK-7639: make cidr updation more efficient

check and update only when required

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


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

Branch: refs/heads/4.5
Commit: b879916f5c64ddbca8713852b2c0ac187e9be1ff
Parents: b2b9de7
Author: Rohit Yadav <rohit.yadav@shapeblue.com>
Authored: Mon Mar 9 16:29:05 2015 +0530
Committer: Rohit Yadav <rohit.yadav@shapeblue.com>
Committed: Mon Mar 9 16:29:05 2015 +0530

----------------------------------------------------------------------
 .../com/cloud/network/vpc/NetworkACLItemCidrsDao.java    |  2 ++
 .../network/vpc/dao/NetworkACLItemCidrsDaoImpl.java      | 11 +++++++++++
 .../com/cloud/network/vpc/dao/NetworkACLItemDaoImpl.java |  2 +-
 3 files changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b879916f/engine/schema/src/com/cloud/network/vpc/NetworkACLItemCidrsDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/vpc/NetworkACLItemCidrsDao.java b/engine/schema/src/com/cloud/network/vpc/NetworkACLItemCidrsDao.java
index 5e49368..3b661fa 100644
--- a/engine/schema/src/com/cloud/network/vpc/NetworkACLItemCidrsDao.java
+++ b/engine/schema/src/com/cloud/network/vpc/NetworkACLItemCidrsDao.java
@@ -31,6 +31,8 @@ public interface NetworkACLItemCidrsDao extends GenericDao<NetworkACLItemCidrsVO
 
     void persist(long networkACLItemId, List<String> cidrs);
 
+    void updateCidrs(long networkACLItemId, List<String> cidrs);
+
     List<String> getCidrs(long networkACLItemId);
 
     @DB

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b879916f/engine/schema/src/com/cloud/network/vpc/dao/NetworkACLItemCidrsDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/vpc/dao/NetworkACLItemCidrsDaoImpl.java b/engine/schema/src/com/cloud/network/vpc/dao/NetworkACLItemCidrsDaoImpl.java
index 7c02f8b..4c2574e 100644
--- a/engine/schema/src/com/cloud/network/vpc/dao/NetworkACLItemCidrsDaoImpl.java
+++ b/engine/schema/src/com/cloud/network/vpc/dao/NetworkACLItemCidrsDaoImpl.java
@@ -64,6 +64,17 @@ public class NetworkACLItemCidrsDaoImpl extends GenericDaoBase<NetworkACLItemCid
         txn.commit();
     }
 
+    @Override
+    public void updateCidrs(long networkACLItemId, List<String> cidrs) {
+        List<String> oldCidrs = getCidrs(networkACLItemId);
+        if (!(oldCidrs.size() == cidrs.size() && oldCidrs.equals(cidrs))) {
+            SearchCriteria<NetworkACLItemCidrsVO> sc = cidrsSearch.create();
+            sc.setParameters("networkAclItemId", networkACLItemId);
+            remove(sc);
+            persist(networkACLItemId, cidrs);
+        }
+    }
+
     /* (non-Javadoc)
      * @see com.cloud.network.dao.NetworkAclItemCidrsDao#getCidrs(long)
      */

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b879916f/engine/schema/src/com/cloud/network/vpc/dao/NetworkACLItemDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/vpc/dao/NetworkACLItemDaoImpl.java b/engine/schema/src/com/cloud/network/vpc/dao/NetworkACLItemDaoImpl.java
index 88e00a1..201197c 100644
--- a/engine/schema/src/com/cloud/network/vpc/dao/NetworkACLItemDaoImpl.java
+++ b/engine/schema/src/com/cloud/network/vpc/dao/NetworkACLItemDaoImpl.java
@@ -93,7 +93,7 @@ public class NetworkACLItemDaoImpl extends GenericDaoBase<NetworkACLItemVO,
Long
     @Override
     public boolean update(Long id, NetworkACLItemVO item) {
         boolean result = super.update(id, item);
-        saveCidrs(item, item.getSourceCidrList());
+        _networkACLItemCidrsDao.updateCidrs(item.getId(), item.getSourceCidrList());
         return result;
     }
 


Mime
View raw message