cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alena1...@apache.org
Subject [2/2] git commit: updated refs/heads/internallb to a7b43c3
Date Mon, 08 Apr 2013 23:58:38 GMT
InternalLB - removed unused code from LoadBalancerDao


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

Branch: refs/heads/internallb
Commit: a7b43c3db62ac436e9caec0e29e457755cb75134
Parents: f65573b
Author: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Authored: Mon Apr 8 16:57:47 2013 -0700
Committer: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Committed: Mon Apr 8 16:57:47 2013 -0700

----------------------------------------------------------------------
 .../com/cloud/network/dao/FirewallRulesDao.java    |    1 -
 .../src/com/cloud/network/dao/LoadBalancerDao.java |    5 -
 .../com/cloud/network/dao/LoadBalancerDaoImpl.java |   67 +--------------
 3 files changed, 3 insertions(+), 70 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a7b43c3d/server/src/com/cloud/network/dao/FirewallRulesDao.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/dao/FirewallRulesDao.java b/server/src/com/cloud/network/dao/FirewallRulesDao.java
index 0bbaa93..6b9b3bb 100644
--- a/server/src/com/cloud/network/dao/FirewallRulesDao.java
+++ b/server/src/com/cloud/network/dao/FirewallRulesDao.java
@@ -18,7 +18,6 @@ package com.cloud.network.dao;
 
 import java.util.List;
 
-import com.cloud.host.HostVO;
 import com.cloud.network.rules.FirewallRule;
 import com.cloud.network.rules.FirewallRuleVO;
 import com.cloud.utils.db.GenericDao;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a7b43c3d/server/src/com/cloud/network/dao/LoadBalancerDao.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/dao/LoadBalancerDao.java b/server/src/com/cloud/network/dao/LoadBalancerDao.java
index 2a3e92e..331f755 100644
--- a/server/src/com/cloud/network/dao/LoadBalancerDao.java
+++ b/server/src/com/cloud/network/dao/LoadBalancerDao.java
@@ -22,14 +22,9 @@ import com.cloud.network.rules.LoadBalancerContainer.Scheme;
 import com.cloud.utils.db.GenericDao;
 
 public interface LoadBalancerDao extends GenericDao<LoadBalancerVO, Long> {
-    List<Long> listInstancesByLoadBalancer(long loadBalancerId);
 
     List<LoadBalancerVO> listByIpAddress(long ipAddressId);
 
-    LoadBalancerVO findByIpAddressAndPublicPort(long ipAddressId, String publicPort);
-
-    LoadBalancerVO findByAccountAndName(Long accountId, String name);
-
     List<LoadBalancerVO> listByNetworkIdAndScheme(long networkId, Scheme scheme);
 
     List<LoadBalancerVO> listInTransitionStateByNetworkIdAndScheme(long networkId,
Scheme scheme);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a7b43c3d/server/src/com/cloud/network/dao/LoadBalancerDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/dao/LoadBalancerDaoImpl.java b/server/src/com/cloud/network/dao/LoadBalancerDaoImpl.java
index 39a3aac..c20d8b2 100644
--- a/server/src/com/cloud/network/dao/LoadBalancerDaoImpl.java
+++ b/server/src/com/cloud/network/dao/LoadBalancerDaoImpl.java
@@ -16,15 +16,11 @@
 // under the License.
 package com.cloud.network.dao;
 
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.util.ArrayList;
 import java.util.List;
 
 import javax.ejb.Local;
 import javax.inject.Inject;
 
-import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
 
 import com.cloud.network.rules.FirewallRule.State;
@@ -33,23 +29,11 @@ import com.cloud.utils.db.GenericDaoBase;
 import com.cloud.utils.db.SearchBuilder;
 import com.cloud.utils.db.SearchCriteria;
 import com.cloud.utils.db.SearchCriteria.Op;
-import com.cloud.utils.db.Transaction;
 
 @Component
 @Local(value = { LoadBalancerDao.class })
 public class LoadBalancerDaoImpl extends GenericDaoBase<LoadBalancerVO, Long> implements
LoadBalancerDao {
-    private static final Logger s_logger = Logger.getLogger(LoadBalancerDaoImpl.class);
-    private static final String LIST_INSTANCES_BY_LOAD_BALANCER = "SELECT vm.id " +
-            "    FROM vm_instance vm, load_balancer lb, ip_forwarding fwd, user_ip_address
ip " +
-            "    WHERE lb.id = ? AND " +
-            "          fwd.group_id = lb.id AND " +
-            "          fwd.forwarding = 0 AND " +
-            "          fwd.private_ip_address = vm.private_ip_address AND " +
-            "          lb.ip_address = ip.public_ip_address AND " +
-            "          ip.data_center_id = vm.data_center_id ";
     private final SearchBuilder<LoadBalancerVO> ListByIp;
-    private final SearchBuilder<LoadBalancerVO> IpAndPublicPortSearch;
-    private final SearchBuilder<LoadBalancerVO> AccountAndNameSearch;
     protected final SearchBuilder<LoadBalancerVO> TransitionStateSearch;
 
     @Inject protected FirewallRulesCidrsDao _portForwardingRulesCidrsDao;
@@ -61,43 +45,13 @@ public class LoadBalancerDaoImpl extends GenericDaoBase<LoadBalancerVO,
Long> im
         ListByIp.and("scheme", ListByIp.entity().getScheme(), SearchCriteria.Op.EQ);
         ListByIp.done();
 
-        IpAndPublicPortSearch = createSearchBuilder();
-        IpAndPublicPortSearch.and("ipAddressId", IpAndPublicPortSearch.entity().getSourceIpAddressId(),
SearchCriteria.Op.EQ);
-        IpAndPublicPortSearch.and("publicPort", IpAndPublicPortSearch.entity().getSourcePortStart(),
SearchCriteria.Op.EQ);
-        IpAndPublicPortSearch.done();
-
-        AccountAndNameSearch = createSearchBuilder();
-        AccountAndNameSearch.and("accountId", AccountAndNameSearch.entity().getAccountId(),
SearchCriteria.Op.EQ);
-        AccountAndNameSearch.and("name", AccountAndNameSearch.entity().getName(), SearchCriteria.Op.EQ);
-        AccountAndNameSearch.done();
-
         TransitionStateSearch = createSearchBuilder();
         TransitionStateSearch.and("networkId", TransitionStateSearch.entity().getNetworkId(),
Op.EQ);
         TransitionStateSearch.and("state", TransitionStateSearch.entity().getState(), Op.IN);
+        TransitionStateSearch.and("scheme", TransitionStateSearch.entity().getScheme(), Op.EQ);
         TransitionStateSearch.done();
     }
-
-    @Override
-    public List<Long> listInstancesByLoadBalancer(long loadBalancerId) {
-        Transaction txn = Transaction.currentTxn();
-        String sql = LIST_INSTANCES_BY_LOAD_BALANCER;
-        PreparedStatement pstmt = null;
-        List<Long> instanceList = new ArrayList<Long>();
-        try {
-            pstmt = txn.prepareAutoCloseStatement(sql);
-            pstmt.setLong(1, loadBalancerId);
-
-            ResultSet rs = pstmt.executeQuery();
-            while (rs.next()) {
-                Long vmId = rs.getLong(1);
-                instanceList.add(vmId);
-            }
-        } catch (Exception ex) {
-            s_logger.error("error getting recent usage network stats", ex);
-        }
-        return instanceList;
-    }
-
+    
     @Override
     public List<LoadBalancerVO> listByIpAddress(long ipAddressId) {
         SearchCriteria<LoadBalancerVO> sc = ListByIp.create();
@@ -114,26 +68,11 @@ public class LoadBalancerDaoImpl extends GenericDaoBase<LoadBalancerVO,
Long> im
     }
 
     @Override
-    public LoadBalancerVO findByIpAddressAndPublicPort(long ipAddressId, String publicPort)
{
-        SearchCriteria<LoadBalancerVO> sc = IpAndPublicPortSearch.create();
-        sc.setParameters("ipAddressId", ipAddressId);
-        sc.setParameters("publicPort", publicPort);
-        return findOneBy(sc);
-    }
-
-    @Override
-    public LoadBalancerVO findByAccountAndName(Long accountId, String name) {
-        SearchCriteria<LoadBalancerVO> sc = AccountAndNameSearch.create();
-        sc.setParameters("accountId", accountId);
-        sc.setParameters("name", name);
-        return findOneBy(sc);
-    }
-
-    @Override
     public List<LoadBalancerVO> listInTransitionStateByNetworkIdAndScheme(long networkId,
Scheme scheme) {
         SearchCriteria<LoadBalancerVO> sc = TransitionStateSearch.create();
         sc.setParameters("networkId", networkId);
         sc.setParameters("state", State.Add.toString(), State.Revoke.toString());
+        sc.setParameters("scheme", scheme);
         return listBy(sc);
     }
 


Mime
View raw message