cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From weiz...@apache.org
Subject [2/3] git commit: updated refs/heads/4.1 to 15b03a2
Date Mon, 02 Sep 2013 15:20:30 GMT
CLOUDSTACK-4566: fix incorrect values in resource_count table for resource limitation

There are three issues in resource_count table
(1) expunge a vm, the public_ip decreases and becomes -1 in basic zone.
(2) recover a vm, the volume increase.
(3) restore a vm, the volume decrease.


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

Branch: refs/heads/4.1
Commit: d969769f036c7aa1333e66dc5205566d7312198a
Parents: 6efd2b4
Author: Wei Zhou <w.zhou@leaseweb.com>
Authored: Fri Aug 30 08:51:01 2013 +0200
Committer: Wei Zhou <w.zhou@leaseweb.com>
Committed: Mon Sep 2 17:17:28 2013 +0200

----------------------------------------------------------------------
 server/src/com/cloud/network/NetworkManagerImpl.java | 2 +-
 server/src/com/cloud/vm/UserVmManagerImpl.java       | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d969769f/server/src/com/cloud/network/NetworkManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java
index 3dbfd0d..56cad34 100755
--- a/server/src/com/cloud/network/NetworkManagerImpl.java
+++ b/server/src/com/cloud/network/NetworkManagerImpl.java
@@ -368,7 +368,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager,
L
         }
         addr.setState(assign ? IpAddress.State.Allocated : IpAddress.State.Allocating);
 
-        if (vlanUse != VlanType.DirectAttached || zone.getNetworkType() == NetworkType.Basic)
{
+        if (vlanUse != VlanType.DirectAttached) {
             addr.setAssociatedWithNetworkId(guestNetworkId);
             addr.setVpcId(vpcId);
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d969769f/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java
index 87f0c0f..48195ad 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -1672,9 +1672,6 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager,
Use
         }
 
         _resourceLimitMgr.incrementResourceCount(account.getId(),
-                ResourceType.volume, new Long(volumes.size()));
-
-        _resourceLimitMgr.incrementResourceCount(account.getId(),
                 ResourceType.user_vm);
 
         txn.commit();
@@ -4822,6 +4819,10 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager,
Use
                 throw ex;
             }
         }
+        // Save usage event and update resource count for user vm volumes
+        if (vm instanceof UserVm) {
+            _resourceLimitMgr.incrementResourceCount(vm.getAccountId(), ResourceType.volume);
+        }
 
         s_logger.debug("Restore VM " + vmId + " with template "
                 + root.getTemplateId() + " successfully");


Mime
View raw message