Skip to content

Commit aa151c2

Browse files
committed
fix UI and cleanup
1 parent f0f90dd commit aa151c2

File tree

5 files changed

+11
-51
lines changed

5 files changed

+11
-51
lines changed

api/src/main/java/org/apache/cloudstack/api/response/HostResponse.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public class HostResponse extends BaseResponseWithAnnotations {
152152
@Deprecated
153153
@SerializedName("memoryallocated")
154154
@Param(description = "the amount of the host's memory currently allocated")
155-
private long memoryAllocated;
155+
private Long memoryAllocated;
156156

157157
@SerializedName("memoryallocatedpercentage")
158158
@Param(description = "the amount of the host's memory currently allocated in percentage")
@@ -395,7 +395,7 @@ public void setMemWithOverprovisioning(String memWithOverprovisioning){
395395
this.memWithOverprovisioning=memWithOverprovisioning;
396396
}
397397

398-
public void setMemoryAllocated(long memoryAllocated) {
398+
public void setMemoryAllocated(Long memoryAllocated) {
399399
this.memoryAllocated = memoryAllocated;
400400
}
401401

@@ -659,8 +659,8 @@ public Long getMemoryTotal() {
659659
return memoryTotal;
660660
}
661661

662-
public long getMemoryAllocated() {
663-
return memoryAllocated;
662+
public Long getMemoryAllocated() {
663+
return memoryAllocated == null ? 0 : memoryAllocated;
664664
}
665665

666666
public void setMemoryAllocatedPercentage(String memoryAllocatedPercentage) {

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1567,9 +1567,6 @@ public List<StoragePool> listVsphereStoragePolicyCompatibleStoragePools(ListVsph
15671567

15681568
@Override
15691569
public List<HostMO> listHostsInDatacenter(ListVmwareDcHostsCmd cmd) {
1570-
Integer maxObjects = cmd.getBatchSize();
1571-
String token = cmd.getToken();
1572-
15731570
VcenterData vmwaredc = getVcenterData(cmd);
15741571

15751572
try {

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

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,6 @@ public class ListVmwareDcHostsCmd extends BaseCmd implements ListVmwareDcItems {
7575
@Parameter(name = ApiConstants.PASSWORD, type = CommandType.STRING, description = "The password for specified username.")
7676
private String password;
7777

78-
@Parameter(name = ApiConstants.BATCH_SIZE, type = CommandType.INTEGER, description = "The maximum number of results to return.")
79-
private Integer batchSize;
80-
81-
@Parameter(name = ApiConstants.TOKEN, type = CommandType.STRING,
82-
description = "For listVmwareDcVms, if the maximum number of results (the `batchsize`) is exceeded, " +
83-
" a token is returned. This token can be used in subsequent calls to retrieve more results." +
84-
" As long as a token is returned, more results can be retrieved.")
85-
private String token;
86-
8778
public String getVcenter() {
8879
return vcenter;
8980
}
@@ -96,14 +87,6 @@ public String getPassword() {
9687
return password;
9788
}
9889

99-
public Integer getBatchSize() {
100-
return batchSize;
101-
}
102-
103-
public String getToken() {
104-
return token;
105-
}
106-
10790
public String getDatacenterName() {
10891
return datacenterName;
10992
}

ui/src/views/tools/ManageInstances.vue

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,6 +1184,7 @@ export default {
11841184
} else {
11851185
params.existingvcenterid = this.selectedVmwareVcenter.existingvcenterid
11861186
}
1187+
params.host = this.selectedVmwareVcenter.host
11871188
}
11881189
11891190
api(apiName, params).then(json => {
@@ -1408,31 +1409,10 @@ export default {
14081409
})
14091410
}
14101411
},
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-
},
14231412
onListUnmanagedInstancesFromVmware (obj) {
14241413
this.selectedVmwareVcenter = obj.params
14251414
this.unmanagedInstances = obj.response.unmanagedinstance
14261415
this.itemCount.unmanaged = obj.response.count
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-
}
14361416
},
14371417
updateVmwareVcenterType (type) {
14381418
this.vmwareVcenterType = type

ui/src/views/tools/SelectVmwareVcenter.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
</a-form-item>
121121
</div>
122122
<div v-if="selectedExistingVcenterId">
123-
<a-form-item ref="host" name="host" v-if="hosts.length > 0">
123+
<a-form-item :label="$t('label.vcenter.host')" ref="host" name="host" v-if="hosts.length > 0">
124124
<a-select
125125
v-model:value="form.host"
126126
:loading="loading"
@@ -130,8 +130,8 @@
130130
}"
131131
:placeholder="$t('label.vcenter.host')"
132132
@change="onSelectExistingVmwareHost">
133-
<a-select-option v-for="opt in hosts" :key="opt.id">
134-
{{ 'ESXi: ' + opt.host + ' - DC: ' + opt.name }}
133+
<a-select-option v-for="opt in hosts" :key="opt.name">
134+
{{ 'ESXi: ' + opt.name }}
135135
</a-select-option>
136136
</a-select>
137137
</a-form-item>
@@ -239,7 +239,7 @@ export default {
239239
} else {
240240
params.existingvcenterid = this.selectedExistingVcenterId
241241
}
242-
params.host = this.selectedhost
242+
params.host = this.selectedHost
243243
api('listVmwareDcVms', params).then(json => {
244244
const obj = {
245245
params: params,
@@ -290,8 +290,8 @@ export default {
290290
params.existingvcenterid = this.selectedExistingVcenterId
291291
}
292292
api('listVmwareDcHosts', params).then(response => {
293-
if (response.listvmwaredchostsresponse.VMwareDC && response.listvmwaredchostsresponse.VMwareDC.length > 0) {
294-
this.hosts = response.listvmwaredchostsresponse.hosts
293+
if (response.listvmwaredchostsresponse.host && response.listvmwaredchostsresponse.host.length > 0) {
294+
this.hosts = response.listvmwaredchostsresponse.host
295295
}
296296
}).catch(error => {
297297
this.$notifyError(error)

0 commit comments

Comments
 (0)