cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [cloudstack] branch 4.9 updated: Revert "CLOUDSTACK-9708: Router deployment failed due to two threads start VR simultaneously." (#2220)
Date Fri, 04 Aug 2017 08:57:57 GMT
This is an automated email from the ASF dual-hosted git repository.

bhaisaab pushed a commit to branch 4.9
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.9 by this push:
     new f4a138d  Revert "CLOUDSTACK-9708: Router deployment failed due to two threads start
VR simultaneously." (#2220)
f4a138d is described below

commit f4a138d251e4d0bccb79ee7bdd626aaa35563118
Author: Rohit Yadav <bhaisaab@apache.org>
AuthorDate: Fri Aug 4 10:57:54 2017 +0200

    Revert "CLOUDSTACK-9708: Router deployment failed due to two threads start VR simultaneously."
(#2220)
    
    This reverts commit 42e60ebac6f067e003598447ef75d914b7916734 / 9e20525e08d8dae7bcf3d568c5a1ccdb793eeb9d.
---
 .../schema/src/com/cloud/vm/dao/UserVmDaoImpl.java | 28 ++++++++++++----------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/engine/schema/src/com/cloud/vm/dao/UserVmDaoImpl.java b/engine/schema/src/com/cloud/vm/dao/UserVmDaoImpl.java
index 92f7e4e..b1ff706 100644
--- a/engine/schema/src/com/cloud/vm/dao/UserVmDaoImpl.java
+++ b/engine/schema/src/com/cloud/vm/dao/UserVmDaoImpl.java
@@ -192,18 +192,6 @@ public class UserVmDaoImpl extends GenericDaoBase<UserVmVO, Long>
implements Use
                 JoinBuilder.JoinType.INNER);
         AccountDataCenterVirtualSearch.done();
 
-        SearchBuilder<NicVO> nicSearchByNetwork = _nicDao.createSearchBuilder();
-        nicSearchByNetwork.and("networkId", nicSearchByNetwork.entity().getNetworkId(), SearchCriteria.Op.EQ);
-        nicSearchByNetwork.and("removed", nicSearchByNetwork.entity().getRemoved(), SearchCriteria.Op.NULL);
-        nicSearchByNetwork.and().op("ip4Address", nicSearchByNetwork.entity().getIPv4Address(),
SearchCriteria.Op.NNULL);
-        nicSearchByNetwork.or("ip6Address", nicSearchByNetwork.entity().getIPv6Address(),
SearchCriteria.Op.NNULL);
-        nicSearchByNetwork.cp();
-
-        UserVmSearch = createSearchBuilder();
-        UserVmSearch.and("states", UserVmSearch.entity().getState(), SearchCriteria.Op.IN);
-        UserVmSearch.join("nicSearchByNetwork", nicSearchByNetwork, UserVmSearch.entity().getId(),
nicSearchByNetwork.entity().getInstanceId(), JoinBuilder.JoinType.INNER);
-        UserVmSearch.done();
-
         UserVmByIsoSearch = createSearchBuilder();
         UserVmByIsoSearch.and("isoId", UserVmByIsoSearch.entity().getIsoId(), SearchCriteria.Op.EQ);
         UserVmByIsoSearch.done();
@@ -313,11 +301,25 @@ public class UserVmDaoImpl extends GenericDaoBase<UserVmVO, Long>
implements Use
 
     @Override
     public List<UserVmVO> listByNetworkIdAndStates(long networkId, State... states)
{
+        if (UserVmSearch == null) {
+            SearchBuilder<NicVO> nicSearch = _nicDao.createSearchBuilder();
+            nicSearch.and("networkId", nicSearch.entity().getNetworkId(), SearchCriteria.Op.EQ);
+            nicSearch.and("removed", nicSearch.entity().getRemoved(), SearchCriteria.Op.NULL);
+            nicSearch.and().op("ip4Address", nicSearch.entity().getIPv4Address(), SearchCriteria.Op.NNULL);
+            nicSearch.or("ip6Address", nicSearch.entity().getIPv6Address(), SearchCriteria.Op.NNULL);
+            nicSearch.cp();
+
+            UserVmSearch = createSearchBuilder();
+            UserVmSearch.and("states", UserVmSearch.entity().getState(), SearchCriteria.Op.IN);
+            UserVmSearch.join("nicSearch", nicSearch, UserVmSearch.entity().getId(), nicSearch.entity().getInstanceId(),
JoinBuilder.JoinType.INNER);
+            UserVmSearch.done();
+        }
+
         SearchCriteria<UserVmVO> sc = UserVmSearch.create();
         if (states != null && states.length != 0) {
             sc.setParameters("states", (Object[])states);
         }
-        sc.setJoinParameters("nicSearchByNetwork", "networkId", networkId);
+        sc.setJoinParameters("nicSearch", "networkId", networkId);
 
         return listBy(sc);
     }

-- 
To stop receiving notification emails like this one, please contact
['"commits@cloudstack.apache.org" <commits@cloudstack.apache.org>'].

Mime
View raw message