mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-9950:listUsageRecords doesnt return required fields (#2137)
There is no cpuspeed, cpunumber or memory details in the listUsageRecords output as documented In DB (cloud_usage table) we have cpu_speed, cpu_cores and ram fileds, but these are not populated for all the VM's. These fields are only populated for the VM's which are deployed with custom service offerings.
This commit is contained in:
parent
43ae8e3503
commit
b936feb108
@ -3249,9 +3249,21 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||
//Hypervisor Type
|
||||
usageRecResponse.setType(usageRecord.getType());
|
||||
//Dynamic compute offerings details
|
||||
usageRecResponse.setCpuNumber(usageRecord.getCpuCores());
|
||||
usageRecResponse.setCpuSpeed(usageRecord.getCpuSpeed());
|
||||
usageRecResponse.setMemory(usageRecord.getMemory());
|
||||
if(usageRecord.getCpuCores() != null) {
|
||||
usageRecResponse.setCpuNumber(usageRecord.getCpuCores());
|
||||
} else if (svcOffering.getCpu() != null){
|
||||
usageRecResponse.setCpuNumber(svcOffering.getCpu().longValue());
|
||||
}
|
||||
if(usageRecord.getCpuSpeed() != null) {
|
||||
usageRecResponse.setCpuSpeed(usageRecord.getCpuSpeed());
|
||||
} else if(svcOffering.getSpeed() != null){
|
||||
usageRecResponse.setCpuSpeed(svcOffering.getSpeed().longValue());
|
||||
}
|
||||
if(usageRecord.getMemory() != null) {
|
||||
usageRecResponse.setMemory(usageRecord.getMemory());
|
||||
} else if(svcOffering.getRamSize() != null) {
|
||||
usageRecResponse.setMemory(svcOffering.getRamSize().longValue());
|
||||
}
|
||||
|
||||
} else if (usageRecord.getUsageType() == UsageTypes.IP_ADDRESS) {
|
||||
//isSourceNAT
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user