DaanHoogland commented on code in PR #10647:
URL: https://github.com/apache/cloudstack/pull/10647#discussion_r2046940902
##########
plugins/hypervisors/vmware/src/main/java/org/apache/cloudstack/api/command/admin/zone/ListVmwareDcsCmd.java:
##########
@@ -74,40 +75,35 @@ public Long getZoneId() {
@Override
public void execute() throws ResourceUnavailableException,
InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
ResourceAllocationException {
- List<? extends VmwareDatacenter> vmwareDcList;
+ List<? extends VmwareDatacenter> vmwareDcList = null;
try {
vmwareDcList =
_vmwareDatacenterService.listVmwareDatacenters(this);
} catch (InvalidParameterValueException ie) {
throw new InvalidParameterValueException("Invalid zone id " +
getZoneId());
} catch (Exception e) {
- throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed
to find associated Vmware DCs associated with zone " + getZoneId());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed
to find associated VMware DCs associated with zone " + getZoneId());
}
- ListResponse<VmwareDatacenterResponse> response = new ListResponse<>();
- List<VmwareDatacenterResponse> vmwareDcResponses =
getVmwareDatacenterResponses(vmwareDcList);
- response.setResponses(vmwareDcResponses);
- response.setResponseName(getCommandName());
- setResponseObject(response);
- }
+ ListResponse<VmwareDatacenterResponse> response = new
ListResponse<VmwareDatacenterResponse>();
+ List<VmwareDatacenterResponse> vmwareDcResponses = new
ArrayList<VmwareDatacenterResponse>();
- private List<VmwareDatacenterResponse> getVmwareDatacenterResponses(List<?
extends VmwareDatacenter> vmwareDcList) {
- List<VmwareDatacenterResponse> vmwareDcResponses = new ArrayList<>();
-
- if (vmwareDcList != null && !vmwareDcList.isEmpty()) {
+ if (vmwareDcList != null && vmwareDcList.size() > 0) {
for (VmwareDatacenter vmwareDc : vmwareDcList) {
VmwareDatacenterResponse vmwareDcResponse = new
VmwareDatacenterResponse();
vmwareDcResponse.setId(vmwareDc.getUuid());
vmwareDcResponse.setVcenter(vmwareDc.getVcenterHost());
vmwareDcResponse.setName(vmwareDc.getVmwareDatacenterName());
vmwareDcResponse.setZoneId(getZoneId());
- vmwareDcResponse.setObjectName(ApiConstants.VMWARE_DC);
+ vmwareDcResponse.setObjectName("VMwareDC");
Review Comment:
I agree @sureshanaparti , but this is a revert I can remove this part but
than we need to add the code for
https://github.com/apache/cloudstack/pull/10731/files
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]