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

Signed-off-by: Koushik Das <koushik@apache.org>
This commit is contained in:
Bharat Kumar 2013-11-26 14:09:55 +05:30 committed by Koushik Das
parent 58fd6f0603
commit ef40e156ed
2 changed files with 10 additions and 1 deletions

View File

@ -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;
}
}

View File

@ -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