Change default ratio CPU:VCPU when enable instantiate_hide_cpu

Hi,

Is it possible to change default ratio CPU:VCPU when enable instantiate_hide_cpu on cloud view ? Example 0.5:1.

Thanks

Hello,

I tried to achieve the same as vynt (hide the CPU field by setting instantiate_hide_cpu to true AND at the same time set the CPU/vCPU factor by setting instantiate_cpu_factor to e.g. 0.5).
This does indeed not work and the result of these settings is that the CPU field is hidden, but the factor is always 1:1 .

I think the problem is related to this .js file.
https://dev.opennebula.org/projects/opennebula/repository/revisions/26fcd6afd131e2936a05e860669412869e0cc071/entry/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general/capacity-inputs.js
At some point (line 194 or 224?) the factor seems to be hardcoded if instantiate_hide_cpu is set to true.

This seems to me like a (small) bug or misconception? Because I think it is desirable to use instantiate_hide_cpu AND instantiate_cpu_factor at the same time.

EDIT: I tested a little bit more and found out that I can manually change the CPU value even though the instantiate_cpu_factor is set, which makes this even worse.
Solving this issue could also solve https://dev.opennebula.org/issues/3870 in myopinion

Thanks
Uli

Hi,

You are right. I’ve could reproduce the problem and solved it.

About this:

When the scaling factor is ‘true’, I have disabled CPU input.

Thanks for the report.
Regards.

Abel.

This is great news.

While you are at it I think found another (tiny) related bug.
For me the data type of the scale factor seems to wrong.

Steps to reproduce (Version 5.4)

  1. Set instantiate_hide_cpu = false
  2. instantiate_cpu_factor = 0.1
  3. Instantiate a new VM and increasing the vCPUs with the arrow buttons results at some point in weird decimal values (e.g. vCPU=3 -> CPU=0,30000000000000004 OR vCPU=7 -> CPU=0,7000000000000001)

This isn’t as important to me like the other bug but could at some point result in weird behavior and should hopefully be easy to fix as well.

Thanks
Uli