Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A4207104A9 for ; Fri, 20 Sep 2013 00:20:20 +0000 (UTC) Received: (qmail 51185 invoked by uid 500); 20 Sep 2013 00:20:20 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 51171 invoked by uid 500); 20 Sep 2013 00:20:20 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 51164 invoked by uid 99); 20 Sep 2013 00:20:20 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 20 Sep 2013 00:20:20 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id E123C8A3624; Fri, 20 Sep 2013 00:20:18 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: alena1108@apache.org To: commits@cloudstack.apache.org Message-Id: <19083c4535c5458bb059dee129dd0306@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: updated refs/heads/master to 94e744f Date: Fri, 20 Sep 2013 00:20:18 +0000 (UTC) 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 Authored: Thu Sep 19 17:10:10 2013 -0700 Committer: Alena Prokharchyk 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) {