This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack-primate.git


The following commit(s) were added to refs/heads/master by this push:
     new 592b25f  Fixing scale VM (#610)
592b25f is described below

commit 592b25fe4bc7f67355bed6d0daba3d6ef382df03
Author: davidjumani <[email protected]>
AuthorDate: Tue Aug 25 13:06:33 2020 +0530

    Fixing scale VM (#610)
---
 src/views/compute/ScaleVM.vue | 35 +++++++----------------------------
 1 file changed, 7 insertions(+), 28 deletions(-)

diff --git a/src/views/compute/ScaleVM.vue b/src/views/compute/ScaleVM.vue
index 907db61..d22b6f6 100644
--- a/src/views/compute/ScaleVM.vue
+++ b/src/views/compute/ScaleVM.vue
@@ -136,36 +136,13 @@ export default {
       return this.$t('message.change.offering.confirm')
     },
     updateComputeOffering (id) {
-      this.params.serviceofferingid = id
-      this.selectedOffering = this.offeringsMap[id]
-
       // Delete custom details
       delete this.params[this.cpuNumberKey]
       delete this.params[this.cpuSpeedKey]
       delete this.params[this.memoryKey]
 
-      if (!this.selectedOffering.iscustomized) {
-        return
-      }
-
-      // Set custom defaults if unconstrained
-      if (!this.selectedOffering.serviceofferingdetails) {
-        this.params[this.cpuNumberKey] = 1
-        this.params[this.cpuSpeedKey] = 1
-        this.params[this.memoryKey] = 32 // Min allowed by the backend is 32MB
-        return
-      }
-
-      // Set min defaults
-      if (this.selectedOffering.serviceofferingdetails.mincpunumber) {
-        this.params[this.cpuNumberKey] = 
this.selectedOffering.serviceofferingdetails.mincpunumber
-      }
-      if (this.selectedOffering.serviceofferingdetails.mincpuspeed) {
-        this.params[this.cpuSpeedKey] = 
this.selectedOffering.serviceofferingdetails.mincpuspeed
-      }
-      if (this.selectedOffering.serviceofferingdetails.minmemory) {
-        this.params[this.memoryKey] = 
this.selectedOffering.serviceofferingdetails.minmemory
-      }
+      this.params.serviceofferingid = id
+      this.selectedOffering = this.offeringsMap[id]
     },
     updateFieldValue (name, value) {
       this.params[name] = value
@@ -175,10 +152,12 @@ export default {
     },
     handleSubmit () {
       this.loading = true
-      let apiName = 'scaleVirtualMachine'
-      if (this.resource.state === 'Stopped') {
-        apiName = 'changeServiceForVirtualMachine'
+
+      const apiName = this.resource.state === 'Stopped' ? 
'changeServiceForVirtualMachine' : 'scaleVirtualMachine'
+      if ('cpuspeed' in this.selectedOffering && 
this.selectedOffering.iscustomized) {
+        delete this.params[this.cpuSpeedKey]
       }
+
       api(apiName, this.params).then(response => {
         if (apiName === 'scaleVirtualMachine') {
           const jobId = response.scalevirtualmachineresponse.jobid

Reply via email to