Skip to content
1 change: 1 addition & 0 deletions ui/public/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2987,6 +2987,7 @@
"message.error.zone.name": "Please enter zone name",
"message.error.zone.type": "Please select zone type",
"message.error.linstor.resourcegroup": "Please enter the Linstor Resource-Group",
"message.error.fixed.offering.kvm": "It's not possible to scale up VMs that utilize KVM hypervisor with a fixed compute offering.",
"message.fail.to.delete": "Failed to delete.",
"message.failed.to.add": "Failed to add",
"message.failed.to.assign.vms": "Failed to assign VMs",
Expand Down
1 change: 1 addition & 0 deletions ui/public/locales/pt_BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -2144,6 +2144,7 @@
"message.enabling.zone.dots": "Habilitando Zona....",
"message.enter.seperated.list.multiple.cidrs": "Por favor entre a de CIDRs separadas por v\u00edrgula, se houver mais de uma",
"message.enter.token": "Por favor entre o token que voc\u00ea recebeu no e-mail privado.",
"message.error.fixed.offering.kvm": "Não é possível escalar VMs que utilizam o hipervisor KVM com oferta de computa\u00e7\u00e3o fixa.",
"message.generate.keys": "Por favor confirme que voc\u00ea deseja gerar novas chaves para este usu\u00e1rio.",
"message.gslb.delete.confirm": "Confirme que voc\u00ea deseja apagar este GSLB",
"message.gslb.lb.remove.confirm": "Confirme que voc\u00ea deseja remover o balanceamento de carga deste GSLB",
Expand Down
2 changes: 1 addition & 1 deletion ui/src/config/section/compute.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ export default {
label: 'label.scale.vm',
docHelp: 'adminguide/virtual_machines.html#how-to-dynamically-scale-cpu-and-ram',
dataView: true,
show: (record) => { return ['Stopped'].includes(record.state) || (['Running'].includes(record.state) && record.hypervisor !== 'KVM' && record.hypervisor !== 'LXC') },
show: (record) => { return ['Stopped'].includes(record.state) || (['Running'].includes(record.state) && record.hypervisor !== 'LXC') },
disabled: (record) => { return record.state === 'Running' && !record.isdynamicallyscalable },
popup: true,
component: () => import('@/views/compute/ScaleVM.vue')
Expand Down
22 changes: 21 additions & 1 deletion ui/src/views/compute/ScaleVM.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
<a-icon type="loading" style="color: #1890ff;"></a-icon>
</div>

<a-alert v-if="fixedOfferingKvm" style="margin-bottom: 5px" type="error" show-icon>
<span slot="message" v-html="$t('message.error.fixed.offering.kvm')" />
</a-alert>

<compute-offering-selection
:compute-items="offerings"
:loading="loading"
Expand All @@ -40,6 +44,7 @@
:isConstrained="'serviceofferingdetails' in selectedOffering"
:minCpu="getMinCpu()"
:maxCpu="'serviceofferingdetails' in selectedOffering ? selectedOffering.serviceofferingdetails.maxcpunumber*1 : Number.MAX_SAFE_INTEGER"
:cpuSpeed="getCPUSpeed()"
:minMemory="getMinMemory()"
:maxMemory="'serviceofferingdetails' in selectedOffering ? selectedOffering.serviceofferingdetails.maxmemory*1 : Number.MAX_SAFE_INTEGER"
:isCustomized="selectedOffering.iscustomized"
Expand Down Expand Up @@ -83,7 +88,8 @@ export default {
loading: false,
cpuNumberKey: 'details[0].cpuNumber',
cpuSpeedKey: 'details[0].cpuSpeed',
memoryKey: 'details[0].memory'
memoryKey: 'details[0].memory',
fixedOfferingKvm: false
}
},
created () {
Expand Down Expand Up @@ -112,6 +118,13 @@ export default {
return
}
this.offerings = response.listserviceofferingsresponse.serviceoffering
if (this.resource.state === 'Running' && this.resource.hypervisor === 'KVM') {
this.offerings = this.offerings.filter(offering => offering.id === this.resource.serviceofferingid)
this.currentOffer = this.offerings[0]
if (this.currentOffer === undefined) {
this.fixedOfferingKvm = true
}
}
this.offerings.map(i => { this.offeringsMap[i.id] = i })
}).finally(() => {
this.loading = false
Expand All @@ -131,6 +144,13 @@ export default {
}
return this.selectedOffering?.serviceofferingdetails?.minmemory * 1 || 32
},
getCPUSpeed () {
// We can only scale up while a VM is running
if (this.resource.state === 'Running') {
return this.resource.cpuspeed
}
return this.selectedOffering?.serviceofferingdetails?.cpuspeed * 1 || 1
},
getMessage () {
if (this.resource.hypervisor === 'VMware') {
return this.$t('message.read.admin.guide.scaling.up')
Expand Down
5 changes: 5 additions & 0 deletions ui/src/views/compute/wizard/ComputeSelection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ export default {
type: Boolean,
default: true
},
cpuSpeed: {
type: Number,
default: 0
},
minCpu: {
type: Number,
default: 0
Expand Down Expand Up @@ -198,6 +202,7 @@ export default {
fillValue () {
this.cpuNumberInputValue = this.minCpu
this.memoryInputValue = this.minMemory
this.cpuSpeedInputValue = this.cpuSpeed

if (!this.preFillContent) {
this.updateComputeCpuNumber(this.cpuNumberInputValue)
Expand Down