cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahu...@apache.org
Subject git commit: updated refs/heads/master to ab37009
Date Sat, 21 Dec 2013 01:28:44 GMT
Updated Branches:
  refs/heads/master c2baed665 -> ab37009e9


Revert "CLOUDSTACK-5281:"

This reverts commit 6b62a04eaf1196ebcce5e81c29c9e0f59dd4f858.


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

Branch: refs/heads/master
Commit: ab37009e9015e90f39f001dbc7023ce52319dcff
Parents: c2baed6
Author: Alex Huang <alex.huang@citrix.com>
Authored: Fri Dec 20 17:23:33 2013 -0800
Committer: Alex Huang <alex.huang@citrix.com>
Committed: Fri Dec 20 17:23:33 2013 -0800

----------------------------------------------------------------------
 .../service/NetworkOrchestrationService.java             |  2 --
 .../engine/orchestration/NetworkOrchestrator.java        |  9 ++++-----
 .../schema/src/com/cloud/network/dao/NetworkDaoImpl.java |  2 --
 server/src/com/cloud/network/NetworkServiceImpl.java     | 11 +----------
 4 files changed, 5 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ab37009e/engine/api/src/org/apache/cloudstack/engine/orchestration/service/NetworkOrchestrationService.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/engine/orchestration/service/NetworkOrchestrationService.java
b/engine/api/src/org/apache/cloudstack/engine/orchestration/service/NetworkOrchestrationService.java
index 8ed50cd..fc196e2 100755
--- a/engine/api/src/org/apache/cloudstack/engine/orchestration/service/NetworkOrchestrationService.java
+++ b/engine/api/src/org/apache/cloudstack/engine/orchestration/service/NetworkOrchestrationService.java
@@ -215,6 +215,4 @@ public interface NetworkOrchestrationService {
     DhcpServiceProvider getDhcpServiceProvider(Network network);
 
     void removeDhcpServiceInSubnet(Nic nic);
-
-    boolean resourceCountNeedsUpdate(NetworkOffering ntwkOff, ACLType aclType);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ab37009e/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
index b3c4854..1505d41 100755
--- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
@@ -1650,7 +1650,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
         final boolean updateResourceCount = resourceCountNeedsUpdate(ntwkOff, aclType);
         //check resource limits
         if (updateResourceCount) {
-            _resourceLimitMgr.checkResourceLimit(owner, ResourceType.network, isDisplayNetworkEnabled);
+            _resourceLimitMgr.checkResourceLimit(owner, ResourceType.network);
         }
 
         // Validate network offering
@@ -1928,7 +1928,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
                 }
 
                 if (updateResourceCount) {
-                    _resourceLimitMgr.incrementResourceCount(owner.getId(), ResourceType.network,
isDisplayNetworkEnabled);
+                    _resourceLimitMgr.incrementResourceCount(owner.getId(), ResourceType.network);
                 }
 
                 return network;
@@ -2217,7 +2217,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
                             NetworkOffering ntwkOff = _entityMgr.findById(NetworkOffering.class,
networkFinal.getNetworkOfferingId());
                             boolean updateResourceCount = resourceCountNeedsUpdate(ntwkOff,
networkFinal.getAclType());
                             if (updateResourceCount) {
-                                _resourceLimitMgr.decrementResourceCount(networkFinal.getAccountId(),
ResourceType.network, networkFinal.getDisplayNetwork());
+                                _resourceLimitMgr.decrementResourceCount(networkFinal.getAccountId(),
ResourceType.network);
                             }
                         }
                     }
@@ -2232,8 +2232,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
         return success;
     }
 
-    @Override
-    public boolean resourceCountNeedsUpdate(NetworkOffering ntwkOff, ACLType aclType) {
+    private boolean resourceCountNeedsUpdate(NetworkOffering ntwkOff, ACLType aclType) {
         //Update resource count only for Isolated account specific non-system networks
         boolean updateResourceCount = (ntwkOff.getGuestType() == GuestType.Isolated &&
!ntwkOff.isSystemOnly() && aclType == ACLType.Account);
         return updateResourceCount;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ab37009e/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..13fb64e 100644
--- a/engine/schema/src/com/cloud/network/dao/NetworkDaoImpl.java
+++ b/engine/schema/src/com/cloud/network/dao/NetworkDaoImpl.java
@@ -195,7 +195,6 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long>
implements N
 
         NetworksRegularUserCanCreateSearch = createSearchBuilder(Long.class);
         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();
         join4.and("account", join4.entity().getAccountId(), Op.EQ);
@@ -550,7 +549,6 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long>
implements N
     public long countNetworksUserCanCreate(long ownerId) {
         SearchCriteria<Long> sc = NetworksRegularUserCanCreateSearch.create();
         sc.setParameters("aclType", ACLType.Account);
-        sc.setParameters("displayNetwork", 1);
         sc.setJoinParameters("accounts", "account", ownerId);
         sc.setJoinParameters("ntwkOff", "specifyVlan", false);
         return customSearch(sc, null).get(0);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ab37009e/server/src/com/cloud/network/NetworkServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkServiceImpl.java b/server/src/com/cloud/network/NetworkServiceImpl.java
index 39f3ff3..0e3aae9 100755
--- a/server/src/com/cloud/network/NetworkServiceImpl.java
+++ b/server/src/com/cloud/network/NetworkServiceImpl.java
@@ -41,7 +41,6 @@ import javax.ejb.Local;
 import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
-import com.cloud.configuration.Resource;
 import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.acl.ControlledEntity.ACLType;
@@ -1999,18 +1998,10 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService
{
             network.setDisplayText(displayText);
         }
 
-        // display flag is not null and has changed
-        if (displayNetwork != null && displayNetwork != network.getDisplayNetwork())
{
+        if (displayNetwork != null) {
             if (!_accountMgr.isRootAdmin(callerAccount.getType())) {
                 throw new PermissionDeniedException("Only admin allowed to update displaynetwork
parameter");
             }
-
-            // Update resource count if it needs to be updated
-            NetworkOffering networkOffering = _networkOfferingDao.findById(network.getNetworkOfferingId());
-            if(_networkMgr.resourceCountNeedsUpdate(networkOffering,network.getAclType())){
-                _resourceLimitMgr.changeResourceCount(network.getAccountId(), Resource.ResourceType.network,
displayNetwork);
-            }
-
             network.setDisplayNetwork(displayNetwork);
         }
 


Mime
View raw message