saurabhkushwaha438 commented on code in PR #14413:
URL: https://github.com/apache/cloudstack/pull/14413#discussion_r4444706228


##########
ui/src/views/compute/wizard/ComputeSelection.vue:
##########
@@ -241,18 +315,37 @@ export default {
     updateComputeCpuSpeed (value) {
       this.$emit('update-compute-cpuspeed', this.cpuSpeedInputDecorator, value)
     },
-    updateComputeMemory (value) {
-      if (!value) this.memoryInputValue = 0
-      if (!this.validateInput('memory', value)) {
+    updateComputeMemory (displayValue) {
+      if (displayValue === null || displayValue === undefined || displayValue 
=== '') {
+        this.memoryDisplayValue = 0
+        this.memoryInputValue = 0
+      } else {
+        this.memoryDisplayValue = displayValue
+      }
+      if (!this.validateInput('memory', displayValue)) {
         return
       }
-      this.$emit('update-compute-memory', this.memoryInputDecorator, value)
+      let memoryInMiB
+      if (this.memoryUnit === 'GiB') {
+        if (this.isConstrained && displayValue === this.minMemoryInUnit) {
+          memoryInMiB = this.minMemory
+        } else if (this.isConstrained && displayValue === 
this.maxMemoryInUnit) {
+          memoryInMiB = this.maxMemory
+        } else {
+          memoryInMiB = Math.round(displayValue * 1024)
+        }
+      } else {
+        memoryInMiB = Math.round(displayValue)

Review Comment:
   thanks for pointing out this "Enter 100 MiB and then switch to GiB. The 
field displays 0 GiB, but instance creation still succeeds, and the deploy 
request sends 100 MiB, resulting in a VM being created with 100 MiB of memory." 



-- 
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