Oneshowback shows mismatched information

Hello,

I’m trying to configure my OpenNebula server to calculate VMs costs. I have configured these feature in two ways: assigning values in the VM template and assigning values in /etc/one/oned.host.
Assigned values are:

  • Memory: 1

  • CPU: 5

  • Disk: 10

In VM template, cost calculated (for a VM with 300 MB, 1 CPU and 8 GB disk) is 219.66K /month.
After running 2 VMs equals (one with a template with costs and another one with a template without costs because these are assigned from /etc/one/oned.conf), information from “oneshowback” is different:

    USER_NAM GROUP_NA  VM_ID VM_NAME             MONTH  YEAR  HOURS            COST
    oneadmin oneadmin     20 costs-oned.conf        11  2020   0.11         8656.46
    oneadmin oneadmin     21 costs-template         11  2020   0.10           37.22

Why is this happening?

Thanks.

Hello @Daniel_Ruiz_Molina

What OpenNebula version are you using?

Different costs is different, because it is calculated with precision, so it is nearly impossible that the time they have been active is the same for both of them.

Best,
Álex.

I’m using OpenNebula 5.10.1

Both instances were started at the same time (with, maybe, a difference of 5 seconds): first instance with a template without costs (assuming “default costs” from /etc/one/oned.conf) and second one with a template with applied costs. In both cases, costs values for memory, CPU and Disk were the same, but cost total were very different.
It seems that, maybe, values taken from /etc/one/oned.conf could be evaluated in other meause. For example, maybe memory value is evaluate for each MB, while in template memory is being evaluated in GB

There was an issue related with calculation process. You can check all the information here.

Could you please try the fix and let me know if you continue having the same troubles?

Best,
Álex.

In my scenario, both machines were running the same time, but costs were so different I though the problem could be in the “units” (/etc/one/oned.conf in MB and template in GB???)

Could you please paste here the VM template you are using (onetemplate show <template_id> -x)?

Hi Alejandro,

Now, I have reassigned values for “cost” because I have been testing with “real” values. Now, new values are:

  • Memory: 0.015 per GB

  • CPU: 0.01 per CPU

  • Disk: 0.000768 per GB

With these values, what I get from “oneshowback calculate && oneshowback list” is:

oneadmin oneadmin 26 Test-costes-template 11 2020 0.06 1.35
oneadmin oneadmin 27 Test-costes-oned.con 11 2020 0.05 1.17

However, what I see in Sunstone, when I click over the “costed-template” is that memory has assigned 15.36 per GB (with a total of 11.06K /month), CPU shows correctly its 0.01 (but no shows its cost by month) and disk shows 0.786432 per GB (with a total of 4.529848K). Cost total is 11.07K per month (according Sunstone information)…

Sorry, but I don’t understand these outputs.

Thanks.

P.S.: I could sent you a screenshot. Maybe, it would be clearer…

After some tests, I have got a conclusion (of course, if I’m wrong, please, tell me :wink: )
Values in /etc/one/oned.conf are assigned in MB for memory and for disk. In my scenario, I had assigned 1 GB RAM, 1 CPU and 8 GB disk. Then, my purppose was to get a cost by month around 22, so I have assigned 0,015 per GB in memory, 0,01 per CPU and 0,000768 per GB in disk (that values are per hour). Then, total cost is 22.42 per month. But that values are assigned in other way in template shown in “Advanced” view. There, for memory there are these three values:

MEMORY = “1024” (I assign 1 GB to the instance)
MEMORY_COST = “0.0000146484375”
MEMORY_UNIT_COST = “GB”

For CPU:

CPU_COST = “0.01”

And for disk:

DISK_COST = “7.5e-7”

Meanwhile, in /etc/one/oned.conf, I have assigned the same values, reconfiguring this file in this way:

DEFAULT_COST = [
CPU_COST = 0.01,
MEMORY_COST = 0.0000146484375,
DISK_COST = 7.5e-7
]

Now, with this configuration, both costs are equal:

oneadmin oneadmin 27 Test-costes-oned.con 11 2020 4.13 0.13
oneadmin oneadmin 28 Test-costes-template 11 2020 3.13 0.10

But… I have noticed if I assigned directly 0.015 in memory cost in the template (wizard view, NOT advanced view), that 0.015 was changed by other value and, then, costs weren’t the same… so I think problem is with units (GB or MB) for memory and/or disk.

Am I wrong?

Thanks!

P.D.: sorry for this loooong post, but I’m taking some days to reach a correct cost value.