This is an automated email from the ASF dual-hosted git repository.
joao pushed a commit to branch 4.18
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/4.18 by this push:
new d487a1c3417 Fix disk offering override in VM deployment wizard (#8070)
d487a1c3417 is described below
commit d487a1c3417c3f97b1ce1099533df785ecdc9404
Author: Fabricio Duarte <[email protected]>
AuthorDate: Fri Mar 8 16:10:24 2024 -0300
Fix disk offering override in VM deployment wizard (#8070)
* Fix disk offering override in VM deployment wizard
* Reduce indentation
---
ui/src/views/compute/DeployVM.vue | 32 ++++++----------------
.../views/compute/wizard/DiskOfferingSelection.vue | 1 +
2 files changed, 9 insertions(+), 24 deletions(-)
diff --git a/ui/src/views/compute/DeployVM.vue
b/ui/src/views/compute/DeployVM.vue
index 9d07cb51db3..2de28c9b79c 100644
--- a/ui/src/views/compute/DeployVM.vue
+++ b/ui/src/views/compute/DeployVM.vue
@@ -1331,36 +1331,20 @@ export default {
}
this.serviceOffering = _.find(this.options.serviceOfferings, (option)
=> option.id === instanceConfig.computeofferingid)
- if (this.serviceOffering?.diskofferingid) {
- if (iso) {
- this.diskOffering = _.find(this.options.diskOfferings, (option) =>
option.id === this.serviceOffering.diskofferingid)
- } else {
- instanceConfig.overridediskofferingid =
this.serviceOffering.diskofferingid
- }
- }
- if (!iso && this.diskSelected) {
- this.diskOffering = _.find(this.options.diskOfferings, (option) =>
option.id === instanceConfig.diskofferingid)
- }
- if (this.rootDiskSelected?.id) {
- instanceConfig.overridediskofferingid = this.rootDiskSelected.id
- }
+
+ instanceConfig.overridediskofferingid = this.rootDiskSelected?.id ||
this.serviceOffering?.diskofferingid
if (instanceConfig.overridediskofferingid) {
this.overrideDiskOffering = _.find(this.options.diskOfferings,
(option) => option.id === instanceConfig.overridediskofferingid)
} else {
this.overrideDiskOffering = null
}
- if (!iso && this.diskSelected) {
+ if (iso && this.serviceOffering?.diskofferingid) {
+ this.diskOffering = _.find(this.options.diskOfferings, (option) =>
option.id === this.serviceOffering.diskofferingid)
+ } else if (!iso && this.diskSelected) {
this.diskOffering = _.find(this.options.diskOfferings, (option) =>
option.id === instanceConfig.diskofferingid)
}
- if (this.rootDiskSelected?.id) {
- instanceConfig.overridediskofferingid = this.rootDiskSelected.id
- }
- if (instanceConfig.overridediskofferingid) {
- this.overrideDiskOffering = _.find(this.options.diskOfferings,
(option) => option.id === instanceConfig.overridediskofferingid)
- } else {
- this.overrideDiskOffering = null
- }
+
this.zone = _.find(this.options.zones, (option) => option.id ===
instanceConfig.zoneid)
this.affinityGroups = _.filter(this.options.affinityGroups, (option)
=> _.includes(instanceConfig.affinitygroupids, option.id))
this.networks =
this.getSelectedNetworksWithExistingConfig(_.filter(this.options.networks,
(option) => _.includes(instanceConfig.networkids, option.id)))
@@ -1637,6 +1621,7 @@ export default {
this.showRootDiskSizeChanger = false
} else {
this.rootDiskSelected = null
+ this.form.overridediskofferingid = undefined
}
this.showOverrideDiskOfferingOption = val
},
@@ -1875,7 +1860,6 @@ export default {
if (this.loading.deploy) return
this.formRef.value.validate().then(async () => {
const values = toRaw(this.form)
-
if (!values.templateid && !values.isoid) {
this.$notification.error({
message: this.$t('message.request.failed'),
@@ -1962,7 +1946,7 @@ export default {
if (this.selectedTemplateConfiguration) {
deployVmData['details[0].configurationId'] =
this.selectedTemplateConfiguration.id
}
- if (!this.serviceOffering.diskofferingstrictness &&
values.overridediskofferingid) {
+ if (!this.serviceOffering.diskofferingstrictness &&
values.overridediskofferingid && !values.isoid) {
deployVmData.overridediskofferingid = values.overridediskofferingid
if (values.rootdisksize && values.rootdisksize > 0) {
deployVmData.rootdisksize = values.rootdisksize
diff --git a/ui/src/views/compute/wizard/DiskOfferingSelection.vue
b/ui/src/views/compute/wizard/DiskOfferingSelection.vue
index 6262795c595..3785baabb0b 100644
--- a/ui/src/views/compute/wizard/DiskOfferingSelection.vue
+++ b/ui/src/views/compute/wizard/DiskOfferingSelection.vue
@@ -227,6 +227,7 @@ export default {
this.selectedRowKeys = value
this.$emit('select-disk-offering-item', value[0])
this.$emit('on-selected-disk-size', this.diskSelected)
+ this.$emit('on-selected-root-disk-size', this.diskSelected)
},
handleSearch (value) {
this.filter = value