Skip to content

Commit 1cf0ce6

Browse files
committed
Load arch data for backup from template during create instance from backup
1 parent 7aa0558 commit 1cf0ce6

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

ui/src/components/view/DeployVMFromBackup.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1456,6 +1456,7 @@ export default {
14561456
this.tabKey = 'isoid'
14571457
} else {
14581458
this.tabKey = 'templateid'
1459+
this.selectedArchitecture = this.dataPreFill.templateArch ? this.dataPreFill.templateArch : this.architectureTypes.opts[0].id
14591460
}
14601461
14611462
this.fetchData()
@@ -1718,6 +1719,7 @@ export default {
17181719
if (template.details['vmware-to-kvm-mac-addresses']) {
17191720
this.dataPreFill.macAddressArray = JSON.parse(template.details['vmware-to-kvm-mac-addresses'])
17201721
}
1722+
this.selectedArchitecture = template?.arch || 'x86_64'
17211723
}
17221724
} else if (name === 'isoid') {
17231725
this.templateConfigurations = []
@@ -2344,9 +2346,6 @@ export default {
23442346
this.clusterId = null
23452347
this.zone = _.find(this.options.zones, (option) => option.id === value)
23462348
this.isZoneSelectedMultiArch = this.zone.ismultiarch
2347-
if (this.isZoneSelectedMultiArch) {
2348-
this.selectedArchitecture = this.architectureTypes.opts[0].id
2349-
}
23502349
this.zoneSelected = true
23512350
this.form.startvm = true
23522351
this.selectedZone = this.zoneId

ui/src/views/storage/CreateVMFromBackup.vue

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ export default {
9494
async created () {
9595
await Promise.all[(
9696
this.fetchServiceOffering(),
97-
this.fetchBackupOffering()
97+
this.fetchBackupOffering(),
98+
this.fetchTemplateArch()
9899
)]
99100
this.loading = false
100101
},
@@ -118,6 +119,18 @@ export default {
118119
this.backupOffering = backupOfferings[0]
119120
})
120121
},
122+
fetchTemplateArch () {
123+
return getAPI('listTemplates', {
124+
id: this.resource.vmdetails.templateid,
125+
listall: true,
126+
templatefilter: 'all'
127+
}).then(response => {
128+
const templates = response.listtemplatesresponse.template || []
129+
this.templateArch = templates[0]?.arch || 'x86_64'
130+
}).catch(() => {
131+
this.templateArch = 'x86_64'
132+
})
133+
},
121134
populatePreFillData () {
122135
this.vmdetails = this.resource.vmdetails
123136
this.dataPreFill.zoneid = this.resource.zoneid
@@ -128,6 +141,7 @@ export default {
128141
this.dataPreFill.backupid = this.resource.id
129142
this.dataPreFill.computeofferingid = this.vmdetails.serviceofferingid
130143
this.dataPreFill.templateid = this.vmdetails.templateid
144+
this.dataPreFill.templateArch = this.templateArch
131145
this.dataPreFill.allowtemplateisoselection = true
132146
this.dataPreFill.isoid = this.vmdetails.templateid
133147
this.dataPreFill.allowIpAddressesFetch = this.resource.isbackupvmexpunged

0 commit comments

Comments
 (0)