mirror of https://github.com/apache/cloudstack.git
api: Set network name as part of the network usage response (#3234)
Problem: Network name is not part of the network usage response Root Cause: Code does not set the network name Solution: Set the network name for network usage type usage records in the API response Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
parent
c2812b4675
commit
61ebc6a4a6
|
|
@ -77,8 +77,8 @@ public class UsageRecordResponse extends BaseResponseWithTagInformation implemen
|
|||
private String virtualMachineId;
|
||||
|
||||
@SerializedName(ApiConstants.NAME)
|
||||
@Param(description = "virtual machine name")
|
||||
private String vmName;
|
||||
@Param(description = "resource or virtual machine name")
|
||||
private String resourceName;
|
||||
|
||||
@SerializedName("offeringid")
|
||||
@Param(description = "offering ID")
|
||||
|
|
@ -186,8 +186,8 @@ public class UsageRecordResponse extends BaseResponseWithTagInformation implemen
|
|||
this.virtualMachineId = virtualMachineId;
|
||||
}
|
||||
|
||||
public void setVmName(String vmName) {
|
||||
this.vmName = vmName;
|
||||
public void setResourceName(String name) {
|
||||
this.resourceName = name;
|
||||
}
|
||||
|
||||
public void setOfferingId(String offeringId) {
|
||||
|
|
|
|||
|
|
@ -3332,7 +3332,7 @@ public class ApiResponseHelper implements ResponseGenerator {
|
|||
usageRecResponse.setVirtualMachineId(vm.getUuid());
|
||||
}
|
||||
}
|
||||
usageRecResponse.setVmName(usageRecord.getVmName());
|
||||
usageRecResponse.setResourceName(usageRecord.getVmName());
|
||||
if (usageRecord.getTemplateId() != null) {
|
||||
VMTemplateVO template = ApiDBUtils.findTemplateById(usageRecord.getTemplateId());
|
||||
if (template != null) {
|
||||
|
|
@ -3420,6 +3420,7 @@ public class ApiResponseHelper implements ResponseGenerator {
|
|||
resourceType = ResourceObjectType.Network;
|
||||
resourceId = network.getId();
|
||||
usageRecResponse.setNetworkId(network.getUuid());
|
||||
usageRecResponse.setResourceName(network.getName());
|
||||
}
|
||||
}
|
||||
} else if (usageRecord.getUsageType() == UsageTypes.VM_DISK_IO_READ || usageRecord.getUsageType() == UsageTypes.VM_DISK_IO_WRITE
|
||||
|
|
@ -3526,7 +3527,7 @@ public class ApiResponseHelper implements ResponseGenerator {
|
|||
resourceType = ResourceObjectType.UserVm;
|
||||
if (vm != null) {
|
||||
resourceId = vm.getId();
|
||||
usageRecResponse.setVmName(vm.getInstanceName());
|
||||
usageRecResponse.setResourceName(vm.getInstanceName());
|
||||
usageRecResponse.setUsageId(vm.getUuid());
|
||||
}
|
||||
usageRecResponse.setSize(usageRecord.getSize());
|
||||
|
|
|
|||
Loading…
Reference in New Issue