Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 2 additions & 44 deletions ui/src/components/view/DeployVMFromBackup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1451,7 +1451,7 @@ export default {
this.initForm()
this.dataPreFill = this.preFillContent && Object.keys(this.preFillContent).length > 0 ? this.preFillContent : {}
this.showOverrideDiskOfferingOption = this.dataPreFill.overridediskoffering

this.selectedArchitecture = this.dataPreFill.backupArch ? this.dataPreFill.backupArch : this.architectureTypes.opts[0].id
if (this.dataPreFill.isIso) {
this.tabKey = 'isoid'
} else {
Expand Down Expand Up @@ -1540,46 +1540,6 @@ export default {
fillValue (field) {
this.form[field] = this.dataPreFill[field]
},
fetchZoneByQuery () {
return new Promise(resolve => {
let zones = []
let apiName = ''
const params = {}
if (this.templateId) {
apiName = 'listTemplates'
params.listall = true
params.templatefilter = this.isNormalAndDomainUser ? 'executable' : 'all'
params.id = this.templateId
} else if (this.isoId) {
apiName = 'listIsos'
params.listall = true
params.isofilter = this.isNormalAndDomainUser ? 'executable' : 'all'
params.id = this.isoId
} else if (this.networkId) {
params.listall = true
params.id = this.networkId
apiName = 'listNetworks'
}
if (!apiName) return resolve(zones)

getAPI(apiName, params).then(json => {
let objectName
const responseName = [apiName.toLowerCase(), 'response'].join('')
for (const key in json[responseName]) {
if (key === 'count') {
continue
}
objectName = key
break
}
const data = json?.[responseName]?.[objectName] || []
zones = data.map(item => item.zoneid)
return resolve(zones)
}).catch(() => {
return resolve(zones)
})
})
},
async fetchData () {
this.fetchZones(null, null)
_.each(this.params, (param, name) => {
Expand Down Expand Up @@ -1718,6 +1678,7 @@ export default {
if (template.details['vmware-to-kvm-mac-addresses']) {
this.dataPreFill.macAddressArray = JSON.parse(template.details['vmware-to-kvm-mac-addresses'])
}
this.selectedArchitecture = template?.arch || 'x86_64'
}
} else if (name === 'isoid') {
this.templateConfigurations = []
Expand Down Expand Up @@ -2344,9 +2305,6 @@ export default {
this.clusterId = null
this.zone = _.find(this.options.zones, (option) => option.id === value)
this.isZoneSelectedMultiArch = this.zone.ismultiarch
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the multi-arch defaulting in onSelectZoneId can leave selectedArchitecture as null for the ISO flow (dataPreFill.isIso === true), because created() only initializes selectedArchitecture in the template tab. fetchIsos() will still add args.architecture = this.selectedArchitecture whenever isZoneSelectedMultiArch is true, so multi-arch zones may end up calling listIsos with an empty/null architecture filter and return no results. Fix by ensuring selectedArchitecture is initialized (e.g. to architectureTypes.opts[0].id) when entering a multi-arch zone if it’s currently unset, or by only sending the architecture param when it has a value.

Suggested change
this.isZoneSelectedMultiArch = this.zone.ismultiarch
this.isZoneSelectedMultiArch = this.zone.ismultiarch
if (this.isZoneSelectedMultiArch &&
!this.selectedArchitecture &&
this.architectureTypes &&
Array.isArray(this.architectureTypes.opts) &&
this.architectureTypes.opts.length > 0) {
this.selectedArchitecture = this.architectureTypes.opts[0].id
}

Copilot uses AI. Check for mistakes.
if (this.isZoneSelectedMultiArch) {
this.selectedArchitecture = this.architectureTypes.opts[0].id
}
this.zoneSelected = true
this.form.startvm = true
this.selectedZone = this.zoneId
Expand Down
25 changes: 22 additions & 3 deletions ui/src/views/storage/CreateVMFromBackup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,11 @@ export default {
}
},
async created () {
await Promise.all[(
await Promise.all([
this.fetchServiceOffering(),
this.fetchBackupOffering()
)]
this.fetchBackupOffering(),
this.fetchBackupArch()
])
this.loading = false
},
methods: {
Expand All @@ -118,6 +119,23 @@ export default {
this.backupOffering = backupOfferings[0]
})
},
fetchBackupArch () {
const isIso = this.resource.vmdetails.isiso === 'true'
const api = isIso ? 'listIsos' : 'listTemplates'
const responseKey = isIso ? 'listisosresponse' : 'listtemplatesresponse'
const itemKey = isIso ? 'iso' : 'template'

return getAPI(api, {
id: this.resource.vmdetails.templateid,
listall: true,
...(isIso ? {} : { templatefilter: 'all' })
}).then(response => {
const items = response?.[responseKey]?.[itemKey] || []
this.backupArch = items[0]?.arch || 'x86_64'
}).catch(() => {
this.backupArch = 'x86_64'
})
},
populatePreFillData () {
this.vmdetails = this.resource.vmdetails
this.dataPreFill.zoneid = this.resource.zoneid
Expand All @@ -128,6 +146,7 @@ export default {
this.dataPreFill.backupid = this.resource.id
this.dataPreFill.computeofferingid = this.vmdetails.serviceofferingid
this.dataPreFill.templateid = this.vmdetails.templateid
this.dataPreFill.backupArch = this.backupArch
this.dataPreFill.allowtemplateisoselection = true
this.dataPreFill.isoid = this.vmdetails.templateid
this.dataPreFill.allowIpAddressesFetch = this.resource.isbackupvmexpunged
Expand Down
Loading