cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alena1...@apache.org
Subject git commit: updated refs/heads/master to 94e744f
Date Fri, 20 Sep 2013 00:20:18 GMT
Updated Branches:
  refs/heads/master 5c74fb3ed -> 94e744fe0


CLOUDSTACK-4573: fixed decrement resource count for VPC networks


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

Branch: refs/heads/master
Commit: 94e744fe0c41892792093707bd36120bb49f6cc9
Parents: 5c74fb3
Author: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Authored: Thu Sep 19 17:10:10 2013 -0700
Committer: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Committed: Thu Sep 19 17:20:22 2013 -0700

----------------------------------------------------------------------
 server/src/com/cloud/network/IpAddressManagerImpl.java | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/94e744fe/server/src/com/cloud/network/IpAddressManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/IpAddressManagerImpl.java b/server/src/com/cloud/network/IpAddressManagerImpl.java
index 805821e..9cc5e5d 100644
--- a/server/src/com/cloud/network/IpAddressManagerImpl.java
+++ b/server/src/com/cloud/network/IpAddressManagerImpl.java
@@ -819,8 +819,8 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
                     addr.getClass().getName(),
                     addr.getUuid());
             }
-            // don't increment resource count for direct and dedicated ip addresses
-            if ((addr.getAssociatedWithNetworkId() != null || addr.getVpcId() != null) &&
!isIpDedicated(addr)) {
+
+            if (updateIpResourceCount(addr)) {
                 _resourceLimitMgr.incrementResourceCount(owner.getId(), ResourceType.public_ip);
             }
         }
@@ -1604,8 +1604,7 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
         if (ip.getState() != State.Releasing) {
             txn.start();
 
-            // don't decrement resource count for direct and dedicated ips
-            if (ip.getAssociatedWithNetworkId() != null && !isIpDedicated(ip)) {
+            if (updateIpResourceCount(ip)) {
                 _resourceLimitMgr.decrementResourceCount(_ipAddressDao.findById(addrId).getAllocatedToAccountId(),
ResourceType.public_ip);
             }
 
@@ -1637,6 +1636,11 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
         return ip;
     }
 
+    protected boolean updateIpResourceCount(IPAddressVO ip) {
+        // don't increment resource count for direct and dedicated ip addresses
+        return (ip.getAssociatedWithNetworkId() != null || ip.getVpcId() != null) &&
!isIpDedicated(ip);
+    }
+
     @Override
     @DB
     public String acquireGuestIpAddress(Network network, String requestedIp) {


Mime
View raw message