You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by an...@apache.org on 2013/11/14 03:24:52 UTC

git commit: updated refs/heads/4.2 to fcb806a

Updated Branches:
  refs/heads/4.2 ba9b041fe -> fcb806a6a


fixed NPE


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

Branch: refs/heads/4.2
Commit: fcb806a6abb6c5d92a4017741ade40634c81239a
Parents: ba9b041
Author: Anthony Xu <an...@citrix.com>
Authored: Wed Nov 13 18:24:32 2013 -0800
Committer: Anthony Xu <an...@citrix.com>
Committed: Wed Nov 13 18:24:32 2013 -0800

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fcb806a6/server/src/com/cloud/capacity/CapacityManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/capacity/CapacityManagerImpl.java b/server/src/com/cloud/capacity/CapacityManagerImpl.java
index 3cd07d0..779c0ef 100755
--- a/server/src/com/cloud/capacity/CapacityManagerImpl.java
+++ b/server/src/com/cloud/capacity/CapacityManagerImpl.java
@@ -593,11 +593,11 @@ public class CapacityManagerImpl extends ManagerBase implements CapacityManager,
 
         CapacityVO cpuCap = _capacityDao.findByHostIdType(host.getId(), CapacityVO.CAPACITY_TYPE_CPU);
         CapacityVO memCap = _capacityDao.findByHostIdType(host.getId(), CapacityVO.CAPACITY_TYPE_MEMORY);
-        if ( host.getTotalMemory() != null ) {
-            memCap.setTotalCapacity(host.getTotalMemory());
-        }
-        if (cpuCap != null && memCap != null){
 
+        if (cpuCap != null && memCap != null){
+            if ( host.getTotalMemory() != null ) {
+                memCap.setTotalCapacity(host.getTotalMemory());
+            }
             long hostTotalCpu = host.getCpus().longValue() * host.getSpeed().longValue();
 
             if (cpuCap.getTotalCapacity() != hostTotalCpu) {