From 1cf0ce6906a57811256c3304532a59a30ddf21fc Mon Sep 17 00:00:00 2001 From: Manoj Kumar Date: Thu, 12 Mar 2026 23:02:08 +0530 Subject: [PATCH 1/3] Load arch data for backup from template during create instance from backup --- ui/src/components/view/DeployVMFromBackup.vue | 5 ++--- ui/src/views/storage/CreateVMFromBackup.vue | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/ui/src/components/view/DeployVMFromBackup.vue b/ui/src/components/view/DeployVMFromBackup.vue index 55808db291c2..afa6f9cece54 100644 --- a/ui/src/components/view/DeployVMFromBackup.vue +++ b/ui/src/components/view/DeployVMFromBackup.vue @@ -1456,6 +1456,7 @@ export default { this.tabKey = 'isoid' } else { this.tabKey = 'templateid' + this.selectedArchitecture = this.dataPreFill.templateArch ? this.dataPreFill.templateArch : this.architectureTypes.opts[0].id } this.fetchData() @@ -1718,6 +1719,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 = [] @@ -2344,9 +2346,6 @@ export default { this.clusterId = null this.zone = _.find(this.options.zones, (option) => option.id === value) this.isZoneSelectedMultiArch = this.zone.ismultiarch - if (this.isZoneSelectedMultiArch) { - this.selectedArchitecture = this.architectureTypes.opts[0].id - } this.zoneSelected = true this.form.startvm = true this.selectedZone = this.zoneId diff --git a/ui/src/views/storage/CreateVMFromBackup.vue b/ui/src/views/storage/CreateVMFromBackup.vue index 8d29397e45ad..6ce4ab682af4 100644 --- a/ui/src/views/storage/CreateVMFromBackup.vue +++ b/ui/src/views/storage/CreateVMFromBackup.vue @@ -94,7 +94,8 @@ export default { async created () { await Promise.all[( this.fetchServiceOffering(), - this.fetchBackupOffering() + this.fetchBackupOffering(), + this.fetchTemplateArch() )] this.loading = false }, @@ -118,6 +119,18 @@ export default { this.backupOffering = backupOfferings[0] }) }, + fetchTemplateArch () { + return getAPI('listTemplates', { + id: this.resource.vmdetails.templateid, + listall: true, + templatefilter: 'all' + }).then(response => { + const templates = response.listtemplatesresponse.template || [] + this.templateArch = templates[0]?.arch || 'x86_64' + }).catch(() => { + this.templateArch = 'x86_64' + }) + }, populatePreFillData () { this.vmdetails = this.resource.vmdetails this.dataPreFill.zoneid = this.resource.zoneid @@ -128,6 +141,7 @@ export default { this.dataPreFill.backupid = this.resource.id this.dataPreFill.computeofferingid = this.vmdetails.serviceofferingid this.dataPreFill.templateid = this.vmdetails.templateid + this.dataPreFill.templateArch = this.templateArch this.dataPreFill.allowtemplateisoselection = true this.dataPreFill.isoid = this.vmdetails.templateid this.dataPreFill.allowIpAddressesFetch = this.resource.isbackupvmexpunged From e62326e5ddc72cd687f951daa2d867ddedd22ae8 Mon Sep 17 00:00:00 2001 From: Manoj Kumar Date: Fri, 13 Mar 2026 10:57:07 +0530 Subject: [PATCH 2/3] handle selectedarch for iso --- ui/src/components/view/DeployVMFromBackup.vue | 3 +-- ui/src/views/storage/CreateVMFromBackup.vue | 25 +++++++++++-------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/ui/src/components/view/DeployVMFromBackup.vue b/ui/src/components/view/DeployVMFromBackup.vue index afa6f9cece54..22a445c4bae1 100644 --- a/ui/src/components/view/DeployVMFromBackup.vue +++ b/ui/src/components/view/DeployVMFromBackup.vue @@ -1451,12 +1451,11 @@ 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 { this.tabKey = 'templateid' - this.selectedArchitecture = this.dataPreFill.templateArch ? this.dataPreFill.templateArch : this.architectureTypes.opts[0].id } this.fetchData() diff --git a/ui/src/views/storage/CreateVMFromBackup.vue b/ui/src/views/storage/CreateVMFromBackup.vue index 6ce4ab682af4..891e8fe96420 100644 --- a/ui/src/views/storage/CreateVMFromBackup.vue +++ b/ui/src/views/storage/CreateVMFromBackup.vue @@ -92,11 +92,11 @@ export default { } }, async created () { - await Promise.all[( + await Promise.all([ this.fetchServiceOffering(), this.fetchBackupOffering(), - this.fetchTemplateArch() - )] + this.fetchBackupArch() + ]) this.loading = false }, methods: { @@ -119,16 +119,21 @@ export default { this.backupOffering = backupOfferings[0] }) }, - fetchTemplateArch () { - return getAPI('listTemplates', { + 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, - templatefilter: 'all' + ...(isIso ? {} : { templatefilter: 'all' }) }).then(response => { - const templates = response.listtemplatesresponse.template || [] - this.templateArch = templates[0]?.arch || 'x86_64' + const items = response?.[responseKey]?.[itemKey] || [] + this.backupArch = items[0]?.arch || 'x86_64' }).catch(() => { - this.templateArch = 'x86_64' + this.backupArch = 'x86_64' }) }, populatePreFillData () { @@ -141,7 +146,7 @@ export default { this.dataPreFill.backupid = this.resource.id this.dataPreFill.computeofferingid = this.vmdetails.serviceofferingid this.dataPreFill.templateid = this.vmdetails.templateid - this.dataPreFill.templateArch = this.templateArch + this.dataPreFill.backupArch = this.backupArch this.dataPreFill.allowtemplateisoselection = true this.dataPreFill.isoid = this.vmdetails.templateid this.dataPreFill.allowIpAddressesFetch = this.resource.isbackupvmexpunged From 9fb0e71e3ee44617062a1c617053fcf61f73ea89 Mon Sep 17 00:00:00 2001 From: Manoj Kumar Date: Fri, 13 Mar 2026 11:25:36 +0530 Subject: [PATCH 3/3] cleanup method not in use --- ui/src/components/view/DeployVMFromBackup.vue | 40 ------------------- 1 file changed, 40 deletions(-) diff --git a/ui/src/components/view/DeployVMFromBackup.vue b/ui/src/components/view/DeployVMFromBackup.vue index 22a445c4bae1..888d29509e1d 100644 --- a/ui/src/components/view/DeployVMFromBackup.vue +++ b/ui/src/components/view/DeployVMFromBackup.vue @@ -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) => {