You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ko...@apache.org on 2013/11/26 10:10:06 UTC

git commit: updated refs/heads/master to ef40e15

Updated Branches:
  refs/heads/master 58fd6f060 -> ef40e156e


CLOUDSTACK-5162 Usage details are not getting populated when using dynamic offerings.

Signed-off-by: Koushik Das <ko...@apache.org>


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

Branch: refs/heads/master
Commit: ef40e156ed376968fa9fd15078034d54b97deecc
Parents: 58fd6f0
Author: Bharat Kumar <bh...@citrix.com>
Authored: Tue Nov 26 14:09:55 2013 +0530
Committer: Koushik Das <ko...@apache.org>
Committed: Tue Nov 26 14:32:30 2013 +0530

----------------------------------------------------------------------
 .../schema/src/com/cloud/service/ServiceOfferingVO.java   | 10 +++++++++-
 server/src/com/cloud/vm/UserVmManagerImpl.java            |  1 +
 2 files changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ef40e156/engine/schema/src/com/cloud/service/ServiceOfferingVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/service/ServiceOfferingVO.java b/engine/schema/src/com/cloud/service/ServiceOfferingVO.java
index 67fea00..d968de5 100755
--- a/engine/schema/src/com/cloud/service/ServiceOfferingVO.java
+++ b/engine/schema/src/com/cloud/service/ServiceOfferingVO.java
@@ -83,6 +83,11 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
     @Transient
     Map<String, String> details;
 
+    // This flag is required to tell if the offering is dynamic once the cpu, memory and speed are set.
+    // In some cases cpu, memory and speed are set to non-null values even if the offering is dynamic.
+    @Transient
+    boolean isDynamic;
+
     protected ServiceOfferingVO() {
         super();
     }
@@ -297,7 +302,10 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
 
     @Override
     public boolean isDynamic() {
-        return cpu == null || speed == null || ramSize == null;
+        return cpu == null || speed == null || ramSize == null || isDynamic;
     }
 
+    public void setDynamicFlag(boolean isdynamic) {
+        this.isDynamic = isdynamic;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ef40e156/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 00d8063..9343043 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -2593,6 +2593,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
             details.add(new UserVmDetailVO(id, ServiceOfferingVO.DynamicParameters.cpuSpeed.toString(), cpuSpeed.toString()));
             details.add(new UserVmDetailVO(id, ServiceOfferingVO.DynamicParameters.memory.toString(), memory.toString()));
             offering = _serviceOfferingDao.getcomputeOffering(serviceOffering.getId(), cpuNumber, cpuSpeed, memory);
+            offering.setDynamicFlag(true);
         }
         if (hostName != null) {
             // Check is hostName is RFC compliant