Skip to content

Commit b4acbc3

Browse files
Add default flag for usevddk based on hosts vddk support
1 parent 50e4ebc commit b4acbc3

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

ui/src/views/tools/ImportUnmanagedInstance.vue

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@
176176
@handle-checkselectpair-change="updateSelectedKvmHostForConversion"
177177
/>
178178
</a-form-item>
179-
<a-form-item name="importhostid" ref="importhostid">
179+
<a-form-item name="importhostid" ref="importhostid" v-if="!form.usevddk">
180180
<check-box-select-pair
181181
layout="vertical"
182182
v-if="cluster.hypervisortype === 'KVM' && selectedVmwareVcenter"
@@ -587,7 +587,8 @@ export default {
587587
selectedRootDiskSources: [],
588588
vmwareToKvmExtraParamsAllowed: false,
589589
vmwareToKvmExtraParamsSelected: false,
590-
vmwareToKvmExtraParams: ''
590+
vmwareToKvmExtraParams: '',
591+
userModifiedVddkSetting: false
591592
}
592593
},
593594
beforeCreate () {
@@ -1018,6 +1019,8 @@ export default {
10181019
}).then(json => {
10191020
this.kvmHostsForConversion = json.listhostsresponse.host || []
10201021
this.kvmHostsForConversion = this.kvmHostsForConversion.filter(host => ['Enabled', 'Disabled'].includes(host.resourcestate))
1022+
// Check if any host has VDDK support
1023+
let hasVddkSupport = false
10211024
this.kvmHostsForConversion.map(host => {
10221025
host.name = host.name + ' [Pod=' + host.podname + '] [Cluster=' + host.clustername + ']'
10231026
if (host.instanceconversionsupported !== null && host.instanceconversionsupported !== undefined && host.instanceconversionsupported) {
@@ -1031,6 +1034,11 @@ export default {
10311034
if (host.details['host.ovftool.version']) {
10321035
host.name = host.name + ' (ovftool=' + host.details['host.ovftool.version'] + ')'
10331036
}
1037+
// Check for VDDK support
1038+
if (host.details['host.vddk.support'] === 'true' || host.details['host.vddk.support'] === true) {
1039+
hasVddkSupport = true
1040+
}
1041+
10341042
if (this.form.usevddk) {
10351043
if (host.details['host.vddk.support'] === 'true' || host.details['host.vddk.support'] === true) {
10361044
host.name = host.name + ' (VDDK=' + this.$t('label.supported') + ')'
@@ -1042,6 +1050,13 @@ export default {
10421050
}
10431051
}
10441052
})
1053+
1054+
// Enable usevddk by default if at least one host has VDDK support
1055+
// Only auto-enable if user hasn't manually modified the setting
1056+
if (hasVddkSupport && !this.form.usevddk && !this.userModifiedVddkSetting) {
1057+
this.form.usevddk = true
1058+
this.onUseVddkChange(true, false)
1059+
}
10451060
})
10461061
},
10471062
fetchKvmHostsForImporting () {
@@ -1134,12 +1149,17 @@ export default {
11341149
this.switches.forceConvertToPool = val
11351150
this.resetStorageOptionsForConversion()
11361151
},
1137-
onUseVddkChange (val) {
1152+
onUseVddkChange (val, isUserChange = true) {
1153+
if (isUserChange) {
1154+
this.userModifiedVddkSetting = true
1155+
}
11381156
if (val) {
11391157
this.form.forceconverttopool = true
11401158
this.form.forcemstoimportvmfiles = false
11411159
this.switches.forceConvertToPool = true
11421160
this.switches.forceMsToImportVmFiles = false
1161+
// Reset import host selection when VDDK is enabled
1162+
this.selectedKvmHostForImporting = null
11431163
// Refresh host list to show VDDK support details
11441164
this.fetchKvmHostsForConversion()
11451165
} else {
@@ -1399,6 +1419,7 @@ export default {
13991419
this.form.usevddk = false
14001420
this.form.forceconverttopool = false
14011421
this.form.forcemstoimportvmfiles = false
1422+
this.userModifiedVddkSetting = false
14021423
this.resetStorageOptionsForConversion()
14031424
},
14041425
closeAction () {

0 commit comments

Comments
 (0)