Skip to content

Commit bd33cf5

Browse files
committed
some suggestions applied and initial batch size in UI
1 parent 15bda19 commit bd33cf5

File tree

6 files changed

+35
-13
lines changed

6 files changed

+35
-13
lines changed

api/src/main/java/org/apache/cloudstack/api/ApiConstants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public class ApiConstants {
4646
public static final String BACKUP_OFFERING_NAME = "backupofferingname";
4747
public static final String BACKUP_OFFERING_ID = "backupofferingid";
4848
public static final String BASE64_IMAGE = "base64image";
49+
public static final String BATCH_SIZE = "batchsize";
4950
public static final String BITS = "bits";
5051
public static final String BOOTABLE = "bootable";
5152
public static final String BIND_DN = "binddn";

plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,10 @@ public List<ManagedObjectReference> addHostToPodCluster(VmwareContext serviceCon
517517
if (mor.getType().equals("ComputeResource")) {
518518
List<ManagedObjectReference> hosts = serviceContext.getVimClient().getDynamicProperty(mor, "host");
519519
assert (CollectionUtils.isNullOrEmpty(hosts));
520+
// For ESX host, we need to enable host firewall to allow VNC access
521+
HostMO hostMo = new HostMO(serviceContext, hosts.get(0));
522+
523+
prepareHost(hostMo, privateTrafficLabel);
520524
returnedHostList.add(hosts.get(0));
521525
return returnedHostList;
522526
} else if (mor.getType().equals("ClusterComputeResource")) {

plugins/hypervisors/vmware/src/main/java/org/apache/cloudstack/api/command/admin/zone/ListVmwareDcVmsCmd.java

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,14 @@ public class ListVmwareDcVmsCmd extends BaseListCmd {
7070
@Parameter(name = ApiConstants.PASSWORD, type = CommandType.STRING, description = "The password for specified username.")
7171
private String password;
7272

73-
@Parameter(name = ApiConstants.PAGE_SIZE, type = CommandType.INTEGER, description = "The maximum number of results to return.")
74-
private Integer pageSize;
73+
@Parameter(name = ApiConstants.BATCH_SIZE, type = CommandType.INTEGER, description = "The maximum number of results to return.")
74+
private Integer batchSize;
7575

7676
@Parameter(name = ApiConstants.TOKEN, type = CommandType.STRING,
7777
description = "For listVmwareDcVms, if the maximum number of results (the `pagesize`) is exceeded, " +
7878
" a token is returned. This token can be used in subsequent calls to retrieve more results")
7979
private String token;
8080

81-
@Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, description = "force retrieving new results, ignoring any cached data.")
82-
private Boolean forced;
83-
8481
public String getVcenter() {
8582
return vcenter;
8683
}
@@ -93,6 +90,10 @@ public String getPassword() {
9390
return password;
9491
}
9592

93+
public Integer getBatchSize() {
94+
return batchSize;
95+
}
96+
9697
public String getToken() {
9798
return token;
9899
}
@@ -122,7 +123,7 @@ public void execute() throws ResourceUnavailableException, InsufficientCapacityE
122123
if (CollectionUtils.isEmpty(pagingList)) {
123124
pagingList = baseResponseList;
124125
}
125-
VmwarRequestReponse<BaseResponse> response = new VmwarRequestReponse<>();
126+
VmwareRequestReponse<BaseResponse> response = new VmwareRequestReponse<>();
126127
response.setResponses(pagingList, baseResponseList.size());
127128
response.setResponseName(getCommandName());
128129
response.setToken(results.first());
@@ -148,9 +149,4 @@ private void checkParameters() {
148149
public long getEntityOwnerId() {
149150
return Account.ACCOUNT_ID_SYSTEM;
150151
}
151-
152-
@Override
153-
public String getCommandName() {
154-
return "listvmwaredcvmsresponse";
155-
}
156152
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import org.apache.cloudstack.api.ResponseObject;
2121
import org.apache.cloudstack.api.response.ListResponse;
2222

23-
public class VmwarRequestReponse <T extends ResponseObject> extends ListResponse<T> {
23+
public class VmwareRequestReponse<T extends ResponseObject> extends ListResponse<T> {
2424
private transient String token;
2525

2626
public String getToken() {

ui/src/views/tools/ManageInstances.vue

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1408,11 +1408,31 @@ export default {
14081408
})
14091409
}
14101410
},
1411+
async fetchMoreVms (obj) {
1412+
var params = obj.params
1413+
params.token = obj.response.token
1414+
api('listVmwareDcVms', params).then(json => {
1415+
const obj = {
1416+
params: params,
1417+
response: json.listvmwaredcvmsresponse
1418+
}
1419+
this.unmanagedInstances.append(obj.response.unmanagedinstance)
1420+
this.checkForMoreVms(obj)
1421+
})
1422+
},
14111423
onListUnmanagedInstancesFromVmware (obj) {
14121424
this.selectedVmwareVcenter = obj.params
14131425
this.unmanagedInstances = obj.response.unmanagedinstance
14141426
this.itemCount.unmanaged = obj.response.count
1415-
this.unmanagedInstancesLoading = false
1427+
this.checkForMoreVms(obj)
1428+
},
1429+
checkForMoreVms (obj) {
1430+
if (obj.response.token) {
1431+
this.fetchMoreVms(obj)
1432+
// keep loading, for now this means the API called was api('listVmwareDcVms', params)
1433+
} else {
1434+
this.unmanagedInstancesLoading = false
1435+
}
14161436
},
14171437
updateVmwareVcenterType (type) {
14181438
this.vmwareVcenterType = type

ui/src/views/tools/SelectVmwareVcenter.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ export default {
217217
} else {
218218
params.existingvcenterid = this.selectedExistingVcenterId
219219
}
220+
params.batchsize = 2
220221
api('listVmwareDcVms', params).then(json => {
221222
const obj = {
222223
params: params,

0 commit comments

Comments
 (0)