winterhazel commented on code in PR #8070:
URL: https://github.com/apache/cloudstack/pull/8070#discussion_r1507867274


##########
ui/src/views/compute/DeployVM.vue:
##########
@@ -1331,36 +1331,24 @@ 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) {
-          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)
+        if (iso) {
+          if (this.serviceOffering?.diskofferingid) {

Review Comment:
   This changes the behavior of the code.
   
   Suppose `iso` and `this.diskSelected` have values, but 
`this.serviceOffering?.diskofferingid` does not. Before, the execution would go 
inside `if (iso)`, but `this.diskOffering` would not be defined. Applying these 
changes, the execution would get inside the `else` and define 
`this.diskOffering`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to