Skip to content

Commit 47a1707

Browse files
BryanMLimaSadiJrSadiJrjoseflauzino
authored
[UI] Addressing Dynamically Scale of KVM VMs (#5923)
* Externalize config to increment or not VM metrics in memory * UI fix for dynamically scale of KVM VMs Co-authored-by: SadiJr <17a0db2854@firemailbox.club> Co-authored-by: SadiJr <31869303+SadiJr@users.noreply.github.com> Co-authored-by: SadiJr <sadijacinto@gmail.com> Co-authored-by: José Flauzino <jose.wilson.vf@gmail.com>
1 parent 2c0adab commit 47a1707

4 files changed

Lines changed: 28 additions & 1 deletion

File tree

ui/public/locales/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3016,6 +3016,7 @@
30163016
"message.error.zone.name": "Please enter zone name",
30173017
"message.error.zone.type": "Please select zone type",
30183018
"message.error.linstor.resourcegroup": "Please enter the Linstor Resource-Group",
3019+
"message.error.fixed.offering.kvm": "It's not possible to scale up VMs that utilize KVM hypervisor with a fixed compute offering.",
30193020
"message.fail.to.delete": "Failed to delete.",
30203021
"message.failed.to.add": "Failed to add",
30213022
"message.failed.to.assign.vms": "Failed to assign VMs",

ui/public/locales/pt_BR.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2144,6 +2144,7 @@
21442144
"message.enabling.zone.dots": "Habilitando Zona....",
21452145
"message.enter.seperated.list.multiple.cidrs": "Por favor entre a de CIDRs separadas por v\u00edrgula, se houver mais de uma",
21462146
"message.enter.token": "Por favor entre o token que voc\u00ea recebeu no e-mail privado.",
2147+
"message.error.fixed.offering.kvm": "Não é possível escalar VMs que utilizam o hipervisor KVM com oferta de computa\u00e7\u00e3o fixa.",
21472148
"message.generate.keys": "Por favor confirme que voc\u00ea deseja gerar novas chaves para este usu\u00e1rio.",
21482149
"message.gslb.delete.confirm": "Confirme que voc\u00ea deseja apagar este GSLB",
21492150
"message.gslb.lb.remove.confirm": "Confirme que voc\u00ea deseja remover o balanceamento de carga deste GSLB",

ui/src/views/compute/ScaleVM.vue

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
<a-icon type="loading" style="color: #1890ff;"></a-icon>
2424
</div>
2525

26+
<a-alert v-if="fixedOfferingKvm" style="margin-bottom: 5px" type="error" show-icon>
27+
<span slot="message" v-html="$t('message.error.fixed.offering.kvm')" />
28+
</a-alert>
29+
2630
<compute-offering-selection
2731
:compute-items="offerings"
2832
:loading="loading"
@@ -40,6 +44,7 @@
4044
:isConstrained="'serviceofferingdetails' in selectedOffering"
4145
:minCpu="getMinCpu()"
4246
:maxCpu="'serviceofferingdetails' in selectedOffering ? selectedOffering.serviceofferingdetails.maxcpunumber*1 : Number.MAX_SAFE_INTEGER"
47+
:cpuSpeed="getCPUSpeed()"
4348
:minMemory="getMinMemory()"
4449
:maxMemory="'serviceofferingdetails' in selectedOffering ? selectedOffering.serviceofferingdetails.maxmemory*1 : Number.MAX_SAFE_INTEGER"
4550
:isCustomized="selectedOffering.iscustomized"
@@ -92,7 +97,8 @@ export default {
9297
loading: false,
9398
cpuNumberKey: 'details[0].cpuNumber',
9499
cpuSpeedKey: 'details[0].cpuSpeed',
95-
memoryKey: 'details[0].memory'
100+
memoryKey: 'details[0].memory',
101+
fixedOfferingKvm: false
96102
}
97103
},
98104
beforeCreate () {
@@ -125,6 +131,13 @@ export default {
125131
return
126132
}
127133
this.offerings = response.listserviceofferingsresponse.serviceoffering
134+
if (this.resource.state === 'Running' && this.resource.hypervisor === 'KVM') {
135+
this.offerings = this.offerings.filter(offering => offering.id === this.resource.serviceofferingid)
136+
this.currentOffer = this.offerings[0]
137+
if (this.currentOffer === undefined) {
138+
this.fixedOfferingKvm = true
139+
}
140+
}
128141
this.offerings.map(i => { this.offeringsMap[i.id] = i })
129142
}).finally(() => {
130143
this.loading = false
@@ -144,6 +157,13 @@ export default {
144157
}
145158
return this.selectedOffering?.serviceofferingdetails?.minmemory * 1 || 32
146159
},
160+
getCPUSpeed () {
161+
// We can only scale up while a VM is running
162+
if (this.resource.state === 'Running') {
163+
return this.resource.cpuspeed
164+
}
165+
return this.selectedOffering?.serviceofferingdetails?.cpuspeed * 1 || 1
166+
},
147167
getMessage () {
148168
if (this.resource.hypervisor === 'VMware') {
149169
return this.$t('message.read.admin.guide.scaling.up')

ui/src/views/compute/wizard/ComputeSelection.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ export default {
107107
type: Boolean,
108108
default: true
109109
},
110+
cpuSpeed: {
111+
type: Number,
112+
default: 0
113+
},
110114
minCpu: {
111115
type: Number,
112116
default: 0
@@ -198,6 +202,7 @@ export default {
198202
fillValue () {
199203
this.cpuNumberInputValue = this.minCpu
200204
this.memoryInputValue = this.minMemory
205+
this.cpuSpeedInputValue = this.cpuSpeed
201206
202207
if (!this.preFillContent) {
203208
this.updateComputeCpuNumber(this.cpuNumberInputValue)

0 commit comments

Comments
 (0)