Skip to content
2 changes: 1 addition & 1 deletion ui/public/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -3006,7 +3006,7 @@
"message.license.agreements.not.accepted": "License agreements not accepted.",
"message.linstor.resourcegroup.description": "Linstor resource group to use for primary storage.",
"message.list.zone.vmware.datacenter.empty": "No VMware Datacenter exists in the selected Zone",
"message.list.zone.vmware.hosts.empty": "No VMware hosts were found in the selected Datacenter",
"message.list.zone.vmware.hosts.empty": "No EXSi hosts were found in the selected Datacenter.\nAre the credentials complete?\n",
"message.listnsp.not.return.providerid": "error: listNetworkServiceProviders API doesn't return VirtualRouter provider ID.",
"message.load.host.failed": "Failed to load hosts.",
"message.loadbalancer.stickypolicy.configuration": "Customize the load balancer stickiness policy:",
Expand Down
32 changes: 22 additions & 10 deletions ui/src/views/tools/SelectVmwareVcenter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@
<a-input
v-model:value="vcenter"
:placeholder="apiParams.vcenter.description"
@change="onSelectExternalVmwareDatacenter"
@blur="onSelectExternalVmwareDatacenter"
@pressEnter="onSelectExternalVmwareDatacenter"
/>
</a-form-item>
<a-form-item ref="datacenter" name="datacenter">
Expand All @@ -99,7 +100,8 @@
<a-input
v-model:value="datacenter"
:placeholder="apiParams.datacentername.description"
@change="onSelectExternalVmwareDatacenter"
@blur="onSelectExternalVmwareDatacenter"
@pressEnter="onSelectExternalVmwareDatacenter"
/>
</a-form-item>
<a-form-item ref="username" name="username">
Expand All @@ -109,32 +111,37 @@
<a-input
v-model:value="username"
:placeholder="apiParams.username.description"
@change="onSelectExternalVmwareDatacenter"
@blur="onSelectExternalVmwareDatacenter"
@pressEnter="onSelectExternalVmwareDatacenter"
/>
</a-form-item>
<a-form-item ref="password" name="password">
<template #label>
<tooltip-label :title="$t('label.vcenter.password')" :tooltip="apiParams.password.description"/>
&nbsp;
<tooltip-label :title="'press enter when done.'"/>
</template>
<a-input-password
v-model:value="password"
:placeholder="apiParams.password.description"
@change="onSelectExternalVmwareDatacenter"
@blur="onSelectExternalVmwareDatacenter"
@pressEnter="onSelectExternalVmwareDatacenter"
/>
</a-form-item>
</div>
<div
v-if="selectedExistingVcenterId || (vcenterSelectedOption === 'new')">
<a-form-item :label="$t('label.vcenter.host')" ref="host" name="host" v-if="hosts.length > 0">
<a-form-item :label="$t('label.esx.host')" ref="host" name="host" v-if="hosts.length > 0">
<a-select
v-model:value="form.host"
:loading="loading"
optionFilterProp="label"
:filterOption="(input, option) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
}"
:placeholder="$t('label.vcenter.host')"
:placeholder="$t('label.esx.host')"
@change="onSelectExistingVmwareHost">
<a-select-option key="" label="">{{ }}</a-select-option>
<a-select-option v-for="opt in hosts" :key="opt.name">
{{ 'ESXi: ' + opt.name }}
</a-select-option>
Expand Down Expand Up @@ -283,7 +290,7 @@ export default {
this.loading = false
})
},
listZoneVmwareDcHosts () {
loadZoneVmwareDcHosts (doNotify) {
this.loading = true
const params = {}
if (this.vcenterSelectedOption === 'new') {
Expand All @@ -299,18 +306,23 @@ export default {
this.hosts = response.listvmwaredchostsresponse.host
}
}).catch(error => {
this.$notifyError(error)
if (doNotify) {
this.$notifyError(error)
}
this.hosts = []
return false
}).finally(() => {
this.loading = false
return true
})
},
onSelectExistingVmwareDatacenter (value) {
this.selectedExistingVcenterId = value
this.listZoneVmwareDcHosts()
this.loadZoneVmwareDcHosts(true)
},
onSelectExternalVmwareDatacenter (value) {
if (this.vcenterSelectedOption === 'new' && !(this.vcenter === '' || this.datacentername === '' || this.username === '' || this.password === '')) {
this.listZoneVmwareDcHosts()
this.loadZoneVmwareDcHosts(false)
}
},
onSelectExistingVmwareHost (value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import com.vmware.vim25.RetrieveResult;

import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;

public class BaseMO {
Expand Down Expand Up @@ -65,6 +66,9 @@
if (s_logger.isDebugEnabled()) {
s_logger.debug("vmware result : " + ReflectionToStringBuilderUtils.reflectCollection(result));
}
if (result == null) {
return new Pair<>(null, new ArrayList<>());

Check warning on line 70 in vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/BaseMO.java

View check run for this annotation

Codecov / codecov/patch

vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/BaseMO.java#L70

Added line #L70 was not covered by tests
}
String tokenForRetrievingNewResults = result.getToken();
List<ObjectContent> listOfObjects = result.getObjects();
return new Pair<>(tokenForRetrievingNewResults, listOfObjects);
Expand Down
Loading