cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahu...@apache.org
Subject [04/10] Changed SearchCriteria2 to GenericQueryBuilder to reflect the same placement
Date Sat, 28 Sep 2013 14:50:25 GMT
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e8cac2c5/server/src/com/cloud/storage/OCFS2ManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/OCFS2ManagerImpl.java b/server/src/com/cloud/storage/OCFS2ManagerImpl.java
index c258a96..e38ca5b 100755
--- a/server/src/com/cloud/storage/OCFS2ManagerImpl.java
+++ b/server/src/com/cloud/storage/OCFS2ManagerImpl.java
@@ -142,10 +142,10 @@ public class OCFS2ManagerImpl extends ManagerBase implements OCFS2Manager,
Resou
         }
 
         GenericQueryBuilder<HostVO, HostVO> sc = GenericQueryBuilder.create(HostVO.class);
-        sc.addAnd(sc.getEntity().getClusterId(), Op.EQ, clusterId);
-        sc.addAnd(sc.getEntity().getPodId(), Op.EQ, cluster.getPodId());
-        sc.addAnd(sc.getEntity().getDataCenterId(), Op.EQ, cluster.getDataCenterId());
-        sc.addAnd(sc.getEntity().getType(), Op.EQ, Host.Type.Routing);
+        sc.and(sc.entity().getClusterId(), Op.EQ, clusterId);
+        sc.and(sc.entity().getPodId(), Op.EQ, cluster.getPodId());
+        sc.and(sc.entity().getDataCenterId(), Op.EQ, cluster.getDataCenterId());
+        sc.and(sc.entity().getType(), Op.EQ, Host.Type.Routing);
         List<HostVO> hosts = sc.list();
         if (hosts.isEmpty()) {
             s_logger.debug("There is no host in cluster " + clusterId + ", no need to prepare
OCFS2 nodes");

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e8cac2c5/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java b/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
index a6af811..3a07034 100755
--- a/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
+++ b/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
@@ -75,6 +75,7 @@ import com.cloud.exception.ResourceUnavailableException;
 import com.cloud.exception.StorageUnavailableException;
 import com.cloud.host.Host;
 import com.cloud.host.HostVO;
+import com.cloud.host.Status;
 import com.cloud.host.dao.HostDao;
 import com.cloud.hypervisor.Hypervisor.HypervisorType;
 import com.cloud.info.RunningHostCountInfo;
@@ -114,9 +115,8 @@ import com.cloud.utils.NumbersUtil;
 import com.cloud.utils.Pair;
 import com.cloud.utils.component.ManagerBase;
 import com.cloud.utils.db.GlobalLock;
+import com.cloud.utils.db.QueryBuilder;
 import com.cloud.utils.db.SearchCriteria.Op;
-import com.cloud.utils.db.GenericQueryBuilder;
-import com.cloud.utils.db.GenericQueryBuilder;
 import com.cloud.utils.events.SubscriptionMgr;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.net.NetUtils;
@@ -420,9 +420,9 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements
Secondar
         SecStorageFirewallCfgCommand thiscpc = new SecStorageFirewallCfgCommand(true);
         thiscpc.addPortConfig(thisSecStorageVm.getPublicIpAddress(), copyPort, true, TemplateConstants.DEFAULT_TMPLT_COPY_INTF);
 
-        GenericQueryBuilder<HostVO, HostVO> sc = GenericQueryBuilder.create(HostVO.class);
-        sc.addAnd(sc.getEntity().getType(), Op.EQ, Host.Type.SecondaryStorageVM);
-        sc.addAnd(sc.getEntity().getStatus(), Op.IN, com.cloud.host.Status.Up, com.cloud.host.Status.Connecting);
+        QueryBuilder<HostVO> sc = QueryBuilder.create(HostVO.class);
+        sc.and(sc.entity().getType(), Op.EQ,Host.Type.SecondaryStorageVM);
+        sc.and(sc.entity().getStatus(), Op.IN, Status.Up, Status.Connecting);
         List<HostVO> ssvms = sc.list();
         for (HostVO ssvm : ssvms) {
             if (ssvm.getId() == ssAHostId) {
@@ -1345,12 +1345,12 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements
Secondar
 
     @Override
     public List<HostVO> listUpAndConnectingSecondaryStorageVmHost(Long dcId) {
-        GenericQueryBuilder<HostVO, HostVO> sc = GenericQueryBuilder.create(HostVO.class);
+        QueryBuilder<HostVO> sc = QueryBuilder.create(HostVO.class);
         if (dcId != null) {
-            sc.addAnd(sc.getEntity().getDataCenterId(), Op.EQ, dcId);
+            sc.and(sc.entity().getDataCenterId(), Op.EQ,dcId);
         }
-        sc.addAnd(sc.getEntity().getState(), Op.IN, com.cloud.host.Status.Up, com.cloud.host.Status.Connecting);
-        sc.addAnd(sc.getEntity().getType(), Op.EQ, Host.Type.SecondaryStorageVM);
+        sc.and(sc.entity().getState(), Op.IN, Status.Up, Status.Connecting);
+        sc.and(sc.entity().getType(), Op.EQ,Host.Type.SecondaryStorageVM);
         return sc.list();
     }
 


Mime
View raw message