mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Fixing scale VM (#610)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
parent
cac2f800a0
commit
a0a69ca758
@ -136,36 +136,13 @@ export default {
|
|||||||
return this.$t('message.change.offering.confirm')
|
return this.$t('message.change.offering.confirm')
|
||||||
},
|
},
|
||||||
updateComputeOffering (id) {
|
updateComputeOffering (id) {
|
||||||
this.params.serviceofferingid = id
|
|
||||||
this.selectedOffering = this.offeringsMap[id]
|
|
||||||
|
|
||||||
// Delete custom details
|
// Delete custom details
|
||||||
delete this.params[this.cpuNumberKey]
|
delete this.params[this.cpuNumberKey]
|
||||||
delete this.params[this.cpuSpeedKey]
|
delete this.params[this.cpuSpeedKey]
|
||||||
delete this.params[this.memoryKey]
|
delete this.params[this.memoryKey]
|
||||||
|
|
||||||
if (!this.selectedOffering.iscustomized) {
|
this.params.serviceofferingid = id
|
||||||
return
|
this.selectedOffering = this.offeringsMap[id]
|
||||||
}
|
|
||||||
|
|
||||||
// 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
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
updateFieldValue (name, value) {
|
updateFieldValue (name, value) {
|
||||||
this.params[name] = value
|
this.params[name] = value
|
||||||
@ -175,10 +152,12 @@ export default {
|
|||||||
},
|
},
|
||||||
handleSubmit () {
|
handleSubmit () {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
let apiName = 'scaleVirtualMachine'
|
|
||||||
if (this.resource.state === 'Stopped') {
|
const apiName = this.resource.state === 'Stopped' ? 'changeServiceForVirtualMachine' : 'scaleVirtualMachine'
|
||||||
apiName = 'changeServiceForVirtualMachine'
|
if ('cpuspeed' in this.selectedOffering && this.selectedOffering.iscustomized) {
|
||||||
|
delete this.params[this.cpuSpeedKey]
|
||||||
}
|
}
|
||||||
|
|
||||||
api(apiName, this.params).then(response => {
|
api(apiName, this.params).then(response => {
|
||||||
if (apiName === 'scaleVirtualMachine') {
|
if (apiName === 'scaleVirtualMachine') {
|
||||||
const jobId = response.scalevirtualmachineresponse.jobid
|
const jobId = response.scalevirtualmachineresponse.jobid
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user